diff --git a/public/images/fantasiaMascot/fantasia_cooking.png b/public/images/fantasiaMascot/fantasia_cooking.png
new file mode 100644
index 0000000..d767170
Binary files /dev/null and b/public/images/fantasiaMascot/fantasia_cooking.png differ
diff --git a/public/images/fantasiaMascot/fantasia_didYouKnow.png b/public/images/fantasiaMascot/fantasia_didYouKnow.png
new file mode 100644
index 0000000..ca852e0
Binary files /dev/null and b/public/images/fantasiaMascot/fantasia_didYouKnow.png differ
diff --git a/public/images/fantasiaMascot/fantasia_error.png b/public/images/fantasiaMascot/fantasia_error.png
new file mode 100644
index 0000000..8ee9483
Binary files /dev/null and b/public/images/fantasiaMascot/fantasia_error.png differ
diff --git a/public/images/fantasiaMascot/fantasia_flop.png b/public/images/fantasiaMascot/fantasia_flop.png
new file mode 100644
index 0000000..19e4e44
Binary files /dev/null and b/public/images/fantasiaMascot/fantasia_flop.png differ
diff --git a/public/images/fantasiaMascot/fantasia_hug.png b/public/images/fantasiaMascot/fantasia_hug.png
new file mode 100644
index 0000000..a2cdb53
Binary files /dev/null and b/public/images/fantasiaMascot/fantasia_hug.png differ
diff --git a/public/images/fantasiaMascot/fantasia_reading.png b/public/images/fantasiaMascot/fantasia_reading.png
new file mode 100644
index 0000000..082fd21
Binary files /dev/null and b/public/images/fantasiaMascot/fantasia_reading.png differ
diff --git a/src-electron/customContentBridgeAPIs/extraEnvVariablesAPI.ts b/src-electron/customContentBridgeAPIs/extraEnvVariablesAPI.ts
index 7b5894c..d658181 100644
--- a/src-electron/customContentBridgeAPIs/extraEnvVariablesAPI.ts
+++ b/src-electron/customContentBridgeAPIs/extraEnvVariablesAPI.ts
@@ -5,5 +5,6 @@ export const extraEnvVariablesAPI: I_extraEnvVariablesAPI = {
ELECTRON_MAIN_FILEPATH: appRoot + '/dist/electron/UnPackaged/electron-main.js',
FA_FRONTEND_RENDER_TIMER: 1000,
TEST_ENV: (process.env.TEST_ENV) ? process.env.TEST_ENV : false,
- COMPONENT_NAME: (process.env.COMPONENT_NAME) ? process.env.COMPONENT_NAME : false
+ COMPONENT_NAME: (process.env.COMPONENT_NAME) ? process.env.COMPONENT_NAME : false,
+ COMPONENT_PROPS: (process.env.COMPONENT_PROPS) ? JSON.parse(process.env.COMPONENT_PROPS) : false
}
diff --git a/src/assets/quasar-logo-vertical.svg b/src/assets/quasar-logo-vertical.svg
deleted file mode 100644
index 8210831..0000000
--- a/src/assets/quasar-logo-vertical.svg
+++ /dev/null
@@ -1,15 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/FantasiaMascotImage/FantasiaMascotImage.playwright.test.ts b/src/components/FantasiaMascotImage/FantasiaMascotImage.playwright.test.ts
new file mode 100644
index 0000000..1753e4b
--- /dev/null
+++ b/src/components/FantasiaMascotImage/FantasiaMascotImage.playwright.test.ts
@@ -0,0 +1,110 @@
+import { _electron as electron } from 'playwright'
+import { test, expect } from '@playwright/test'
+import { extraEnvVariablesAPI } from 'app/src-electron/customContentBridgeAPIs/extraEnvVariablesAPI'
+
+/**
+ * Extra env settings to trigger component testing via Playwright
+ */
+const extraEnvSettings = {
+ TEST_ENV: 'components',
+ COMPONENT_NAME: 'FantasiaMascotImage',
+ COMPONENT_PROPS: JSON.stringify({})
+}
+
+/**
+ * Electron main filepath
+ */
+const electronMainFilePath:string = extraEnvVariablesAPI.ELECTRON_MAIN_FILEPATH
+
+/**
+ * Extra rended timer buffer for tests to start after loading the app
+ * - Change here in order manually adjust this component's wait times
+ */
+const faFrontendRenderTimer:number = extraEnvVariablesAPI.FA_FRONTEND_RENDER_TIMER
+
+/**
+ * Object of string data selectors for the component
+ */
+const selectorList = {
+ image: 'fantasiaMascotImage-image'
+}
+
+/**
+ * Attempt to pass "width" prop to the component and check the result
+ */
+test('Visually check "width" prop', async () => {
+ const testString = '300px'
+
+ extraEnvSettings.COMPONENT_PROPS = JSON.stringify({ width: testString })
+
+ const electronApp = await electron.launch({
+ env: extraEnvSettings,
+ args: [electronMainFilePath]
+ })
+
+ const appWindow = await electronApp.firstWindow()
+ await appWindow.waitForTimeout(faFrontendRenderTimer)
+
+ const imageElement = await appWindow.$(`[data-test="${selectorList.image}"]`)
+
+ // Check if the tested element exists
+ if (imageElement !== null) {
+ const imageBoxData = await imageElement.boundingBox()
+
+ // Test if the tested element isn't invisisble for some reason
+ if (imageBoxData !== null) {
+ const roundedFirstValue = Math.round(imageBoxData.width)
+ const roundedSecondValue = Math.round(parseInt(testString))
+
+ expect(roundedFirstValue).toBe(roundedSecondValue)
+ } else {
+ // Element is invisible
+ test.fail()
+ }
+ } else {
+ // Element doesn't exist
+ test.fail()
+ }
+
+ await electronApp.close()
+})
+
+/**
+ * Attempt to pass "height" prop to the component and check the result
+ */
+test('Visually check "height" prop', async () => {
+ const testString = '300px'
+
+ extraEnvSettings.COMPONENT_PROPS = JSON.stringify({ height: testString })
+
+ const electronApp = await electron.launch({
+ env: extraEnvSettings,
+ args: [electronMainFilePath]
+ })
+
+ const appWindow = await electronApp.firstWindow()
+ await appWindow.waitForTimeout(faFrontendRenderTimer)
+
+ const imageElement = await appWindow.$(`[data-test="${selectorList.image}"]`)
+
+ // Check if the tested element exists
+ if (imageElement !== null) {
+ const imageBoxData = await imageElement.boundingBox()
+
+ // Test if the tested element isn't invisisble for some reason
+ if (imageBoxData !== null) {
+ const roundedFirstValue = Math.round(imageBoxData.height)
+ const roundedSecondValue = Math.round(parseInt(testString))
+
+ expect(roundedFirstValue).toBe(roundedSecondValue)
+ } else {
+ // Element is invisible
+ test.fail()
+ }
+ } else {
+ // Element doesn't exist
+ test.fail()
+ }
+
+ await electronApp.close()
+})
diff --git a/src/components/FantasiaMascotImage/FantasiaMascotImage.vitest.test.ts b/src/components/FantasiaMascotImage/FantasiaMascotImage.vitest.test.ts
new file mode 100644
index 0000000..d2d1b85
--- /dev/null
+++ b/src/components/FantasiaMascotImage/FantasiaMascotImage.vitest.test.ts
@@ -0,0 +1,90 @@
+import { installQuasar } from '@quasar/quasar-app-extension-testing-unit-vitest'
+import { mount } from '@vue/test-utils'
+import { describe, expect, it } from 'vitest'
+import FantasiaMascotImage from './FantasiaMascotImage.vue'
+
+installQuasar()
+
+describe('Component - "FantasiaMascotImage"', () => {
+ /**
+ * Object of string data selectors for the component
+ */
+ const selectorList = {
+ image: 'fantasiaMascotImage-image'
+ }
+
+ /**
+ * Test if the component has an "img" HTML element properly mounted in it.
+ */
+ it('Wrapper should contain an image', () => {
+ const wrapper = mount(FantasiaMascotImage)
+
+ const imageElement = wrapper.get(`[data-test="${selectorList.image}"]`).element
+
+ expect(imageElement.tagName).toBe('IMG')
+ })
+
+ /**
+ * Test if the "img" HTML element has received the "width" prop properly.
+ * - Testing via "dataset" instead of actual width due to Vitest limitations.
+ */
+ it('Image inside wrapper should have 300px "width"', () => {
+ const testString = '300px'
+
+ const wrapper = mount(FantasiaMascotImage, {
+ propsData: {
+ width: testString
+ }
+ })
+
+ const imageElement = wrapper.get(`[data-test="${selectorList.image}"]`).element as HTMLImageElement
+
+ expect(imageElement.dataset.testWidth).toBe(testString)
+ })
+
+ /**
+ * Test if the "img" HTML element has received the "height" prop properly.
+ * - Testing via "dataset" instead of actual height due to Vitest limitations.
+ */
+ it('Image inside wrapper should have 300px "height"', () => {
+ const testString = '300px'
+
+ const wrapper = mount(FantasiaMascotImage, {
+ propsData: {
+ height: testString
+ }
+ })
+
+ const imageElement = wrapper.get(`[data-test="${selectorList.image}"]`).element as HTMLImageElement
+
+ expect(imageElement.dataset.testHeight).toBe(testString)
+ })
+
+ /**
+ * Test if the component properly determines if the image will be random.
+ */
+ it('Should generate random image URL', () => {
+ const wrapper = mount(FantasiaMascotImage)
+
+ const imageElement = wrapper.get(`[data-test="${selectorList.image}"]`).element as HTMLImageElement
+
+ expect(imageElement.dataset.testIsRandom).toBe('true')
+ })
+
+ /**
+ * Test if the component properly determines if the image will NOT be random.
+ */
+ it('Should generate non-random image URL', () => {
+ const testString = 'flop'
+
+ const wrapper = mount(FantasiaMascotImage, {
+ propsData: {
+ fantasiaImage: testString
+ }
+ })
+
+ const imageElement = wrapper.get(`[data-test="${selectorList.image}"]`).element as HTMLImageElement
+
+ expect(imageElement.dataset.testIsRandom).toBe('false')
+ })
+})
diff --git a/src/components/FantasiaMascotImage/FantasiaMascotImage.vue b/src/components/FantasiaMascotImage/FantasiaMascotImage.vue
new file mode 100644
index 0000000..bfdb112
--- /dev/null
+++ b/src/components/FantasiaMascotImage/FantasiaMascotImage.vue
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/GlobalWindowButtons/GlobalWindowButtons.playwright.test.ts b/src/components/GlobalWindowButtons/GlobalWindowButtons.playwright.test.ts
index 2a12082..d5d3c1f 100644
--- a/src/components/GlobalWindowButtons/GlobalWindowButtons.playwright.test.ts
+++ b/src/components/GlobalWindowButtons/GlobalWindowButtons.playwright.test.ts
@@ -3,11 +3,12 @@ import { test, expect } from '@playwright/test'
import { extraEnvVariablesAPI } from 'app/src-electron/customContentBridgeAPIs/extraEnvVariablesAPI'
/**
- * Extra env settings too trigger component testing via Playwright
+ * Extra env settings to trigger component testing via Playwright
*/
const extraEnvSettings = {
TEST_ENV: 'components',
- COMPONENT_NAME: 'GlobalWindowButtons'
+ COMPONENT_NAME: 'GlobalWindowButtons',
+ COMPONENT_PROPS: JSON.stringify({})
}
/**
@@ -30,18 +31,6 @@ const selectorList = {
buttonClose: 'globalWindowButtons-button-close'
}
-/**
- * Test if the Electron launches to begin with.
- */
-test('Should launch app', async () => {
- const electronApp = await electron.launch({
- env: extraEnvSettings,
- args: [electronMainFilePath]
- })
-
- await electronApp.close()
-})
-
/**
* Attempt to click the resize button
*/
@@ -56,6 +45,7 @@ test('Click resize button - "smallify"', async () => {
const resizeButton = await appWindow.$(`[data-test="${selectorList.buttonResize}"]`)
+ // Check if the tested element exists
if (resizeButton !== null) {
await resizeButton.click()
@@ -63,6 +53,7 @@ test('Click resize button - "smallify"', async () => {
expect(isMaximized).toBe(false)
} else {
+ // Element doesn't exist
test.fail()
}
@@ -83,6 +74,7 @@ test('Click resize button - "maximize"', async () => {
const resizeButton = await appWindow.$(`[data-test="${selectorList.buttonResize}"]`)
+ // Check if the tested element exists
if (resizeButton !== null) {
// Click twice
await resizeButton.click()
@@ -92,6 +84,7 @@ test('Click resize button - "maximize"', async () => {
expect(isMaximized).toBe(true)
} else {
+ // Element doesn't exist
test.fail()
}
@@ -112,6 +105,7 @@ test('Click minimize button', async () => {
const minimizeButton = await appWindow.$(`[data-test="${selectorList.buttonMinimize}"]`)
+ // Check if the tested element exists
if (minimizeButton !== null) {
await minimizeButton.click()
@@ -119,6 +113,7 @@ test('Click minimize button', async () => {
expect(isMaximized).toBe(false)
} else {
+ // Element doesn't exist
test.fail()
}
@@ -140,6 +135,7 @@ test('Click close button', async () => {
const closeButton = await appWindow.$(`[data-test="${selectorList.buttonClose}"]`)
+ // Check if the tested element exists
if (closeButton !== null) {
let windowIsClosed = false
@@ -152,6 +148,7 @@ test('Click close button', async () => {
expect(windowIsClosed).toBe(true)
} else {
+ // Element doesn't exist
test.fail()
}
})
diff --git a/src/css/app.scss b/src/css/app.scss
index ecac98f..5e7abb3 100644
--- a/src/css/app.scss
+++ b/src/css/app.scss
@@ -1 +1,3 @@
-// app global css in SCSS form
+@import './globals/scrollbar.scss';
+@import './globals/htmlAdjustments.scss';
+@import './globals/quasarComponentsAdjustments.scss';
diff --git a/src/css/globals/htmlAdjustments.scss b/src/css/globals/htmlAdjustments.scss
new file mode 100644
index 0000000..d0e57c9
--- /dev/null
+++ b/src/css/globals/htmlAdjustments.scss
@@ -0,0 +1,4 @@
+html,
+body{
+ overflow: hidden !important;
+}
diff --git a/src/css/globals/quasarComponentsAdjustments.scss b/src/css/globals/quasarComponentsAdjustments.scss
new file mode 100644
index 0000000..1ef029c
--- /dev/null
+++ b/src/css/globals/quasarComponentsAdjustments.scss
@@ -0,0 +1,5 @@
+.q-page{
+ // Max-height of the window minus the height of the top bar
+ max-height: calc(100vh - 50px);
+ overflow: auto;
+}
diff --git a/src/css/globals/scrollbar.scss b/src/css/globals/scrollbar.scss
new file mode 100644
index 0000000..b6e433e
--- /dev/null
+++ b/src/css/globals/scrollbar.scss
@@ -0,0 +1,24 @@
+* {
+
+ /* Scrollbar sizing */
+ ::-webkit-scrollbar {
+ width: 5px;
+ height: 5px;
+ }
+
+ /* Whole scrollbar track */
+ ::-webkit-scrollbar-track {
+ background: $dark;
+ }
+
+ /* Handle button */
+ ::-webkit-scrollbar-thumb {
+ background: lighten($dark, 40);
+ border-radius: 5px;
+ }
+
+ /* Handle button - Hover */
+ ::-webkit-scrollbar-thumb:hover {
+ background: lighten($dark, 60);
+ }
+}
diff --git a/src/interfaces/I_extraEnvVariablesAPI.ts b/src/interfaces/I_extraEnvVariablesAPI.ts
index abcfe7c..62ab072 100644
--- a/src/interfaces/I_extraEnvVariablesAPI.ts
+++ b/src/interfaces/I_extraEnvVariablesAPI.ts
@@ -15,8 +15,10 @@ export interface I_extraEnvVariablesAPI {
/**
* Type of test environment to load.
+ * - 'components'
+ * - 'e2e'
*/
- TEST_ENV?: 'components'|'e2e'|false
+ TEST_ENV?: string|false
/**
* Name of the component being tested.
@@ -24,4 +26,9 @@ export interface I_extraEnvVariablesAPI {
*/
COMPONENT_NAME?: string|false
+ /**
+ * Component props, assuming they have any.
+ */
+ COMPONENT_PROPS?: string|false
+
}
diff --git a/src/pages/ComponentTesting.vue b/src/pages/ComponentTesting.vue
index 5436426..fc7a761 100644
--- a/src/pages/ComponentTesting.vue
+++ b/src/pages/ComponentTesting.vue
@@ -1,12 +1,20 @@
-
+
diff --git a/test/playwright-e2e/someTest.spec.ts b/test/playwright-e2e/someTest.spec.ts
index 47177c2..afd8113 100644
--- a/test/playwright-e2e/someTest.spec.ts
+++ b/test/playwright-e2e/someTest.spec.ts
@@ -1 +1,35 @@
// TODO ADD SOME TESTS
+
+import { _electron as electron } from 'playwright'
+import { test } from '@playwright/test'
+import { extraEnvVariablesAPI } from 'app/src-electron/customContentBridgeAPIs/extraEnvVariablesAPI'
+
+/**
+ * Extra env settings too trigger testing via Playwright
+ */
+const extraEnvSettings = {
+ TEST_ENV: 'e2e'
+}
+
+/**
+ * Electron main filepath
+ */
+const electronMainFilePath:string = extraEnvVariablesAPI.ELECTRON_MAIN_FILEPATH
+
+/**
+ * Extra rended timer buffer for tests to start after loading the app
+ * - Change here in order manually adjust this component's wait times
+ */
+const faFrontendRenderTimer:number = extraEnvVariablesAPI.FA_FRONTEND_RENDER_TIMER
+
+/**
+ * Test if the Electron launches to begin with.
+ */
+test('Should launch app', async () => {
+ const electronApp = await electron.launch({
+ env: extraEnvSettings,
+ args: [electronMainFilePath]
+ })
+
+ await electronApp.close()
+})