stratoflights-web/tests/e2e/account.spec.ts
2026-08-14 00:01:49 +09:00

26 lines
1.1 KiB
TypeScript

import { test, expect, type Page } from '@playwright/test';
async function login(page: Page, user = 'demo', pass = 'demo') {
await page.goto('/login/');
await page.fill('#lg-username', user);
await page.fill('#lg-password', pass);
await page.click('button[type=submit]');
await expect(page.getByTestId('nav-menu')).toBeVisible();
}
test('account page loads the profile and updates the email', async ({ page }) => {
await login(page);
await page.goto('/user/account/');
await expect(page.locator('#ac-email')).toHaveValue('demo@example.com');
await page.fill('#ac-email', 'demo2@example.com');
await page.getByRole('button', { name: /save|сохранить/i }).click();
await expect(page.locator('.toast')).toBeVisible();
});
test('delete-data requires an inline confirm', async ({ page }) => {
await login(page);
await page.goto('/user/account/');
await page.getByRole('button', { name: /delete my data|удалить мои данные/i }).click();
await page.getByTestId('confirm-delete-data').click();
await expect(page.locator('.toast')).toBeVisible();
});