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

@ -24,6 +24,7 @@ test.describe('Login Page', () => {
test('should show validation errors for empty fields', async ({ page }) => {
// Click submit without filling fields
await page.locator('button[type="submit"]').click();
await page.waitForTimeout(1000);
// Expect validation messages in Thai
await expect(page.getByText('กรุณากรอกอีเมล')).toBeVisible();
@ -31,8 +32,11 @@ test.describe('Login Page', () => {
test('should show validation errors for empty fields password', async ({ page }) => {
// Click submit without filling fields
await page.waitForTimeout(1000);
await page.locator('input[type="email"]').fill('test@email.com');
await page.waitForTimeout(1000);
await page.locator('button[type="submit"]').click();
await page.waitForTimeout(1000);
// Expect validation messages in Thai
await expect(page.getByText('กรุณากรอกรหัสผ่าน')).toBeVisible();
@ -76,11 +80,13 @@ test.describe('Login Page', () => {
});
test('should login as instructor and redirect to /instructor', async ({ page }) => {
await page.waitForTimeout(1000);
await page.locator('input[type="email"]').fill(TEST_INSTRUCTOR.email);
await page.waitForTimeout(1000);
await page.locator('input[type="password"]').fill(TEST_INSTRUCTOR.password);
await page.waitForTimeout(1000);
await page.locator('button[type="submit"]').click();
await page.waitForTimeout(1000);
// Should redirect to instructor dashboard
await page.waitForURL('**/instructor**', { timeout: 15_000 });
@ -88,7 +94,9 @@ test.describe('Login Page', () => {
});
test('should open forgot password modal', async ({ page }) => {
await page.waitForTimeout(1000);
await page.getByText('ลืมรหัสผ่าน?').click();
await page.waitForTimeout(1000);
// Modal should be visible
await expect(page.getByText('ลืมรหัสผ่าน').nth(1)).toBeVisible();