45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
|
|
import { fakerEN, fakerTH } from '@faker-js/faker';
|
||
|
|
import test, { expect, Page } from '@playwright/test';
|
||
|
|
import { login } from './utils';
|
||
|
|
|
||
|
|
test.describe.configure({ mode: 'serial' });
|
||
|
|
|
||
|
|
let page: Page;
|
||
|
|
|
||
|
|
test.beforeAll(async ({ browser }) => {
|
||
|
|
page = await browser.newPage();
|
||
|
|
});
|
||
|
|
|
||
|
|
test.afterAll(async () => {
|
||
|
|
await page.close();
|
||
|
|
});
|
||
|
|
|
||
|
|
test('JWS_INST_001 - Login', async () => {
|
||
|
|
await login(page);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('JWS_INST_002 - Goto Institution', async () => {
|
||
|
|
await page.click('//span[text()="หน่วยงาน"]');
|
||
|
|
await expect(page).toHaveURL(/.*agencies-management/);
|
||
|
|
await page.waitForTimeout(5000);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('JWS_INST_003 - Click New Institution', async () => {
|
||
|
|
await page.click('i.q-icon.mdi.mdi-plus');
|
||
|
|
await expect(page.locator('div.col.text-subtitle1')).toContainText(
|
||
|
|
'เพิ่มหน่วยงาน',
|
||
|
|
);
|
||
|
|
await page.waitForTimeout(5000);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('JWS_INST_004 - Fill Form', async () => {
|
||
|
|
await page
|
||
|
|
.getByRole('textbox', { name: 'ชื่อหน่วยงาน' })
|
||
|
|
.fill(fakerTH.company.name());
|
||
|
|
await page
|
||
|
|
.getByRole('textbox', { name: 'Agencies Name' })
|
||
|
|
.fill(fakerEN.company.name());
|
||
|
|
fakerEN.location.buildingNumber();
|
||
|
|
await page.waitForTimeout(5000);
|
||
|
|
});
|