test(rehearser): pin ACT/SCENE heading forms (digits, roman, words) and the empty-numeral regression

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-10-06 11:37:16 +02:00
parent ccbd834eea
commit 40c3db6831

View File

@ -71,3 +71,22 @@ test('parses a screenplay and builds the cast', async ({ page }) => {
await expect(page.locator('.reh-cc-sample-btn').first()).toContainText('Hear a line');
await expect(page.locator('.reh-cc-sample-btn').first()).toContainText('Hear a line');
});
test('ACT and SCENE headings accept digits, roman numerals and number words, but not plain prose', async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded' });
await page.waitForSelector('#app-skeleton', { state: 'detached', timeout: 15_000 });
await navTo(page, 's-rehearser');
await expect.poll(() => page.evaluate(() => Boolean(window.TTVC?.rehearser?.parse?.parseScript))).toBe(true);
const types = await page.evaluate(() => {
const kinds = (t) => window.TTVC.rehearser.parse.parseScript(t).map(l => l.type);
return {
act2: kinds('ACT 2\nIt is night.'), scene12: kinds('SCENE 12\nIt is night.'), act1title: kinds('ACT 1 - The Harbour\nIt is night.'),
roman: kinds('ACT II\nIt is night.'), sceneRoman: kinds('SCENE III\nIt is night.'), word: kinds('ACT ONE\nIt is night.'),
prose: kinds('ACT quickly now.\nIt is night.'), sceneProse: kinds('SCENE changes now.\nIt is night.'),
};
});
for (const k of ['act2', 'act1title', 'roman', 'word']) expect(types[k], k).toContain('act');
for (const k of ['scene12', 'sceneRoman']) expect(types[k], k).toContain('scene');
expect(types.prose).not.toContain('act'); // regression: the empty numeral used to make this a heading (Sonar S5842)
expect(types.sceneProse).not.toContain('scene');
});