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,44 @@
import { test, expect } from '@playwright/test';
import { TEST_URLS } from '../fixtures/test-data';
/**
* Admin Dashboard Tests
* cookies admin-setup project ( login )
*/
test.describe('Admin Dashboard', () => {
test.beforeEach(async ({ page }) => {
await page.goto(TEST_URLS.adminDashboard);
await page.waitForLoadState('networkidle');
});
test('show display dashboard', async ({ page }) => {
await expect(page.locator('h1')).toContainText('สวัสดี');
await expect(page.locator("//p[normalize-space(text())='คอร์สรออนุมัติ']")).toBeVisible();
await expect(page.getByText('กิจกรรมวันนี้')).toBeVisible();
await expect(page.getByText('ผู้ใช้งานทั้งหมด')).toBeVisible();
});
test('navigate to pending courses and audit-log page', async ({ page }) => {
await page.locator('a[href*="pending"]', { hasText: 'ดูทั้งหมด' }).click();
await page.waitForURL('**/admin/courses/pending**');
await expect(page).toHaveURL(/\/admin\/courses\/pending/);
await page.waitForTimeout(500);
await page.goto(TEST_URLS.adminDashboard);
await page.waitForLoadState('networkidle');
await page.waitForTimeout(500);
await page.locator('a[href*="audit-log"]', { hasText: 'ดูทั้งหมด' }).click();
await page.waitForURL('**/admin/audit-log**');
await expect(page).toHaveURL(/\/admin\/audit-log/);
await page.waitForTimeout(500);
});
test('show user menu on avatar click', async ({ page }) => {
// Click the avatar / user icon area
await page.locator('.w-12.h-12.rounded-full').click();
await page.waitForTimeout(500);
// Menu should appear with profile and logout options
await expect(page.getByText('โปรไฟล์')).toBeVisible();
});
});