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
96
frontend_management/tests/admin/audit-log.spec.ts
Normal file
96
frontend_management/tests/admin/audit-log.spec.ts
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
import { test, expect } from '@playwright/test';
|
||||
import { TEST_URLS } from '../fixtures/test-data';
|
||||
|
||||
/**
|
||||
* Admin Audit Log Page Tests
|
||||
* ใช้ cookies จาก admin-setup project (ไม่ต้อง login ซ้ำ)
|
||||
*/
|
||||
test.describe('Admin Audit Log', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(TEST_URLS.adminAuditLog);
|
||||
await page.waitForLoadState('networkidle');
|
||||
});
|
||||
|
||||
test('check display page', async ({ page }) => {
|
||||
// Header
|
||||
await expect(page.getByText('Audit Logs', { exact: true })).toBeVisible();
|
||||
await expect(page.getByText('ประวัติการใช้งานระบบและกิจกรรมต่างๆ')).toBeVisible();
|
||||
|
||||
// Stats cards
|
||||
await expect(page.getByText('Logs ทั้งหมด')).toBeVisible();
|
||||
await expect(page.getByText('Logs วันนี้')).toBeVisible();
|
||||
|
||||
await expect(page.getByRole('button', { name: 'รีเฟรช' })).toBeVisible();
|
||||
await expect(page.getByRole('button', { name: 'ล้างประวัติเก่า' })).toBeVisible();
|
||||
});
|
||||
|
||||
test('should refresh data when clicking refresh button', async ({ page }) => {
|
||||
const refreshBtn = page.getByRole('button', { name: 'รีเฟรช' });
|
||||
await refreshBtn.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Table should still be visible after refresh
|
||||
await expect(page.locator('.q-table')).toBeVisible();
|
||||
});
|
||||
|
||||
test('should filter by Action', async ({ page }) => {
|
||||
// Click the Action select
|
||||
const actionSelect = page.locator('label').filter({ hasText: 'Action' });
|
||||
await actionSelect.click();
|
||||
await page.waitForTimeout(300);
|
||||
|
||||
// Select an option from dropdown
|
||||
const option = page.locator('.q-item__label').filter({ hasText: 'LOGIN' }).first();
|
||||
await option.click();
|
||||
|
||||
// Click search
|
||||
await page.getByRole('button', { name: 'ค้นหา' }).click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Table should be visible
|
||||
await expect(page.locator('.q-table')).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: 'ล้างตัวกรอง' }).click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// Entity type input should be cleared
|
||||
await expect(option).not.toBeVisible();
|
||||
});
|
||||
|
||||
test('check open details dialog', async ({ page }) => {
|
||||
// Wait for table data to load
|
||||
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(300);
|
||||
|
||||
// Details dialog should be visible
|
||||
await expect(page.getByText('รายละเอียด Audit Log')).toBeVisible();
|
||||
|
||||
// Close button
|
||||
await page.getByRole('button', { name: 'ปิด' }).click();
|
||||
}
|
||||
});
|
||||
|
||||
test('check close cleanup dialog on cancel', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'ล้างประวัติเก่า' }).click();
|
||||
await page.waitForTimeout(300);
|
||||
await expect(page.locator('.q-dialog')).toBeVisible();
|
||||
|
||||
// Click cancel
|
||||
await page.getByRole('button', { name: 'ยกเลิก' }).click();
|
||||
await expect(page.locator('.q-dialog')).not.toBeVisible();
|
||||
});
|
||||
|
||||
test('check close cleanup dialog on confirm', async ({ page }) => {
|
||||
await page.getByRole('button', { name: 'ล้างประวัติเก่า' }).click();
|
||||
await page.waitForTimeout(300);
|
||||
await expect(page.locator('.q-dialog')).toBeVisible();
|
||||
|
||||
// Click confirm
|
||||
await page.getByRole('button', { name: 'ลบข้อมูล', exact: true }).click();
|
||||
await expect(page.locator('.q-dialog')).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue