diff --git a/functional-tests/playwright.config.ts b/functional-tests/playwright.config.ts index fad77c684ae..250a176e309 100644 --- a/functional-tests/playwright.config.ts +++ b/functional-tests/playwright.config.ts @@ -154,10 +154,10 @@ export default defineConfig({ baseURL: getBaseTestEnvUrl(), /* Automatically take screenshot only on failures */ screenshot: "only-on-failure", - /* Automatically record video only on retries */ - video: "retry-with-video", - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: "on-first-retry", + /* Automatically record video when tests fail */ + video: "retain-on-failure", + /* Collect trace when tests fail. See https://playwright.dev/docs/trace-viewer */ + trace: "retain-on-failure", }, /* Configure projects for major browsers */ projects: [ diff --git a/functional-tests/tests/global-teardown.ts b/functional-tests/tests/global-teardown.ts index a61dbfd7aa0..144dcb9099b 100644 --- a/functional-tests/tests/global-teardown.ts +++ b/functional-tests/tests/global-teardown.ts @@ -29,6 +29,16 @@ async function deleteTestUserAccounts(browser: Browser) { const page = await context.newPage(); await page.goto(`${getBaseTestEnvUrl()}/user/settings/manage-account`); + + await page.getByRole("button", { name: "Open user menu" }).click(); + const manageAccountLink = page.getByRole("link", { + name: "Manage your ⁨Mozilla account⁩", + exact: false, + }); + const manageFxaAccountUrl = await manageAccountLink.getAttribute("href"); + // Close the user menu + await manageAccountLink.press("Escape"); + await page.getByRole("button", { name: "Delete account" }).click(); const deleteDialog = page.getByRole("dialog", { name: "Your ⁨Monitor⁩ account will be permanently deleted", @@ -39,11 +49,29 @@ async function deleteTestUserAccounts(browser: Browser) { await deleteButtonConfirm.click(); await page.waitForURL(`${getBaseTestEnvUrl()}/`); + await page.goto(manageFxaAccountUrl!); + await page.getByRole("link", { name: "Delete Account" }).click(); + const consequenceAcknowledgements = await page + .getByTestId("checkbox-container") + .all(); + for (const acknowledgement of consequenceAcknowledgements) { + await acknowledgement.click(); + } + await page.getByRole("button", { name: "Continue" }).click(); + + await page + .getByLabel("Enter password") + .fill(process.env.E2E_TEST_ACCOUNT_BASE_PASSWORD as string); + await page.getByRole("button", { name: "Delete" }).click(); + await context.close(); } } teardown("Delete test user accounts", async ({ browser }) => { + // Going through both the Monitor and the FxA delete flow for + // every account takes relatively long: + teardown.slow(); await deleteTestUserAccounts(browser); removeTestStorage(); });