feat: tests & bootstrap
This commit is contained in:
parent
4bd927bb4e
commit
79e20ca37c
19 changed files with 706 additions and 23 deletions
27
tests/e2e/auth.spec.ts
Normal file
27
tests/e2e/auth.spec.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { test, expect, login, logout } from './fixtures';
|
||||
|
||||
test('anonymous users are redirected to /login from /predict', async ({ page, context }) => {
|
||||
await logout(context);
|
||||
await page.goto('/predict');
|
||||
await page.waitForURL('**/login', { timeout: 10_000 });
|
||||
await expect(page.getByRole('heading', { level: 5 }).first()).toContainText(
|
||||
/Вход|Sign in/,
|
||||
);
|
||||
});
|
||||
|
||||
test('submitting the login form authenticates and redirects', async ({ page, context }) => {
|
||||
await logout(context);
|
||||
await page.goto('/login');
|
||||
|
||||
await page.getByLabel(/Имя пользователя|Username/).fill('demo');
|
||||
await page.getByLabel(/Пароль|Password/).fill('demo');
|
||||
await page.getByRole('button', { name: /^(Войти|Sign in)$/ }).click();
|
||||
|
||||
await page.waitForURL('**/predict', { timeout: 15_000 });
|
||||
});
|
||||
|
||||
test('already-authenticated visit to / lands on /predict', async ({ page, context }) => {
|
||||
await login(context);
|
||||
await page.goto('/');
|
||||
await page.waitForURL('**/predict', { timeout: 15_000 });
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue