Files
wehub-resource-sync dde272c4b8
CD - Docker - GHCR Images / Build and Push Images (push) Waiting to run
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

65 lines
1.9 KiB
TypeScript

import { exec } from 'child_process';
import { promisify } from 'util';
import { test, expect } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
const execP = promisify(exec);
test.beforeEach(async ({ page }) => {
await page.goto('/settings');
});
test.afterAll(
async () =>
await Promise.all([
execP('node ../tools/scripts/seed/seed-demo-user --certified-user'),
execP('node ../tools/scripts/seed/seed-surveys'),
execP('node ../tools/scripts/seed/seed-ms-username')
])
);
test.describe('Delete Modal component', () => {
test('should close the modal and sign the user out after they fill in the verify input text and click delete', async ({
page
}) => {
await page
.getByRole('button', { name: translations.settings.danger.delete })
.click();
await expect(
page.getByRole('dialog', {
name: translations.settings.danger['delete-title']
})
).toBeVisible();
const verifyDeleteText = translations.settings.danger['verify-delete-text'];
const verifyDeleteInput = page.getByRole('textbox', {
exact: true
});
await verifyDeleteInput.fill(verifyDeleteText);
await page
.getByRole('button', { name: translations.settings.danger.certain })
.click();
await expect(
page.getByRole('dialog', {
name: translations.settings.danger['delete-title']
})
).not.toBeVisible();
// TODO: Reinstate these checks when flakiness is resolved:
// await expect(page).toHaveURL(allowTrailingSlash('/learn'));
// await alertToBeVisible(page, translations.flash['account-deleted']);
// The user is signed out after their account is deleted. Don't check the
// number of occurrences of the 'Sign in' link as it may vary depending on AB
// tests and Gatsby develop mode flakiness.
await expect(
page.getByRole('link', { name: 'Sign in' }).first()
).toBeVisible();
});
});