mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
test to validate subrouting (#927)
* test to validate subrouting * Update test expectations [skip ci] * core tests need to prep the page * Update test expectations [skip ci] --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
committed by
GitHub
parent
9aa976fdf0
commit
6a3dbe08de
@@ -247,6 +247,10 @@ export class ComfyPage {
|
|||||||
|
|
||||||
async setup() {
|
async setup() {
|
||||||
await this.goto()
|
await this.goto()
|
||||||
|
await this.prepPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
async prepPage() {
|
||||||
await this.page.evaluate(() => {
|
await this.page.evaluate(() => {
|
||||||
localStorage.clear()
|
localStorage.clear()
|
||||||
sessionStorage.clear()
|
sessionStorage.clear()
|
||||||
@@ -312,6 +316,10 @@ export class ComfyPage {
|
|||||||
await this.page.goto(this.url)
|
await this.page.goto(this.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async gotoPath(url: string) {
|
||||||
|
await this.page.goto(this.url + url)
|
||||||
|
}
|
||||||
|
|
||||||
async nextFrame() {
|
async nextFrame() {
|
||||||
await this.page.evaluate(() => {
|
await this.page.evaluate(() => {
|
||||||
return new Promise<number>(requestAnimationFrame)
|
return new Promise<number>(requestAnimationFrame)
|
||||||
|
|||||||
24
browser_tests/core.spec.ts
Normal file
24
browser_tests/core.spec.ts
Normal file
@@ -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'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 100 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
@@ -2,7 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'
|
|||||||
import LayoutDefault from '@/views/layouts/LayoutDefault.vue'
|
import LayoutDefault from '@/views/layouts/LayoutDefault.vue'
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHistory(window.location.pathname),
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
|
|||||||
@@ -114,6 +114,11 @@ export default defineConfig({
|
|||||||
'/ws': {
|
'/ws': {
|
||||||
target: DEV_SERVER_COMFYUI_URL,
|
target: DEV_SERVER_COMFYUI_URL,
|
||||||
ws: true
|
ws: true
|
||||||
|
},
|
||||||
|
|
||||||
|
'/testsubrouteindex': {
|
||||||
|
target: 'http://localhost:5173',
|
||||||
|
rewrite: (path) => path.substring('/testsubrouteindex'.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user