feat: Establish Playwright testing infrastructure with initial tests for authentication, admin, and instructor modules, and fix instructor video and quiz lesson management pages.
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

This commit is contained in:
Missez 2026-03-02 15:48:47 +07:00
parent 734d922393
commit 9bc24fbe8a
18 changed files with 1344 additions and 7 deletions

View file

@ -0,0 +1,30 @@
import { test as setup, expect } from '@playwright/test';
import { TEST_ADMIN, TEST_URLS } from './test-data';
import { fileURLToPath } from 'url';
import path from 'path';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const ADMIN_AUTH_FILE = path.resolve(__dirname, '../.auth/admin.json');
/**
* Admin authentication setup
* Logs in as admin and saves browser state (cookies) for reuse
*/
setup('authenticate as admin', 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_ADMIN.email);
await page.locator('input[type="password"]').fill(TEST_ADMIN.password);
// Submit
await page.locator('button[type="submit"]').click();
// Wait for redirect to admin dashboard
await page.waitForURL('**/admin**', { timeout: 15_000 });
await expect(page).toHaveURL(/\/admin/);
// Save auth state
await page.context().storageState({ path: ADMIN_AUTH_FILE });
});