diff --git a/frontend/e2e/example.spec.ts b/frontend/e2e/example.spec.ts deleted file mode 100644 index b582fd8..0000000 --- a/frontend/e2e/example.spec.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { test, expect } from '@playwright/test'; -import { _electron } from 'playwright'; - -test('App launches and quits', async () => { - const app = await _electron.launch({args: ['dist-electron/main.js']}); - const window = await app.firstWindow(); - window.setViewportSize({ width: 1280, height: 720 }); - await expect(await window.title()).toContain('Trilogy Studio'); - await app.close(); -}); \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0aab7f1..2e8723b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,18 +1,19 @@ { "name": "trilogy-studio", - "version": "0.0.10", + "version": "0.0.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "trilogy-studio", - "version": "0.0.10", + "version": "0.0.11", "dependencies": { "axios": "^1.4.0", "dotenv": "^16.3.1", "electron-store": "^8.1.0", "monaco-editor": "^0.40.0", "noty": "^3.2.0-beta-deprecated", + "playwright": "^1.45.3", "split.js": "^1.6.5", "tabulator-tables": "^6.2.0", "vite-plugin-commonjs-externals": "^0.1.3", @@ -21,15 +22,15 @@ "vue-router": "^4.2.4", "vue3-apexcharts": "^1.4.1", "vue3-shortkey": "^4.0.0", - "vuetify": "^3.3.7", + "vuetify": "^3.6.13", "vuex": "^4.1.0" }, "devDependencies": { "@mdi/font": "^7.2.96", - "@playwright/test": "^1.43.1", + "@playwright/test": "^1.45.3", "@types/node": "^20.12.7", "@vitejs/plugin-vue": "^4.1.0", - "electron": "^26.1.0", + "electron": "^31.3.0", "electron-builder": "^24.6.4", "sass": "^1.66.1", "sass-loader": "^13.3.2", @@ -3014,14 +3015,14 @@ } }, "node_modules/electron": { - "version": "26.6.10", - "resolved": "https://registry.npmjs.org/electron/-/electron-26.6.10.tgz", - "integrity": "sha512-pV2SD0RXzAiNRb/2yZrsVmVkBOMrf+DVsPulIgRjlL0+My9BL5spFuhHVMQO9yHl9tFpWtuRpQv0ofM/i9P8xg==", + "version": "31.3.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-31.3.0.tgz", + "integrity": "sha512-3LMRMmK4UK0A+jYSLGLYdfhc20TgY2v5jD3iGmhRZlDYj0gn7xBj/waRjlNalysZ0D2rgPvoes0wHuf5e/Bguw==", "dev": true, "hasInstallScript": true, "dependencies": { "@electron/get": "^2.0.0", - "@types/node": "^18.11.18", + "@types/node": "^20.9.0", "extract-zip": "^2.0.1" }, "bin": { @@ -3212,15 +3213,6 @@ "dev": true, "peer": true }, - "node_modules/electron/node_modules/@types/node": { - "version": "18.19.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.42.tgz", - "integrity": "sha512-d2ZFc/3lnK2YCYhos8iaNIYu9Vfhr92nHiyJHRltXWjXUBjEE+A4I58Tdbnw4VhggSW+2j5y5gTrLs4biNnubg==", - "dev": true, - "dependencies": { - "undici-types": "~5.26.4" - } - }, "node_modules/element-matches": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/element-matches/-/element-matches-0.1.2.tgz", @@ -4838,7 +4830,6 @@ "version": "1.45.3", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.45.3.tgz", "integrity": "sha512-QhVaS+lpluxCaioejDZ95l4Y4jSFCsBvl2UZkpeXlzxmqS+aABr5c82YmfMHrL6x27nvrvykJAFpkzT2eWdJww==", - "dev": true, "dependencies": { "playwright-core": "1.45.3" }, @@ -4856,7 +4847,6 @@ "version": "1.45.3", "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.45.3.tgz", "integrity": "sha512-+ym0jNbcjikaOwwSZycFbwkWgfruWvYlJfThKYAlImbxUgdWFO2oW70ojPm4OpE4t6TAo2FY/smM+hpVTtkhDA==", - "dev": true, "bin": { "playwright-core": "cli.js" }, diff --git a/frontend/package.json b/frontend/package.json index 09e1949..850f76c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,13 +13,13 @@ }, "scripts": { "dev": "vite", - "build_debug": "vue-tsc && vite build", + "build_debug": "vite build", "build": "node build-backend.js && vue-tsc && vite build", "preview": "vite preview", "debug_bg": "node test-bg.js", "dist_linux": "vue-tsc && vite build && node build-backend.js && electron-builder --linux snap", "dist_windows": "vue-tsc && vite build && node build-backend.js && electron-builder --win", - "test": "playwright test" + "test": "playwright test --debug" }, "dependencies": { "axios": "^1.4.0", @@ -27,6 +27,7 @@ "electron-store": "^8.1.0", "monaco-editor": "^0.40.0", "noty": "^3.2.0-beta-deprecated", + "playwright": "^1.45.3", "split.js": "^1.6.5", "tabulator-tables": "^6.2.0", "vite-plugin-commonjs-externals": "^0.1.3", @@ -35,15 +36,15 @@ "vue-router": "^4.2.4", "vue3-apexcharts": "^1.4.1", "vue3-shortkey": "^4.0.0", - "vuetify": "^3.3.7", + "vuetify": "^3.6.13", "vuex": "^4.1.0" }, "devDependencies": { "@mdi/font": "^7.2.96", - "@playwright/test": "^1.43.1", + "@playwright/test": "^1.45.3", "@types/node": "^20.12.7", "@vitejs/plugin-vue": "^4.1.0", - "electron": "^26.1.0", + "electron": "^31.3.0", "electron-builder": "^24.6.4", "sass": "^1.66.1", "sass-loader": "^13.3.2", diff --git a/frontend/playwright-report/index.html b/frontend/playwright-report/index.html index 6a680b9..9db03c4 100644 --- a/frontend/playwright-report/index.html +++ b/frontend/playwright-report/index.html @@ -7,7 +7,7 @@ Playwright Test Report - @@ -65,4 +65,4 @@ \ No newline at end of file +window.playwrightReportBase64 = "data:application/zip;base64,UEsDBBQAAAgIAKVl+1hEY2QG8AIAAO0JAAAZAAAAODEyMjhjNGM4ODg2ZDU2NmJhMTEuanNvbq1WbW/TMBD+KyafOqkvcZp3BNJASPAFIW1iEluR3MRZzBI7OI7KKP3vnLN0cdtMa6e1H+r47p577h7n6rWVsYJ+Sa3YCrHjhImbhGHop57vLwnG1ri1fyUlBY+SMD6tK5pMVQ0WRWv4ja/X7epJjEkQhVlGo3TpJCRyEtd1g0yHM1Vo1AtFZItXSfGLJqpLluRSlKwpwVC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56XjdomfWJT2C+Q/DvWuEspnbBO5McAdar+ZSz3d9WrBk4gToXytvkaLIZryOgPGAYPE4te34jfdjOlU+o/CSaBn0kUtQd+wHc0YC4tzZ7nm7l2b1Y9WCjzkXQMdk5AUAEtXN6mPq3kd70c7ilfEjZkr9cXOjZ0pUaY72F/ecExL05HOahi+DIlFcZsdBPSv8vR9sh+DDJvKaiKDfr29JxEGbYZhE972Qagv3MoEcdsjJzcDQuuQys9R+E9mBsopwW3wSSnI5fUEsBAj8DFAAACAgApWX7WERjZAbwAgAA7QkAABkAAAAAAAAAAAAAALSBAAAAADgxMjI4YzRjODg4NmQ1NjZiYTExLmpzb25QSwECPwMUAAAICAClZftYIOswim8BAADWAgAACwAAAAAAAAAAAAAAtIEnAwAAcmVwb3J0Lmpzb25QSwUGAAAAAAIAAgCAAAAAvwQAAAAA"; \ No newline at end of file diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index ce5b0d1..96f17ad 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -1,39 +1,35 @@ -import { defineConfig, devices } from '@playwright/test'; +import { defineConfig, devices } from "@playwright/test"; -/** - * Read environment variables from file. - * https://github.com/motdotla/dotenv - */ -// require('dotenv').config(); - -/** - * See https://playwright.dev/docs/test-configuration. - */ export default defineConfig({ - testDir: './e2e', - /* Run tests in files in parallel */ + // Look for test files in the "tests" directory, relative to this configuration file. + testDir: "tests", + + // Run all tests in parallel. fullyParallel: true, - /* Fail the build on CI if you accidentally left test.only in the source code. */ + + // Fail the build on CI if you accidentally left test.only in the source code. forbidOnly: !!process.env.CI, - /* Retry on CI only */ + + // Retry on CI only. retries: process.env.CI ? 2 : 0, - /* Opt out of parallel tests on CI. */ + + // Opt out of parallel tests on CI. workers: process.env.CI ? 1 : undefined, - /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'html', - /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + + // Reporter to use + reporter: "html", + use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - // baseURL: 'http://127.0.0.1:3000', + // Base URL to use in actions like `await page.goto('/')`. + baseURL: "http://127.0.0.1:5173", - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', + // Collect trace when retrying the failed test. + trace: "on-first-retry", }, - - /* Configure projects for major browsers */ + // Configure projects for major browsers. projects: [ { - name: 'chromium', + name: "chromium", use: { ...devices["Desktop Chrome"], contextOptions: { @@ -48,32 +44,11 @@ export default defineConfig({ }, }, }, - - /* Test against mobile viewports. */ - // { - // name: 'Mobile Chrome', - // use: { ...devices['Pixel 5'] }, - // }, - // { - // name: 'Mobile Safari', - // use: { ...devices['iPhone 12'] }, - // }, - - /* Test against branded browsers. */ - // { - // name: 'Microsoft Edge', - // use: { ...devices['Desktop Edge'], channel: 'msedge' }, - // }, - // { - // name: 'Google Chrome', - // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, - // }, ], - - /* Run your local dev server before starting the tests */ - // webServer: { - // command: 'npm run start', - // url: 'http://127.0.0.1:3000', - // reuseExistingServer: !process.env.CI, - // }, -}); + webServer: { + command: "npm run dev", + url: "http://localhost:5173", + reuseExistingServer: !process.env.CI, + stdout: "pipe", + }, +}); \ No newline at end of file diff --git a/frontend/tests/main.spec.ts b/frontend/tests/main.spec.ts new file mode 100644 index 0000000..d8933fc --- /dev/null +++ b/frontend/tests/main.spec.ts @@ -0,0 +1,23 @@ +import { _electron as electron } from "playwright"; +import { test, expect, ElectronApplication, Page } from "@playwright/test"; + +test.describe("All Tests", async () => { + let electronApp: ElectronApplication; + let firstWindow: Page; + + test.beforeAll(async () => { + const electronApp = await electron.launch({ args: ["."] }); + const firstWindow = await electronApp.firstWindow(); + firstWindow.setViewportSize({ width: 1280, height: 720 }); + }); + + test("Starts", async () => { + await expect(await firstWindow.title()).toContain('Trilogy Studio'); + }); + + test.afterAll(async () => { + if (electronApp) { + await electronApp.close(); + } + }); +});