Verify release shell readiness
This commit is contained in:
@@ -4,6 +4,7 @@ import { chromium } from 'playwright';
|
|||||||
|
|
||||||
const targetUrl = withDebugParam(process.env.RELEASE_QA_URL ?? 'http://127.0.0.1:4173/');
|
const targetUrl = withDebugParam(process.env.RELEASE_QA_URL ?? 'http://127.0.0.1:4173/');
|
||||||
const screenshotDir = 'dist';
|
const screenshotDir = 'dist';
|
||||||
|
const expectedTitle = '\uC0BC\uAD6D\uC9C0: \uC138 \uD615\uC81C\uC758 \uB9F9\uC138';
|
||||||
|
|
||||||
let serverProcess;
|
let serverProcess;
|
||||||
let browser;
|
let browser;
|
||||||
@@ -37,6 +38,7 @@ try {
|
|||||||
await page.evaluate(() => window.localStorage.clear());
|
await page.evaluate(() => window.localStorage.clear());
|
||||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||||
await waitForTitle(page);
|
await waitForTitle(page);
|
||||||
|
await assertReleaseShellReady(page);
|
||||||
await page.screenshot({ path: `${screenshotDir}/rc-title-first-run.png`, fullPage: true });
|
await page.screenshot({ path: `${screenshotDir}/rc-title-first-run.png`, fullPage: true });
|
||||||
await assertCanvasPainted(page, 'title first run');
|
await assertCanvasPainted(page, 'title first run');
|
||||||
|
|
||||||
@@ -218,6 +220,20 @@ async function waitForTitle(page) {
|
|||||||
}, undefined, { timeout: 90000 });
|
}, undefined, { timeout: 90000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function assertReleaseShellReady(page) {
|
||||||
|
const state = await page.evaluate(() => ({
|
||||||
|
title: document.title,
|
||||||
|
canvasCount: document.querySelectorAll('canvas').length,
|
||||||
|
debugApiPresent: Boolean(window.__HEROS_DEBUG__),
|
||||||
|
gameApiPresent: Boolean(window.__HEROS_GAME__)
|
||||||
|
}));
|
||||||
|
|
||||||
|
assert(state.title === expectedTitle, `Expected release page title "${expectedTitle}": ${JSON.stringify(state)}`);
|
||||||
|
assert(state.canvasCount === 1, `Expected exactly one release game canvas: ${JSON.stringify(state)}`);
|
||||||
|
assert(state.debugApiPresent === true, `Expected release QA debug API to be enabled: ${JSON.stringify(state)}`);
|
||||||
|
assert(state.gameApiPresent === true, `Expected release QA game handle to be enabled: ${JSON.stringify(state)}`);
|
||||||
|
}
|
||||||
|
|
||||||
async function waitForStoryReady(page) {
|
async function waitForStoryReady(page) {
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
const activeScenes = window.__HEROS_DEBUG__?.activeScenes() ?? [];
|
||||||
|
|||||||
Reference in New Issue
Block a user