diff --git a/browser_tests/ComfyPage.ts b/browser_tests/ComfyPage.ts index 89d83a11..d4fafddb 100644 --- a/browser_tests/ComfyPage.ts +++ b/browser_tests/ComfyPage.ts @@ -247,6 +247,10 @@ export class ComfyPage { async setup() { await this.goto() + await this.prepPage() + } + + async prepPage() { await this.page.evaluate(() => { localStorage.clear() sessionStorage.clear() @@ -312,6 +316,10 @@ export class ComfyPage { await this.page.goto(this.url) } + async gotoPath(url: string) { + await this.page.goto(this.url + url) + } + async nextFrame() { await this.page.evaluate(() => { return new Promise(requestAnimationFrame) diff --git a/browser_tests/core.spec.ts b/browser_tests/core.spec.ts new file mode 100644 index 00000000..29c48b55 --- /dev/null +++ b/browser_tests/core.spec.ts @@ -0,0 +1,24 @@ +import { expect } from '@playwright/test' +import { comfyPageFixture as test } from './ComfyPage' + +test.describe('basic frontend page', () => { + test('Basic front page loads and renders at all', async ({ comfyPage }) => { + await comfyPage.gotoPath('/') + await comfyPage.prepPage() + await expect(comfyPage.canvas).toHaveScreenshot( + 'basic-frontend-page-content.png' + ) + }) +}) + +test.describe('subrouting validation', () => { + test('subrouted installs of the comfy frontend load as intended', async ({ + comfyPage + }) => { + await comfyPage.gotoPath('/testsubrouteindex') + await comfyPage.prepPage() + await expect(comfyPage.canvas).toHaveScreenshot( + 'subrouted-frontend-page-content.png' + ) + }) +}) diff --git a/browser_tests/core.spec.ts-snapshots/basic-frontend-page-content-chromium-2x-linux.png b/browser_tests/core.spec.ts-snapshots/basic-frontend-page-content-chromium-2x-linux.png new file mode 100644 index 00000000..242929e5 Binary files /dev/null and b/browser_tests/core.spec.ts-snapshots/basic-frontend-page-content-chromium-2x-linux.png differ diff --git a/browser_tests/core.spec.ts-snapshots/basic-frontend-page-content-chromium-linux.png b/browser_tests/core.spec.ts-snapshots/basic-frontend-page-content-chromium-linux.png new file mode 100644 index 00000000..f6d7b354 Binary files /dev/null and b/browser_tests/core.spec.ts-snapshots/basic-frontend-page-content-chromium-linux.png differ diff --git a/src/router.ts b/src/router.ts index b20e825e..56a61cf9 100644 --- a/src/router.ts +++ b/src/router.ts @@ -2,7 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router' import LayoutDefault from '@/views/layouts/LayoutDefault.vue' const router = createRouter({ - history: createWebHistory(), + history: createWebHistory(window.location.pathname), routes: [ { path: '/', diff --git a/vite.config.mts b/vite.config.mts index 749b12d6..d6fc42e6 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -114,6 +114,11 @@ export default defineConfig({ '/ws': { target: DEV_SERVER_COMFYUI_URL, ws: true + }, + + '/testsubrouteindex': { + target: 'http://localhost:5173', + rewrite: (path) => path.substring('/testsubrouteindex'.length) } } },