24 lines
891 B
TypeScript
24 lines
891 B
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test('anonymous visitor is redirected to /login', async ({ page }) => {
|
|
await page.goto('/app/');
|
|
await expect(page).toHaveURL(/\/login/);
|
|
});
|
|
|
|
test('valid credentials log in and reach the app', async ({ page }) => {
|
|
await page.goto('/login/');
|
|
await page.fill('#lg-username', 'demo');
|
|
await page.fill('#lg-password', 'demo');
|
|
await page.click('button[type=submit]');
|
|
// Who you are signed in as lives behind the burger.
|
|
await page.getByTestId('nav-menu').click();
|
|
await expect(page.getByTestId('app-heading')).toContainText('demo');
|
|
});
|
|
|
|
test('invalid credentials show an inline error', async ({ page }) => {
|
|
await page.goto('/login/');
|
|
await page.fill('#lg-username', 'demo');
|
|
await page.fill('#lg-password', 'wrong');
|
|
await page.click('button[type=submit]');
|
|
await expect(page.getByTestId('login-error')).toBeVisible();
|
|
});
|