Files
Crystal/tests/intro-driver.ts
T
Sébastien QUEROLandClaude Opus 5.5 b13fd20be4
Checks / web (push) Canceled after 0s
Port the introduction's naming and clock screens
A new game now runs NewGame's InitGender and OakSpeech natively before
the bedroom: Boy or Girl, InitClock's hour and minute steppers with
their YES/NO confirmations, Oak's speech with Wooper, and NamePlayer's
preset names or naming field (a blank name takes CHRIS or KRIS). Texts,
menus and time strings come from a new INTRO profile table verified by
check:reference; Oak's and the player's pictures decode from
TrainerPicPointers, ChrisPic/KrisPic and TrainerPalettes.

The chosen time is kept as a minute offset from the device clock, which
time of day, the weekday, NPC hours and the daily reset now read. The
intro runs only when nothing is saved; a save made during it starts it
again. Saves gain intro and clock.minuteOffset, migrated by absence. The
shell's name and character fields are gone. Intentional change: the
steppers start at the device time rather than 10:00.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 09:53:52 +02:00

34 lines
1.3 KiB
TypeScript

import { expect, type Page } from "@playwright/test";
/** Play a new game's introduction through the real controls: the gender
* menu, the clock (kept at the device time) and a name. An empty name
* picks the gender's first preset (CHRIS or KRIS). */
export async function completeIntro(
page: Page,
{ girl = false, name = "" } = {},
) {
const screen = page.locator("#game-screen"),
choice = page.locator("#dialogue-choice");
await expect(screen).toHaveAttribute("data-intro", "true");
await choice.getByRole("option", { name: girl ? "Girl" : "Boy" }).click();
for (
let guard = 0;
guard < 80 && (await screen.getAttribute("data-intro")) === "true";
guard++
) {
if (!(await choice.isVisible())) {
await page.locator("#dialogue-next").click();
continue;
}
const menu = choice.getByRole("option");
if (await choice.locator("input").count()) {
await choice.locator("input").fill(name);
await choice.getByRole("button", { name: "OK" }).click();
} else if (await menu.count()) await menu.nth(name ? 0 : 1).click();
else if (await choice.getByRole("button", { name: "YES" }).count())
await choice.getByRole("button", { name: "YES" }).click();
else await choice.getByRole("button", { name: "OK" }).click();
}
await expect(screen).toHaveAttribute("data-intro", "false");
}