678977ab23
- Tablet-first responsive scoreboard: whole player card is tap target - Per-step wizard backgrounds and live summary panel - Larger touch targets, safe-area handling, reduced-motion support - German UI error strings in App.tsx - Updated SOUL.md and README.md for current architecture - Cleanup: removed legacy components, .cursor/, UI_IMPROVEMENTS.md - Renamed package to bscscore, fixed TOTAL_WIZARD_STEPS
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import type { Page } from '@playwright/test';
|
|
import { expect } from '@playwright/test';
|
|
|
|
const PLAYER_INPUT_IDS: Record<string, string> = {
|
|
'Spieler 1': 'player1-input',
|
|
'Spieler 2': 'player2-input',
|
|
'Spieler 3 (optional)': 'player3-input',
|
|
};
|
|
|
|
/** Open name modal, fill input, confirm — advances wizard step. */
|
|
export async function enterPlayerName(
|
|
page: Page,
|
|
label: string,
|
|
placeholder: string,
|
|
name: string,
|
|
) {
|
|
const inputId = PLAYER_INPUT_IDS[label];
|
|
await page.getByRole('button', { name: `Name für ${label} eingeben` }).click();
|
|
const dialog = page.getByRole('dialog');
|
|
await expect(dialog).toBeVisible();
|
|
const input = inputId ? page.locator(`#${inputId}`) : dialog.getByRole('textbox');
|
|
await expect(input).toBeFocused();
|
|
await input.fill(name);
|
|
await dialog.getByRole('button', { name: 'Übernehmen' }).click();
|
|
await expect(dialog).toBeHidden();
|
|
}
|
|
|
|
export async function skipPlayer3(page: Page) {
|
|
await page.getByRole('button', { name: 'Überspringen' }).click();
|
|
}
|
|
|
|
export async function addPoint(page: Page, playerName: string, currentScore: number) {
|
|
await page
|
|
.getByRole('button', { name: `Punkt für ${playerName}. Aktueller Stand: ${currentScore}` })
|
|
.click();
|
|
}
|
|
|
|
export async function addPoints(
|
|
page: Page,
|
|
playerName: string,
|
|
count: number,
|
|
startScore = 0,
|
|
) {
|
|
for (let i = 0; i < count; i++) {
|
|
await addPoint(page, playerName, startScore + i);
|
|
}
|
|
}
|