Add tests result

This commit is contained in:
Missez 2026-03-06 15:47:37 +07:00
parent 853c141910
commit 9e4fcbf04e
111 changed files with 1078 additions and 77 deletions

View file

@ -53,15 +53,16 @@ test.describe.serial('Course Detail Tabs', () => {
await expect(structureTab).toBeVisible();
// ตรวจสอบว่ามี chapters หรือ empty state
const hasChapters = await page.locator('.font-semibold').getByText(/^Chapter/).first().isVisible().catch(() => false);
await expect(page.getByText('โครงสร้างบทเรียน')).toBeVisible();
const hasEmptyState = await page.getByText('ยังไม่มีบทเรียน').isVisible().catch(() => false);
const hasChapters = !hasEmptyState && (await page.locator('.q-list.border-t').first().isVisible().catch(() => false));
expect(hasChapters || hasEmptyState).toBeTruthy();
// ถ้ามี chapters → กดเข้าดู lesson แรก
if (hasChapters) {
// หา lesson แรกใน structure tab แล้วกด
const firstLesson = page.locator('.q-item').filter({ hasText: /^Lesson/ }).first();
const firstLesson = page.locator('.q-item').filter({ hasText: /Lesson \d/ }).first();
await expect(firstLesson).toBeVisible();
await firstLesson.click();
@ -154,10 +155,6 @@ test.describe.serial('Course Detail Tabs', () => {
// ตรวจสอบว่ามีผลลัพธ์ (dropdown options) หรือ "ไม่พบผู้ใช้"
const hasResults = await page.locator('.q-menu .q-item').first().isVisible().catch(() => false);
expect(hasResults).toBeTruthy();
// ปิด dialog
await dialog.getByRole('button', { name: 'ยกเลิก' }).click();
await expect(dialog).toBeHidden({ timeout: 3_000 });
}
});
@ -251,7 +248,6 @@ test.describe.serial('Course Detail Tabs', () => {
await expect(dialog.getByText('สร้างประกาศใหม่')).toBeVisible();
// กรอกหัวข้อ (ภาษาไทย)
await dialog.locator('input').filter({ has: page.locator('[aria-label="หัวข้อ (ภาษาไทย) *"]') }).first().click();
await dialog.getByLabel('หัวข้อ (ภาษาไทย) *').fill(announcementTitle);
// กรอกหัวข้อ (English)