Add Playwright E2E suite against the built dist/
Pin @playwright/test 1.62.0 (matches the cached chromium revision) and serve dist/ via python3 http.server, so the deployed artifact is what gets tested. Covers page load, terminal commands, vim mode, achievements, and the nav menu. Ignore node_modules, test-results, playwright-report, and the phased-execution runtime scratch (.agents/phase-sessions, pipeline.log).
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// Shared helpers for the fake-terminal E2E tests.
|
||||
//
|
||||
// Desktop interaction model (see src/script.js + src/terminal.js):
|
||||
// the hero section overlays the rack background, so the terminal is opened
|
||||
// by clicking the hero (outside of any .btn). That focuses the hidden
|
||||
// <input> inside .terminal-display, and all keystrokes go there.
|
||||
|
||||
/** Click the hero to expand the terminal and focus its hidden input. */
|
||||
async function openTerminal(page) {
|
||||
await page.locator('#hero h1').click();
|
||||
await page.waitForSelector('.terminal-display.grown', { timeout: 5000 });
|
||||
}
|
||||
|
||||
/** Type a command into the focused terminal and press Enter. */
|
||||
async function typeCommand(page, cmd) {
|
||||
await page.keyboard.type(cmd);
|
||||
await page.keyboard.press('Enter');
|
||||
}
|
||||
|
||||
/** The current (last) line of the terminal output. */
|
||||
function currentPromptLine(page) {
|
||||
return page.locator('.terminal-content > div').last();
|
||||
}
|
||||
|
||||
/** All rendered terminal lines. */
|
||||
function terminalLines(page) {
|
||||
return page.locator('.terminal-content > div');
|
||||
}
|
||||
|
||||
module.exports = { openTerminal, typeCommand, currentPromptLine, terminalLines };
|
||||
Reference in New Issue
Block a user