This commit is contained in:
Trevor Fitzgerald
2026-05-16 19:19:16 -04:00
committed by Thibault Duplessis
parent 4f39deb3c3
commit dfc6abf799
3 changed files with 13 additions and 18 deletions
+9
View File
@@ -0,0 +1,9 @@
import { type Page } from '@playwright/test';
export async function loginAs(page: Page, username: string) {
await page.goto('/login');
await page.getByTestId('username').fill(username);
await page.getByTestId('password').fill('password');
await page.getByTestId('login-submit').click();
await page.waitForLoadState('networkidle');
}
+2 -9
View File
@@ -1,12 +1,5 @@
import { test, expect, Page } from '@playwright/test';
async function loginAs(page: Page, username: string) {
await page.goto('/login');
await page.getByTestId('username').fill(username);
await page.getByTestId('password').fill('password');
await page.getByTestId('login-submit').click();
await page.waitForLoadState('networkidle');
}
import { test, expect } from '@playwright/test';
import { loginAs } from './helpers';
test.beforeEach(async ({ page }) => {
await loginAs(page, 'student1');
+2 -9
View File
@@ -1,12 +1,5 @@
import { test, expect, Page } from '@playwright/test';
async function loginAs(page: Page, username: string) {
await page.goto('/login');
await page.getByTestId('username').fill(username);
await page.getByTestId('password').fill('password');
await page.getByTestId('login-submit').click();
await page.waitForLoadState('networkidle');
}
import { test, expect } from '@playwright/test';
import { loginAs } from './helpers';
test.beforeEach(async ({ page }) => {
await loginAs(page, 'teacher');