22 lines
944 B
TypeScript
22 lines
944 B
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test('a visitor can register and lands in the app', async ({ page }) => {
|
|
await page.goto('/register/');
|
|
await page.fill('#rg-username', 'newbie');
|
|
await page.fill('#rg-email', 'newbie@example.com');
|
|
await page.fill('#rg-password', 's3curePass!');
|
|
await page.fill('#rg-password2', 's3curePass!');
|
|
await page.click('button[type=submit]');
|
|
await page.getByTestId('nav-menu').click();
|
|
await expect(page.getByTestId('app-heading')).toContainText('newbie');
|
|
});
|
|
|
|
test('duplicate username shows an inline error', async ({ page }) => {
|
|
await page.goto('/register/');
|
|
await page.fill('#rg-username', 'demo'); // seeded in the mock
|
|
await page.fill('#rg-email', 'dupe@example.com');
|
|
await page.fill('#rg-password', 's3curePass!');
|
|
await page.fill('#rg-password2', 's3curePass!');
|
|
await page.click('button[type=submit]');
|
|
await expect(page.getByTestId('register-error')).toBeVisible();
|
|
});
|