test(ui): e2e for the friends-list kebab, confirm modals and outside-tap
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 56s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m20s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Has been skipped
CI / integration (pull_request) Has been skipped
CI / ui (pull_request) Successful in 56s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m20s
Cover the reworked Settings -> Friends interactions in the mock e2e (Chromium + WebKit): the row kebab slides open the block/remove icons and an outside tap collapses it; blocking confirms (naming the friend) and moves them to Blocked; removing confirms and drops the friendship.
This commit is contained in:
@@ -44,6 +44,60 @@ test('friends: issue a code, accept an incoming request, redeem a code', async (
|
|||||||
await expect(page.locator('.who', { hasText: 'Friend 111111' })).toBeVisible();
|
await expect(page.locator('.who', { hasText: 'Friend 111111' })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('friends: the row kebab reveals block/remove and an outside tap closes it', async ({ page }) => {
|
||||||
|
await loginLobby(page);
|
||||||
|
await openFriends(page);
|
||||||
|
|
||||||
|
// A friend row slides open on its kebab (like the lobby), exposing two icon actions.
|
||||||
|
const kaya = page.locator('.rowwrap', { hasText: 'Kaya' });
|
||||||
|
await kaya.locator('.kebab').click();
|
||||||
|
await expect(kaya).toHaveClass(/revealed/);
|
||||||
|
await expect(kaya.locator('.acts').getByRole('button', { name: 'Block' })).toBeVisible();
|
||||||
|
await expect(kaya.locator('.acts').getByRole('button', { name: 'Remove' })).toBeVisible();
|
||||||
|
|
||||||
|
// A tap anywhere outside the action buttons collapses the row again.
|
||||||
|
await page.getByRole('heading', { name: 'Your friends' }).click();
|
||||||
|
await expect(kaya).not.toHaveClass(/revealed/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('friends: blocking from the list confirms (naming the friend) and moves them to Blocked', async ({ page }) => {
|
||||||
|
await loginLobby(page);
|
||||||
|
await openFriends(page);
|
||||||
|
|
||||||
|
const kaya = page.locator('.rowwrap', { hasText: 'Kaya' });
|
||||||
|
await kaya.locator('.kebab').click();
|
||||||
|
await kaya.locator('.acts').getByRole('button', { name: 'Block' }).click();
|
||||||
|
|
||||||
|
// The confirmation keeps a generic title and names the friend in the body.
|
||||||
|
const dialog = page.getByRole('dialog');
|
||||||
|
await expect(dialog.getByText('Block this player?')).toBeVisible();
|
||||||
|
await expect(dialog.locator('.confirm-name')).toHaveText('Kaya');
|
||||||
|
await dialog.getByRole('button', { name: 'Block' }).click();
|
||||||
|
|
||||||
|
// The block applied: Kaya leaves the friends list and shows under Blocked players.
|
||||||
|
await expect(page.getByText('No friends yet.')).toBeVisible();
|
||||||
|
const blocked = page.locator('.rowwrap', { hasText: 'Kaya' });
|
||||||
|
await expect(blocked.getByRole('button', { name: 'Unblock' })).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('friends: removing from the list confirms (naming the friend) and drops them', async ({ page }) => {
|
||||||
|
await loginLobby(page);
|
||||||
|
await openFriends(page);
|
||||||
|
|
||||||
|
const kaya = page.locator('.rowwrap', { hasText: 'Kaya' });
|
||||||
|
await kaya.locator('.kebab').click();
|
||||||
|
await kaya.locator('.acts').getByRole('button', { name: 'Remove' }).click();
|
||||||
|
|
||||||
|
const dialog = page.getByRole('dialog');
|
||||||
|
await expect(dialog.getByText('Remove from friends?')).toBeVisible();
|
||||||
|
await expect(dialog.locator('.confirm-name')).toHaveText('Kaya');
|
||||||
|
await dialog.getByRole('button', { name: 'Remove' }).click();
|
||||||
|
|
||||||
|
// Unfriending just drops the friendship — Kaya is gone and not blocked.
|
||||||
|
await expect(page.getByText('No friends yet.')).toBeVisible();
|
||||||
|
await expect(page.locator('.rowwrap', { hasText: 'Kaya' })).toHaveCount(0);
|
||||||
|
});
|
||||||
|
|
||||||
test('invitations: the lobby shows an invitation and accepting clears it', async ({ page }) => {
|
test('invitations: the lobby shows an invitation and accepting clears it', async ({ page }) => {
|
||||||
await loginLobby(page);
|
await loginLobby(page);
|
||||||
await expect(page.getByText('Invitations')).toBeVisible();
|
await expect(page.getByText('Invitations')).toBeVisible();
|
||||||
|
|||||||
Reference in New Issue
Block a user