From b4447f3d19944c4fe98a76fe0d9a506a2bd10212 Mon Sep 17 00:00:00 2001 From: Andrew Powers Date: Sun, 3 Mar 2024 11:27:54 -0800 Subject: [PATCH] feat: render tests --- @fiction/core/plugin-app/index.ts | 5 ++++- ..._appServeRender.ci.test.ts => appServeRender.ci.test.ts} | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) rename @fiction/core/plugin-app/test/{__appServeRender.ci.test.ts => appServeRender.ci.test.ts} (91%) diff --git a/@fiction/core/plugin-app/index.ts b/@fiction/core/plugin-app/index.ts index 536bd133c..cf3665f85 100644 --- a/@fiction/core/plugin-app/index.ts +++ b/@fiction/core/plugin-app/index.ts @@ -9,7 +9,7 @@ import { initializeResetUi, safeDirname, vue } from '../utils' import type { FictionAppEntry, FictionEnv, ServiceConfig, ServiceList } from '../plugin-env' import { FictionPlugin } from '../plugin' import type { FictionBuild } from '../plugin-build' -import type { FictionRouter } from '../plugin-router' +import { AppRoute, type FictionRouter } from '../plugin-router' import type { RunVars, StandardServices } from '../inject' import { FictionRender } from './plugin-render' import ElRoot from './ElRoot.vue' @@ -96,6 +96,9 @@ export class FictionApp extends FictionPlugin { }) } + // add testing routes + this.fictionRouter.update([new AppRoute({ name: 'renderTest', path: '/render-test', component: (): Promise => import('./test/TestRunVars.vue') })]) + this.addSchema() } diff --git a/@fiction/core/plugin-app/test/__appServeRender.ci.test.ts b/@fiction/core/plugin-app/test/appServeRender.ci.test.ts similarity index 91% rename from @fiction/core/plugin-app/test/__appServeRender.ci.test.ts rename to @fiction/core/plugin-app/test/appServeRender.ci.test.ts index b3064d18e..2f8fe1db8 100644 --- a/@fiction/core/plugin-app/test/__appServeRender.ci.test.ts +++ b/@fiction/core/plugin-app/test/appServeRender.ci.test.ts @@ -5,7 +5,7 @@ import type playwright from 'playwright' import { afterAll, beforeAll, describe, expect, it } from 'vitest' import type { TestServerConfig } from '@fiction/core/test-utils/buildTest' import { createTestServer } from '@fiction/core/test-utils/buildTest' -import { commands } from '@fiction/www/src/vars' +import { commands } from '@fiction/www/src/commands' const require = createRequire(import.meta.url) const cwd = path.dirname(require.resolve('@fiction/www/package.json')) @@ -36,7 +36,7 @@ describe('renders app code correctly', () => { return `http://localhost:${appPort}${route}` } - await page().goto(url('/testing')) + await page().goto(url('/render-test')) await page().waitForSelector('#server-port') @@ -50,6 +50,6 @@ describe('renders app code correctly', () => { expect(appNameText).toMatchInlineSnapshot('"FictionJS"') const appEmailText = await page().locator(`#app-email`).textContent() - expect(appEmailText).toMatchInlineSnapshot('"hi@fictionjs.org"') + expect(appEmailText).toMatchInlineSnapshot('"hello@fiction.com"') }, 20_000) })