Files
myeasycms-v2/apps/e2e/tests/account/account.spec.ts
Giancarlo Buomprisco 7ebff31475 Next.js Supabase V3 (#463)
Version 3 of the kit:
- Radix UI replaced with Base UI (using the Shadcn UI patterns)
- next-intl replaces react-i18next
- enhanceAction deprecated; usage moved to next-safe-action
- main layout now wrapped with [locale] path segment
- Teams only mode
- Layout updates
- Zod v4
- Next.js 16.2
- Typescript 6
- All other dependencies updated
- Removed deprecated Edge CSRF
- Dynamic Github Action runner
2026-03-24 13:40:38 +08:00

102 lines
2.4 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { AuthPageObject } from '../authentication/auth.po';
import { AccountPageObject } from './account.po';
test.describe('Account Settings', () => {
let account: AccountPageObject;
let email: string;
test.beforeEach(async ({ page }) => {
const auth = new AuthPageObject(page);
email = auth.createRandomEmail();
auth.bootstrapUser({
email,
password: 'testingpassword',
name: 'Test User',
});
account = new AccountPageObject(page);
await auth.loginAsUser({
email,
password: 'testingpassword',
next: '/home/settings',
});
});
test('user can update their profile name', async ({ page }) => {
const name = 'John Doe';
const request = account.updateName(name);
const response = page.waitForResponse((resp) => {
return resp.url().includes('accounts');
});
await Promise.all([request, response]);
await page.locator('[data-test="workspace-dropdown-trigger"]').click();
await expect(account.getProfileName()).toHaveText(name);
});
test('user can update their email', async () => {
const email = account.auth.createRandomEmail();
await account.updateEmail(email);
});
test('user can update their password', async ({ page }) => {
const password = (Math.random() * 100000).toString();
const request = account.updatePassword(password);
const response = page.waitForResponse((resp) => {
return resp.url().includes('auth/v1/user');
});
await Promise.all([request, response]);
await page.context().clearCookies();
await page.reload();
});
});
test.describe('Account Deletion', () => {
test('user can delete their own account', async ({ page }) => {
// Create a fresh user for this test since we'll be deleting it
const auth = new AuthPageObject(page);
const account = new AccountPageObject(page);
const email = auth.createRandomEmail();
await auth.bootstrapUser({
email,
password: 'testingpassword',
name: 'Test User',
});
await auth.loginAsUser({ email, next: '/home/settings' });
await account.deleteAccount(email);
await page.waitForURL('/');
await page.goto('/auth/sign-in');
// sign in will now fail
await auth.signIn({
email,
password: 'testingpassword',
});
await expect(
page.locator('[data-test="auth-error-message"]'),
).toBeVisible();
});
});