This commit is contained in:
16
e2e/website/helpers.ts
Normal file
16
e2e/website/helpers.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
export const TEST_PASSWORD = 'testpass123';
|
||||
|
||||
export async function loginAs(page: Page, username: string, password = TEST_PASSWORD) {
|
||||
await page.goto('/website/#/login');
|
||||
await page.locator('#username').fill(username);
|
||||
await page.locator('#password').fill(password);
|
||||
await page.locator('#loginForm button[type="submit"]').click();
|
||||
await expect(page.locator('h1')).toContainText('Questionnaires', { timeout: 15000 });
|
||||
}
|
||||
|
||||
export async function logout(page: Page) {
|
||||
await page.locator('#logoutBtn').click();
|
||||
await expect(page.locator('#loginForm')).toBeVisible();
|
||||
}
|
||||
Reference in New Issue
Block a user