Add high-priority Playwright trips coverage (#42)
All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 2m32s
All checks were successful
Build and Push Image / docker-build-and-push (push) Successful in 2m32s
Co-authored-by: Shaun Campbell <shaun@campbellwireless.net> Reviewed-on: #42 Co-authored-by: AI Agent <ai-agent@campbellwireless.net> Co-committed-by: AI Agent <ai-agent@campbellwireless.net>
This commit was merged in pull request #42.
This commit is contained in:
25
e2e/auth-callback.test.ts
Normal file
25
e2e/auth-callback.test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { test, expect, type Page } from '@playwright/test';
|
||||
import { TEST_USERS } from './setup/test-users.js';
|
||||
|
||||
const LOGIN_URL = '/trips/login';
|
||||
const UPCOMING_URL = '/trips/trips/upcoming';
|
||||
|
||||
async function submitLocalLogin(page: Page, username: string, password: string): Promise<void> {
|
||||
await page.fill('input[name="identifier"]', username);
|
||||
await page.fill('input[name="password"]', password);
|
||||
await page.click('button[type="submit"]:has-text("Sign in locally")');
|
||||
}
|
||||
|
||||
test.beforeEach(async ({ context }) => {
|
||||
await context.clearCookies();
|
||||
});
|
||||
|
||||
test('redirects back to protected route after local login', async ({ page }) => {
|
||||
await page.goto(UPCOMING_URL);
|
||||
await expect(page).toHaveURL(/\/trips\/login/);
|
||||
|
||||
await submitLocalLogin(page, TEST_USERS.regular.username, TEST_USERS.regular.password);
|
||||
await page.waitForURL(/\/trips\/(trips\/upcoming|dashboard)/, { timeout: 15_000 });
|
||||
await expect(page).not.toHaveURL(/\/trips\/auth/);
|
||||
await expect(page).not.toHaveURL(/\/trips\/login/);
|
||||
});
|
||||
Reference in New Issue
Block a user