Stage 8: regression tests for the review-round refinements
Tests · Go / test (push) Successful in 6s
Tests · Integration / integration (push) Successful in 11s
Tests · UI / test (push) Successful in 18s
Tests · Go / test (pull_request) Successful in 6s
Tests · Integration / integration (pull_request) Successful in 12s
Tests · UI / test (pull_request) Successful in 18s
Tests · Go / test (push) Successful in 6s
Tests · Integration / integration (push) Successful in 11s
Tests · UI / test (push) Successful in 18s
Tests · Go / test (pull_request) Successful in 6s
Tests · Integration / integration (pull_request) Successful in 12s
Tests · UI / test (pull_request) Successful in 18s
Lock the polish behaviours so a future edit surfaces as a failing test: - backend: UpdateProfile now rejects a bad name layout, an away window over 12h, and a malformed offset timezone (confirming it wires the Stage 8 validators); a new integration test accepts and resolves a "+03:00" offset timezone. - e2e (mock): the lobby notification badge count, the play-with-friends required game type + invitation send, the in-game add-to-friends flipping to a disabled "request sent", the profile-edit invalid-name Save guard, and the chat send/nudge icon buttons.
This commit is contained in:
@@ -86,3 +86,65 @@ test('finished game draws an inert footer and trims the live-only menu', async (
|
||||
await expect(page.getByRole('button', { name: 'Check word' })).toHaveCount(0);
|
||||
await expect(page.getByRole('button', { name: 'Drop game' })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('lobby hamburger shows the pending notification count', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
// One incoming friend request (Rick) + one invitation (Kaya) = 2.
|
||||
await expect(page.getByTestId('menu-badge')).toHaveText('2');
|
||||
});
|
||||
|
||||
test('play with friends: a game type is required to send an invitation', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await page.getByRole('button', { name: /New/ }).click(); // lobby tab bar
|
||||
await page.getByRole('button', { name: 'Play with friends' }).click();
|
||||
|
||||
const send = page.getByRole('button', { name: 'Send invitation' });
|
||||
await expect(send).toBeDisabled();
|
||||
|
||||
await page.getByRole('checkbox').first().check(); // pick a friend
|
||||
await expect(send).toBeDisabled(); // still no game type
|
||||
|
||||
await page.locator('.field select').first().selectOption('english');
|
||||
await expect(send).toBeEnabled();
|
||||
|
||||
await send.click(); // the mock creates it and returns to the lobby
|
||||
await expect(page.getByText('Active games')).toBeVisible();
|
||||
});
|
||||
|
||||
test('game: add-to-friends flips to a disabled "request sent"', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await page.getByRole('button', { name: /Ann/ }).click(); // active game vs Ann
|
||||
await page.locator('.burger').first().click();
|
||||
await page.getByRole('button', { name: /Add to friends: Ann/ }).click();
|
||||
// Reopening the menu shows the item as a disabled "request sent".
|
||||
await page.locator('.burger').first().click();
|
||||
const sent = page.getByRole('button', { name: 'Request sent' });
|
||||
await expect(sent).toBeVisible();
|
||||
await expect(sent).toBeDisabled();
|
||||
});
|
||||
|
||||
test('profile edit disables Save and flags an invalid display name', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await page.locator('.burger').first().click();
|
||||
await page.getByRole('button', { name: /Profile/ }).click();
|
||||
await page.getByRole('button', { name: /Edit profile/ }).click();
|
||||
|
||||
const name = page.locator('.edit input').first();
|
||||
const save = page.getByRole('button', { name: /^Save$/ });
|
||||
await name.fill('Bad__Name'); // adjacent specials — invalid
|
||||
await expect(save).toBeDisabled();
|
||||
await expect(name).toHaveClass(/invalid/);
|
||||
|
||||
await name.fill('Good Name');
|
||||
await expect(save).toBeEnabled();
|
||||
});
|
||||
|
||||
test('chat send and nudge are icon buttons', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await page.getByRole('button', { name: /Ann/ }).click();
|
||||
await page.locator('.burger').first().click();
|
||||
await page.getByRole('button', { name: 'Chat' }).click();
|
||||
// Icon-only controls expose their action through the aria-label.
|
||||
await expect(page.getByRole('button', { name: 'Send' })).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'Nudge' })).toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user