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
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:
parent
734d922393
commit
9bc24fbe8a
18 changed files with 1344 additions and 7 deletions
67
frontend_management/tests/admin/recommended-courses.spec.ts
Normal file
67
frontend_management/tests/admin/recommended-courses.spec.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { test, expect } from '@playwright/test';
|
||||
import { TEST_URLS } from '../fixtures/test-data';
|
||||
|
||||
/**
|
||||
* Admin Recommended Courses Page Tests
|
||||
* ใช้ cookies จาก admin-setup project (ไม่ต้อง login ซ้ำ)
|
||||
*/
|
||||
test.describe('Admin Recommended Courses', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(TEST_URLS.adminRecommendedCourses);
|
||||
await page.waitForLoadState('networkidle');
|
||||
});
|
||||
|
||||
test('check display page', async ({ page }) => {
|
||||
// Header
|
||||
await expect(page.getByText('จัดการคอร์สแนะนำ')).toBeVisible();
|
||||
await expect(page.getByText('Recommended Courses Management')).toBeVisible();
|
||||
const toggles = page.locator('.q-table .q-toggle');
|
||||
const hasData = await toggles.first().isVisible().catch(() => false);
|
||||
|
||||
if (hasData) {
|
||||
await expect(toggles.first()).toBeVisible();
|
||||
}
|
||||
});
|
||||
|
||||
test('should toggle recommendation status', async ({ page }) => {
|
||||
const toggle = page.locator('.q-table .q-toggle').first();
|
||||
const hasData = await toggle.isVisible().catch(() => false);
|
||||
|
||||
if (hasData) {
|
||||
await toggle.click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Should show notification (success or error)
|
||||
await expect(page.locator('.q-notification')).toBeVisible({ timeout: 10_000 });
|
||||
|
||||
await toggle.click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Should show notification (success or error)
|
||||
await expect(page.locator('.q-notification').last()).toBeVisible({ timeout: 10_000 });
|
||||
}
|
||||
});
|
||||
|
||||
test('open course details dialog', async ({ page }) => {
|
||||
const viewBtn = page.locator('.q-table .q-btn').filter({ has: page.locator('.q-icon') }).first();
|
||||
const hasData = await viewBtn.isVisible().catch(() => false);
|
||||
|
||||
if (hasData) {
|
||||
await viewBtn.click();
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Dialog should be visible with course details
|
||||
await expect(page.getByText('รายละเอียดคอร์ส (Course Details)')).toBeVisible();
|
||||
|
||||
// Detail sections
|
||||
await expect(page.getByText('รายละเอียด (Description)')).toBeVisible();
|
||||
await expect(page.getByText('หมวดหมู่ (Category):')).toBeVisible();
|
||||
await expect(page.getByText('ผู้สอน (Instructors)')).toBeVisible();
|
||||
|
||||
// Close dialog via close button in q-bar
|
||||
await page.locator('.q-bar .q-btn').filter({ has: page.locator('[class*="q-icon"]') }).click();
|
||||
await page.waitForTimeout(300);
|
||||
await expect(page.getByText('รายละเอียดคอร์ส (Course Details)')).not.toBeVisible();
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue