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,67 @@
import { test, expect } from '@playwright/test';
import { TEST_URLS } from '../fixtures/test-data';
/**
* Instructor Dashboard Tests
* cookies instructor-setup project ( login )
*/
test.describe('Instructor Dashboard', () => {
test.beforeEach(async ({ page }) => {
await page.goto(TEST_URLS.instructorDashboard);
await page.waitForLoadState('networkidle');
});
test('should display welcome message', async ({ page }) => {
await expect(page.locator('h1')).toContainText('สวัสดี');
});
test('should display stats cards', async ({ page }) => {
await expect(page.getByText('หลักสูตรทั้งหมด')).toBeVisible();
await expect(page.getByText('ผู้เรียนทั้งหมด')).toBeVisible();
await expect(page.getByText('เรียนจบแล้ว')).toBeVisible();
});
test('should display course status breakdown', async ({ page }) => {
await expect(page.getByText('สถานะหลักสูตร')).toBeVisible();
await expect(page.getByText('เผยแพร่แล้ว')).toBeVisible();
await expect(page.getByText('รอตรวจสอบ')).toBeVisible();
await expect(page.getByText('แบบร่าง')).toBeVisible();
});
test('should display recent courses section', async ({ page }) => {
await expect(page.getByText('หลักสูตร')).toBeVisible();
await expect(page.getByRole('button', { name: 'ดูทั้งหมด' })).toBeVisible();
});
test('should navigate to courses list', async ({ page }) => {
await page.getByRole('button', { name: 'ดูทั้งหมด' }).click();
await page.waitForURL('**/instructor/courses**');
await expect(page).toHaveURL(/\/instructor\/courses/);
});
test('should show user menu on avatar click', async ({ page }) => {
await page.locator('.w-12.h-12.rounded-full').click();
await expect(page.getByText('โปรไฟล์')).toBeVisible();
await expect(page.getByText('ออกจากระบบ')).toBeVisible();
});
test('should navigate to profile', async ({ page }) => {
await page.locator('.w-12.h-12.rounded-full').click();
await page.getByText('โปรไฟล์').click();
await page.waitForURL('**/instructor/profile**');
await expect(page).toHaveURL(/\/instructor\/profile/);
});
test('should logout and redirect to login', async ({ page }) => {
await page.locator('.w-12.h-12.rounded-full').click();
await page.getByText('ออกจากระบบ').click();
// Confirm logout dialog
await page.locator('.q-dialog').getByText('ออกจากระบบ').click();
await page.waitForURL('**/login**', { timeout: 10_000 });
await expect(page).toHaveURL(/\/login/);
});
});