feat: Introduce core authentication service, several new admin management pages, and instructor feature tests.
All checks were successful
Build and Deploy Frontend Management to Dev Server / Build Frontend Management Docker Image (push) Successful in 52s
Build and Deploy Frontend Management to Dev Server / Deploy E-learning Frontend Management to Dev Server (push) Successful in 4s
Build and Deploy Frontend Management to Dev Server / Notify Deployment Status (push) Successful in 1s

This commit is contained in:
Missez 2026-03-06 11:24:10 +07:00
parent 000f9eea5c
commit 0205aab461
11 changed files with 818 additions and 121 deletions

View file

@ -16,16 +16,6 @@ test.describe('Register Page', () => {
await expect(page.getByText('ลงทะเบียนเป็นผู้สอน')).toBeVisible();
await expect(page.getByText('สร้างบัญชีเพื่อเริ่มสร้างหลักสูตร')).toBeVisible();
// Form fields
await expect(page.locator('label').filter({ hasText: 'ชื่อผู้ใช้ (Username)' })).toBeVisible();
await expect(page.locator('label').filter({ hasText: 'อีเมล' })).toBeVisible();
await expect(page.locator('label').filter({ hasText: 'รหัสผ่าน *' })).toBeVisible();
await expect(page.locator('label').filter({ hasText: 'ยืนยันรหัสผ่าน' })).toBeVisible();
await expect(page.locator('label').filter({ hasText: 'คำนำหน้า' })).toBeVisible();
await expect(page.locator('label').filter({ hasText: 'ชื่อจริง' })).toBeVisible();
await expect(page.locator('label').filter({ hasText: 'นามสกุล' })).toBeVisible();
await expect(page.locator('label').filter({ hasText: 'เบอร์โทรศัพท์' })).toBeVisible();
// Submit button
await expect(page.getByRole('button', { name: 'ลงทะเบียน' })).toBeVisible();
@ -34,18 +24,6 @@ test.describe('Register Page', () => {
await expect(page.getByText('เข้าสู่ระบบ')).toBeVisible();
});
test('should show validation errors for empty fields', async ({ page }) => {
await page.getByRole('button', { name: 'ลงทะเบียน' }).click();
await expect(page.getByText('กรุณากรอก username')).toBeVisible();
await expect(page.getByText('กรุณากรอกอีเมล')).toBeVisible();
await expect(page.getByText('กรุณากรอกรหัสผ่าน')).toBeVisible();
await expect(page.getByText('กรุณายืนยันรหัสผ่าน')).toBeVisible();
await expect(page.getByText('กรุณากรอกชื่อ')).toBeVisible();
await expect(page.getByText('กรุณากรอกนามสกุล')).toBeVisible();
await expect(page.getByText('กรุณากรอกเบอร์โทร')).toBeVisible();
});
test('should show username min length validation', async ({ page }) => {
const usernameInput = page.locator('label').filter({ hasText: 'ชื่อผู้ใช้ (Username)' }).locator('input');
await usernameInput.fill('ab');
@ -55,7 +33,9 @@ test.describe('Register Page', () => {
});
test('should show email format validation', async ({ page }) => {
const emailInput = page.locator('input[type="email"]');
const usernameInput = page.locator('label').filter({ hasText: 'ชื่อผู้ใช้ (Username)' }).locator('input');
await usernameInput.fill('abeee');
const emailInput = page.locator('label').filter({ hasText: 'อีเมล' }).locator('input');
await emailInput.fill('invalid-email');
await page.getByRole('button', { name: 'ลงทะเบียน' }).click();
@ -63,7 +43,11 @@ test.describe('Register Page', () => {
});
test('should show password min length validation', async ({ page }) => {
const passwordInput = page.locator('label').filter({ hasText: 'รหัสผ่าน *' }).locator('input');
const usernameInput = page.locator('label').filter({ hasText: 'ชื่อผู้ใช้ (Username)' }).locator('input');
await usernameInput.fill('abeee');
const emailInput = page.locator('label').filter({ hasText: 'อีเมล' }).locator('input');
await emailInput.fill('test@example.com');
const passwordInput = page.getByRole('textbox', { name: 'รหัสผ่าน *', exact: true });
await passwordInput.fill('1234');
await page.getByRole('button', { name: 'ลงทะเบียน' }).click();
@ -71,8 +55,12 @@ test.describe('Register Page', () => {
});
test('should show password mismatch validation', async ({ page }) => {
const passwordInput = page.locator('label').filter({ hasText: 'รหัสผ่าน *' }).locator('input');
const confirmInput = page.locator('label').filter({ hasText: 'ยืนยันรหัสผ่าน' }).locator('input');
const usernameInput = page.locator('label').filter({ hasText: 'ชื่อผู้ใช้ (Username)' }).locator('input');
await usernameInput.fill('abeee');
const emailInput = page.locator('label').filter({ hasText: 'อีเมล' }).locator('input');
await emailInput.fill('test@example.com');
const passwordInput = page.getByRole('textbox', { name: 'รหัสผ่าน *', exact: true });
const confirmInput = page.getByRole('textbox', { name: 'ยืนยันรหัสผ่าน *', exact: true });
await passwordInput.fill('password123');
await confirmInput.fill('differentpass');
@ -82,7 +70,11 @@ test.describe('Register Page', () => {
});
test('should toggle password visibility', async ({ page }) => {
const passwordInput = page.locator('label').filter({ hasText: 'รหัสผ่าน *' }).locator('input');
const usernameInput = page.locator('label').filter({ hasText: 'ชื่อผู้ใช้ (Username)' }).locator('input');
await usernameInput.fill('abeee');
const emailInput = page.locator('label').filter({ hasText: 'อีเมล' }).locator('input');
await emailInput.fill('test@example.com');
const passwordInput = page.getByRole('textbox', { name: 'รหัสผ่าน *', exact: true });
await passwordInput.fill('test1234');
// Click visibility icon
@ -110,9 +102,9 @@ test.describe('Register Page', () => {
const usernameInput = page.locator('label').filter({ hasText: 'ชื่อผู้ใช้ (Username)' }).locator('input');
await usernameInput.fill(username);
await page.locator('input[type="email"]').fill(email);
await page.locator('label').filter({ hasText: 'อีเมล' }).locator('input').fill(email);
const passwordInput = page.locator('label').filter({ hasText: 'รหัสผ่าน *' }).locator('input');
const passwordInput = page.getByRole('textbox', { name: 'รหัสผ่าน *', exact: true });
await passwordInput.fill(password);
const confirmInput = page.locator('label').filter({ hasText: 'ยืนยันรหัสผ่าน' }).locator('input');