feat(account): provider linking, unlink & email change (PR2) #163
+40
-16
@@ -292,32 +292,56 @@ test('profile edit disables Save and flags an invalid display name', async ({ pa
|
||||
await expect(save).toBeEnabled();
|
||||
});
|
||||
|
||||
// The email upgrade box is now shown to guests (email bind + the merge dialog). These specs
|
||||
// still assume a non-guest login and the visible Telegram control, so they stay skipped until
|
||||
// PR2 re-enables provider linking and adds a guest-login setup.
|
||||
test.skip('link account: a taken email opens the irreversible merge confirmation', async ({ page }) => {
|
||||
// The profile's sign-in-methods matrix (email add/change + provider link/unlink). The mock
|
||||
// profile is a durable account already holding an email, so the email control is the change
|
||||
// flow; a new address containing "taken" stands in (in the mock) for one owned by another
|
||||
// account, driving the non-disclosing refusal.
|
||||
test('change email: a taken address is refused without disclosure', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await openProfile(page);
|
||||
|
||||
// The email box is shown to guests (this spec needs a guest login — re-enabled in PR2).
|
||||
await expect(page.getByRole('heading', { name: 'Link an account' })).toBeVisible();
|
||||
// An address containing "merge" stands in (in the mock) for one already owned by
|
||||
// another account, so the confirm step reveals a required merge.
|
||||
await page.locator('.emailbox input[type="email"]').fill('merge@example.com');
|
||||
await expect(page.getByText('you@example.com')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Change' }).click();
|
||||
await page.getByPlaceholder('New email address').fill('taken@example.com');
|
||||
await page.getByRole('button', { name: 'Send code' }).click();
|
||||
await page.locator('.emailbox .codein').fill('123456');
|
||||
await page.locator('.accounts .codein').fill('123456');
|
||||
await page.getByRole('button', { name: 'OK' }).click();
|
||||
|
||||
// The reveal happens only after the code, and names the other account.
|
||||
await expect(page.getByText('Merge accounts?')).toBeVisible();
|
||||
await expect(page.getByText(/Ann/)).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Merge' }).click();
|
||||
await expect(page.getByText('Merge accounts?')).toBeHidden();
|
||||
// The neutral message never reveals the other account.
|
||||
await expect(page.getByText('Check the address or contact support.')).toBeVisible();
|
||||
await expect(page.getByText(/belongs to another account/)).toHaveCount(0);
|
||||
await expect(page.getByText('you@example.com')).toBeVisible();
|
||||
});
|
||||
|
||||
test.skip('link account: the Telegram web sign-in control is offered in a browser', async ({ page }) => {
|
||||
test('change email: a free address replaces the current one', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await openProfile(page);
|
||||
|
||||
await page.getByRole('button', { name: 'Change' }).click();
|
||||
await page.getByPlaceholder('New email address').fill('fresh@example.com');
|
||||
await page.getByRole('button', { name: 'Send code' }).click();
|
||||
await page.locator('.accounts .codein').fill('123456');
|
||||
await page.getByRole('button', { name: 'OK' }).click();
|
||||
|
||||
await expect(page.getByText('fresh@example.com')).toBeVisible();
|
||||
await expect(page.getByText('you@example.com')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('link then unlink Telegram from the sign-in methods', async ({ page }) => {
|
||||
await loginLobby(page);
|
||||
await openProfile(page);
|
||||
|
||||
// On the web the Telegram login-widget control is offered; the mock links it instantly.
|
||||
await page.getByRole('button', { name: 'Link Telegram' }).click();
|
||||
const tgRow = page.locator('.acctrow').filter({ hasText: 'Telegram' });
|
||||
await expect(tgRow).toBeVisible();
|
||||
|
||||
// With email + Telegram two methods remain, so Unlink is offered; confirm it in the dialog.
|
||||
await tgRow.getByRole('button', { name: 'Unlink' }).click();
|
||||
await expect(page.getByText('Unlink account?')).toBeVisible();
|
||||
await page.getByRole('dialog').getByRole('button', { name: 'Unlink' }).click();
|
||||
|
||||
await expect(page.locator('.acctrow').filter({ hasText: 'Telegram' })).toHaveCount(0);
|
||||
await expect(page.getByRole('button', { name: 'Link Telegram' })).toBeVisible();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user