All checks were successful
Build and Deploy Frontend Management to Dev Server / Build Frontend Management Docker Image (push) Successful in 1m17s
Build and Deploy Frontend Management to Dev Server / Deploy E-learning Frontend Management to Dev Server (push) Successful in 8s
Build and Deploy Frontend Management to Dev Server / Notify Deployment Status (push) Successful in 2s
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { test as setup, expect } from '@playwright/test';
|
|
import { TEST_INSTRUCTOR, TEST_URLS } from './test-data';
|
|
import { fileURLToPath } from 'url';
|
|
import path from 'path';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const INSTRUCTOR_AUTH_FILE = path.resolve(__dirname, '../.auth/instructor.json');
|
|
|
|
/**
|
|
* Instructor authentication setup
|
|
* Logs in as instructor and saves browser state (cookies) for reuse
|
|
*/
|
|
setup('authenticate as instructor', async ({ page }) => {
|
|
await page.goto(TEST_URLS.login);
|
|
await page.waitForLoadState('networkidle');
|
|
await page.waitForTimeout(500);
|
|
|
|
// Fill login form
|
|
await page.locator('input[type="email"]').fill(TEST_INSTRUCTOR.email);
|
|
await page.locator('input[type="password"]').fill(TEST_INSTRUCTOR.password);
|
|
|
|
// Submit
|
|
await page.locator('button[type="submit"]').click();
|
|
|
|
// Wait for redirect to instructor dashboard
|
|
await page.waitForURL('**/instructor**', { timeout: 15_000 });
|
|
await expect(page).toHaveURL(/\/instructor/);
|
|
|
|
// Save auth state
|
|
await page.context().storageState({ path: INSTRUCTOR_AUTH_FILE });
|
|
});
|