test : Create Script Role&Permission
This commit is contained in:
parent
5bc28bf893
commit
9254c0183e
67 changed files with 11224 additions and 729 deletions
167
reports.json
Normal file
167
reports.json
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
{
|
||||||
|
"config": {
|
||||||
|
"configFile": "/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/playwright.config.ts",
|
||||||
|
"rootDir": "/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests",
|
||||||
|
"forbidOnly": false,
|
||||||
|
"fullyParallel": true,
|
||||||
|
"globalSetup": null,
|
||||||
|
"globalTeardown": null,
|
||||||
|
"globalTimeout": 0,
|
||||||
|
"grep": {},
|
||||||
|
"grepInvert": null,
|
||||||
|
"maxFailures": 0,
|
||||||
|
"metadata": {
|
||||||
|
"actualWorkers": 1
|
||||||
|
},
|
||||||
|
"preserveOutput": "always",
|
||||||
|
"reporter": [
|
||||||
|
[
|
||||||
|
"json",
|
||||||
|
{
|
||||||
|
"outputFile": "reports.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"reportSlowTests": {
|
||||||
|
"max": 5,
|
||||||
|
"threshold": 15000
|
||||||
|
},
|
||||||
|
"quiet": false,
|
||||||
|
"projects": [
|
||||||
|
{
|
||||||
|
"outputDir": "/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/test-results",
|
||||||
|
"repeatEach": 1,
|
||||||
|
"retries": 0,
|
||||||
|
"metadata": {},
|
||||||
|
"id": "chromium",
|
||||||
|
"name": "chromium",
|
||||||
|
"testDir": "/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests",
|
||||||
|
"testIgnore": [],
|
||||||
|
"testMatch": [
|
||||||
|
"**/*.@(spec|test).?(c|m)[jt]s?(x)"
|
||||||
|
],
|
||||||
|
"timeout": 30000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"shard": null,
|
||||||
|
"updateSnapshots": "missing",
|
||||||
|
"version": "1.44.1",
|
||||||
|
"workers": 1,
|
||||||
|
"webServer": null
|
||||||
|
},
|
||||||
|
"suites": [
|
||||||
|
{
|
||||||
|
"title": "01-Admin-BranchManagement/JWS_BM_001_CreateHeadquarters.spec.ts",
|
||||||
|
"file": "01-Admin-BranchManagement/JWS_BM_001_CreateHeadquarters.spec.ts",
|
||||||
|
"column": 0,
|
||||||
|
"line": 0,
|
||||||
|
"specs": [
|
||||||
|
{
|
||||||
|
"title": "Login",
|
||||||
|
"ok": true,
|
||||||
|
"tags": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"timeout": 30000,
|
||||||
|
"annotations": [],
|
||||||
|
"expectedStatus": "passed",
|
||||||
|
"projectId": "chromium",
|
||||||
|
"projectName": "chromium",
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"workerIndex": 4,
|
||||||
|
"status": "passed",
|
||||||
|
"duration": 3024,
|
||||||
|
"errors": [],
|
||||||
|
"stdout": [],
|
||||||
|
"stderr": [],
|
||||||
|
"retry": 0,
|
||||||
|
"startTime": "2024-07-30T02:59:00.817Z",
|
||||||
|
"attachments": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": "expected"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "8c5091bd59605f227965-8109f0f4a59e27330a76",
|
||||||
|
"file": "01-Admin-BranchManagement/JWS_BM_001_CreateHeadquarters.spec.ts",
|
||||||
|
"line": 16,
|
||||||
|
"column": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Create Branch Managenment",
|
||||||
|
"ok": true,
|
||||||
|
"tags": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"timeout": 30000,
|
||||||
|
"annotations": [],
|
||||||
|
"expectedStatus": "passed",
|
||||||
|
"projectId": "chromium",
|
||||||
|
"projectName": "chromium",
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"workerIndex": 4,
|
||||||
|
"status": "passed",
|
||||||
|
"duration": 5091,
|
||||||
|
"errors": [],
|
||||||
|
"stdout": [],
|
||||||
|
"stderr": [],
|
||||||
|
"retry": 0,
|
||||||
|
"startTime": "2024-07-30T02:59:05.659Z",
|
||||||
|
"attachments": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": "expected"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "8c5091bd59605f227965-5a0d70f27623401a3479",
|
||||||
|
"file": "01-Admin-BranchManagement/JWS_BM_001_CreateHeadquarters.spec.ts",
|
||||||
|
"line": 27,
|
||||||
|
"column": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Create Branch Managenment Second",
|
||||||
|
"ok": true,
|
||||||
|
"tags": [],
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"timeout": 30000,
|
||||||
|
"annotations": [],
|
||||||
|
"expectedStatus": "passed",
|
||||||
|
"projectId": "chromium",
|
||||||
|
"projectName": "chromium",
|
||||||
|
"results": [
|
||||||
|
{
|
||||||
|
"workerIndex": 4,
|
||||||
|
"status": "passed",
|
||||||
|
"duration": 5029,
|
||||||
|
"errors": [],
|
||||||
|
"stdout": [],
|
||||||
|
"stderr": [],
|
||||||
|
"retry": 0,
|
||||||
|
"startTime": "2024-07-30T02:59:10.755Z",
|
||||||
|
"attachments": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"status": "expected"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "8c5091bd59605f227965-d619bd2184e7f07d4970",
|
||||||
|
"file": "01-Admin-BranchManagement/JWS_BM_001_CreateHeadquarters.spec.ts",
|
||||||
|
"line": 52,
|
||||||
|
"column": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"errors": [],
|
||||||
|
"stats": {
|
||||||
|
"startTime": "2024-07-30T02:59:00.334Z",
|
||||||
|
"duration": 15556.794999999925,
|
||||||
|
"expected": 3,
|
||||||
|
"skipped": 0,
|
||||||
|
"unexpected": 0,
|
||||||
|
"flaky": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
181
tests/00-Role&Permission/JWS_RP_001_CorporateCustomer.spec.ts
Normal file
181
tests/00-Role&Permission/JWS_RP_001_CorporateCustomer.spec.ts
Normal file
|
|
@ -0,0 +1,181 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Corporate Customer', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'corporatecus');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_0');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'บุญมา');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'พามา');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Bunma');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Pama');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill(
|
||||||
|
'id=form-dialog-personnel-input-email',
|
||||||
|
'cocustomer@mail.com',
|
||||||
|
);
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-24']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='บุญมา พามา']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('บุญมา พามา');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Corporate Customer ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'corporatecus');
|
||||||
|
await page.fill("input[name='password']", 'corporatecus');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'corporcu@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Corporate Customer']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Corporate Customer');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Corporate Customer');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Corporate Customer ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Corporate Cutomer สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
185
tests/00-Role&Permission/JWS_RP_002_HeadOfAdmin.spec.ts
Normal file
185
tests/00-Role&Permission/JWS_RP_002_HeadOfAdmin.spec.ts
Normal file
|
|
@ -0,0 +1,185 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Head of Admin', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'headofad');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_1');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'ธนินทร์');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'ประเสริฐปัตตนา');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Thanin');
|
||||||
|
await page.fill(
|
||||||
|
'id=form-dialog-personnel-input-last-name-en',
|
||||||
|
'Prasertpattana',
|
||||||
|
);
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'hoa@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ธนินทร์ ประเสริฐปัตตนา']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('ธนินทร์ ประเสริฐปัตตนา');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Head of Admin ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'headofad');
|
||||||
|
await page.fill("input[name='password']", 'headofad');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'headofadmin@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Head Of Admin']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Head Of Admin');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Head of Admin');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Head of Admin ปรากฏ
|
||||||
|
const menuBranchManagement = await page.isVisible('id=drawer-menu.branch');
|
||||||
|
const menuPersonnelManagement = await page.isVisible('id=drawer-menu.user');
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuBranchManagement).toBe(true);
|
||||||
|
expect(menuPersonnelManagement).toBe(true);
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Head of Admin สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
184
tests/00-Role&Permission/JWS_RP_003_Sale.spec.ts
Normal file
184
tests/00-Role&Permission/JWS_RP_003_Sale.spec.ts
Normal file
|
|
@ -0,0 +1,184 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Sale', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'sale');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_2');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'เกียรติ');
|
||||||
|
await page.fill(
|
||||||
|
'id=form-dialog-personnel-input-last-name',
|
||||||
|
'อินทรประสิทธิ์ ',
|
||||||
|
);
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Kiat');
|
||||||
|
await page.fill(
|
||||||
|
'id=form-dialog-personnel-input-last-name-en',
|
||||||
|
'Intaraprasith',
|
||||||
|
);
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'sale@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='เกียรติ อินทรประสิทธิ์']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('เกียรติ อินทรประสิทธิ์');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Sale ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'sale');
|
||||||
|
await page.fill("input[name='password']", 'sale');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'sale@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Sale']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Sale');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Sale');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Sale ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Sale สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
178
tests/00-Role&Permission/JWS_RP_004_DocumentChecker.spec.ts
Normal file
178
tests/00-Role&Permission/JWS_RP_004_DocumentChecker.spec.ts
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Document Checker', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'doccheck');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_3');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'พสธร');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'เลิศวิทยา');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Possathorn');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Lertwittaya');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'doccheck@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='พสธร เลิศวิทยา']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('พสธร เลิศวิทยา');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Document Checker ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'doccheck');
|
||||||
|
await page.fill("input[name='password']", 'doccheck');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'docchecker@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Document Checker']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Document Checker');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Document Checker');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Document Checker ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Document Checker สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
178
tests/00-Role&Permission/JWS_RP_005_SaleAgent.spec.ts
Normal file
178
tests/00-Role&Permission/JWS_RP_005_SaleAgent.spec.ts
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Sale Agent', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'saleag');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_4');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'ภาสกร');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'อุดมเสก');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Passorn');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Udomsek');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'saleag@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ภาสกร อุดมเสก']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('ภาสกร อุดมเสก');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Sale Agent ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'saleag');
|
||||||
|
await page.fill("input[name='password']", 'saleag');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'saleag@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Sale Agent']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Sale Agent');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Sale Agent');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Sale Agent ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Sale Agent สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
178
tests/00-Role&Permission/JWS_RP_006_Messenger.spec.ts
Normal file
178
tests/00-Role&Permission/JWS_RP_006_Messenger.spec.ts
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Messenger', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'message');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_5');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'ธนัท');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'จรัสวงศ์');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Thanat');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Jaraswong');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'message@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ธนัท จรัสวงศ์']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('ธนัท จรัสวงศ์');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Messenger ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'message');
|
||||||
|
await page.fill("input[name='password']", 'message');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'message@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Messenger']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Messenger');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Messenger');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Messenger ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Messenger สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
176
tests/00-Role&Permission/JWS_RP_007_Account.spec.ts
Normal file
176
tests/00-Role&Permission/JWS_RP_007_Account.spec.ts
Normal file
|
|
@ -0,0 +1,176 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Account', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'account');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_6');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'ธาวัน');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'บุญดี');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Thawan');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Boondee');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'account@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("//div[@id='2024-09-08']/div[1]");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ธาวัน บุญดี']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('ธาวัน บุญดี');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Account ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'account');
|
||||||
|
await page.fill("input[name='password']", 'account');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'account@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Account']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Account');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Account');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Account ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Account สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
180
tests/00-Role&Permission/JWS_RP_008_Admin.spec.ts
Normal file
180
tests/00-Role&Permission/JWS_RP_008_Admin.spec.ts
Normal file
|
|
@ -0,0 +1,180 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Admin', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'admins');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_7');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'ธีรญาณ');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'สุขเกษม');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Theerayan');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Sukkasem');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'admin@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("//div[@id='2024-09-08']/div[1]");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ธีรญาณ สุขเกษม']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('ธีรญาณ สุขเกษม');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Admin ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'admins');
|
||||||
|
await page.fill("input[name='password']", 'admins');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'admins@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Admin']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Admin');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Admin');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Admin ปรากฏ
|
||||||
|
const menuBranchManagement = await page.isVisible('id=drawer-menu.branch');
|
||||||
|
const menuPersonnelManagement = await page.isVisible('id=drawer-menu.user');
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuBranchManagement).toBe(true);
|
||||||
|
expect(menuPersonnelManagement).toBe(true);
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Admin สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
179
tests/00-Role&Permission/JWS_RP_009_Executive.spec.ts
Normal file
179
tests/00-Role&Permission/JWS_RP_009_Executive.spec.ts
Normal file
|
|
@ -0,0 +1,179 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Executive', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'executive');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_8');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'ทีปกร');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'สุวรรณเวชธาดา');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Teepakorn');
|
||||||
|
await page.fill(
|
||||||
|
'id=form-dialog-personnel-input-last-name-en',
|
||||||
|
'Suwanwechatada',
|
||||||
|
);
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'executive@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("//div[@id='2024-09-08']/div[1]");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ทีปกร สุวรรณเวชธาดา']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('ทีปกร สุวรรณเวชธาดา');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Executive ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'executive');
|
||||||
|
await page.fill("input[name='password']", 'executive');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'executive@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Executive']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Executive');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Executive');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Executive ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Executive สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
176
tests/00-Role&Permission/JWS_RP_010_DataEntry.spec.ts
Normal file
176
tests/00-Role&Permission/JWS_RP_010_DataEntry.spec.ts
Normal file
|
|
@ -0,0 +1,176 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Data Entry', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'dataentry');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_9');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'กนกพงศ์');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'ดุสิตวรรณ');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Kanokpong');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Dusitwan');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'dataen@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("//div[@id='2024-09-08']/div[1]");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='กนกพงศ์ ดุสิตวรรณ']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('กนกพงศ์ ดุสิตวรรณ');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Data Entry ', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'dataentry');
|
||||||
|
await page.fill("input[name='password']", 'dataentry');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'dataen@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Data Entry']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Data Entry');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Data Entry');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Data Entry ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Data Entry สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
178
tests/00-Role&Permission/JWS_RP_011_HeadOfAccount.spec.ts
Normal file
178
tests/00-Role&Permission/JWS_RP_011_HeadOfAccount.spec.ts
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Head of Account', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'headacc');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_10');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'ฐิติกร');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'วงวรางค์');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Thitikorn');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Wongwarang');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'headac@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("//div[@id='2024-09-08']/div[1]");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ฐิติกร วงวรางค์']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('ฐิติกร วงวรางค์');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Head of Account', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'headacc');
|
||||||
|
await page.fill("input[name='password']", 'headacc');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'headac@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Head Of Account']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Head Of Account');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Head of Account');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Head of Account ปรากฏ
|
||||||
|
const menuBranchManagement = await page.isVisible('id=drawer-menu.branch');
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuBranchManagement).toBe(true);
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Head of Account สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
179
tests/00-Role&Permission/JWS_RP_012_HeadOfSale.spec.ts
Normal file
179
tests/00-Role&Permission/JWS_RP_012_HeadOfSale.spec.ts
Normal file
|
|
@ -0,0 +1,179 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Head of Sale', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'headsale');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_11');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'พลภัทร');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'ธนเจริญกิจ');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Polapat');
|
||||||
|
await page.fill(
|
||||||
|
'id=form-dialog-personnel-input-last-name-en',
|
||||||
|
'Tanajaroenkij',
|
||||||
|
);
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'headsale@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("//div[@id='2024-09-08']/div[1]");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='พลภัทร ธนเจริญกิจ']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('พลภัทร ธนเจริญกิจ');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Head of Sale', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'headsale');
|
||||||
|
await page.fill("input[name='password']", 'headsale');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'headsale@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Head Of Sale']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Head Of Sale');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Head of Sale');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Head of Sale ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Head of Sale สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
179
tests/00-Role&Permission/JWS_RP_013_PersonalCustomer.spec.ts
Normal file
179
tests/00-Role&Permission/JWS_RP_013_PersonalCustomer.spec.ts
Normal file
|
|
@ -0,0 +1,179 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Personal Customer', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'personal');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_12');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'ทีปกร');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'จันทรประการ');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Teepakorn');
|
||||||
|
await page.fill(
|
||||||
|
'id=form-dialog-personnel-input-last-name-en',
|
||||||
|
'Jantaraprakarn',
|
||||||
|
);
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'personal@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("//div[@id='2024-09-08']/div[1]");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ทีปกร จันทรประการ']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('ทีปกร จันทรประการ');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Personal Customer', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'personal');
|
||||||
|
await page.fill("input[name='password']", 'personal');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'personal@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Personal Customer']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Personal Customer');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Personal Customer');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Personal Customer ปรากฏ
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Personal Customer สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
178
tests/00-Role&Permission/JWS_RP_014_BranchManager.spec.ts
Normal file
178
tests/00-Role&Permission/JWS_RP_014_BranchManager.spec.ts
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ตำแหน่ง Branch Manager', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกข้อมูลพื้นฐานของบุคคลากร
|
||||||
|
await page.click("//i[@aria-hidden='false']");
|
||||||
|
await page.waitForSelector('id=select-hq-id', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=select-hq-id');
|
||||||
|
await page.click("//span[normalize-space(text())='CMO00000']");
|
||||||
|
await page.waitForSelector('id=select-br-id', { state: 'visible' });
|
||||||
|
await page.click('id=select-br-id');
|
||||||
|
await page.click('id=select-br-id_4');
|
||||||
|
await page.fill('id=input-username', 'branch');
|
||||||
|
await page.click('id=select-user-type');
|
||||||
|
await page.click('id=select-user-type_0');
|
||||||
|
await page.click('id=select-user-role');
|
||||||
|
await page.click('id=select-user-role_13');
|
||||||
|
// await page.click("//div[@role='option']");
|
||||||
|
|
||||||
|
// กรอกชื่อข้อมูลพื้นฐาน
|
||||||
|
await page.fill('id=input-citizen-id', '1282262422820');
|
||||||
|
await page.click("//label[@for='form-dialog-personnel-select-prefix-name']");
|
||||||
|
await page.click('id=form-dialog-personnel-select-prefix-name_0');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name', 'จิรัณ');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name', 'ดุสิตวรรณ');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'Jiran');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'Dusitwan');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-telephone', '08422644482');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'branch@mail.com');
|
||||||
|
|
||||||
|
// เลือกเพศ
|
||||||
|
await page.click('id=form-dialog-personnel-select-gender');
|
||||||
|
await page.click("//span[text()='ชาย']");
|
||||||
|
|
||||||
|
// เลือกวันเกิด
|
||||||
|
await page.click('id=form-dialog-personnel-input-birth-date');
|
||||||
|
await page.click("//div[@id='2024-09-08']/div[1]");
|
||||||
|
|
||||||
|
// วันออกบัตร วันที่หมออายุ
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-issue'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-02']");
|
||||||
|
await page.click(
|
||||||
|
"(//input[@id='form-dialog-personnel-input-citizen-expire'])[1]",
|
||||||
|
);
|
||||||
|
await page.click("//div[@id='2024-09-17']/div[1]");
|
||||||
|
|
||||||
|
// กรอกที่อยู่
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-no', '20/1');
|
||||||
|
await page.click('id=drawer-info-personnel-select-province');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-province_6', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-province_6');
|
||||||
|
await page.click('id=drawer-info-personnel-select-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-district_2', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-district_2');
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district');
|
||||||
|
await page.waitForSelector('id=drawer-info-personnel-select-sub-district_1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=drawer-info-personnel-select-sub-district_1');
|
||||||
|
|
||||||
|
// กรอกที่อยู่ภาษาอังกฤษ
|
||||||
|
await page.fill('id=drawer-info-personnel-input-address-en', '20/01');
|
||||||
|
|
||||||
|
// กรอกข้อมูลการทำงาน
|
||||||
|
await page.fill('id=input-regis-no', '2822282222421');
|
||||||
|
await page.click('id=input-start-date');
|
||||||
|
await page.click("//div[@id='2024-09-12']/div[1]");
|
||||||
|
await page.click('id=input-retire-date');
|
||||||
|
await page.click("//div[@id='2024-09-16']/div[1]");
|
||||||
|
|
||||||
|
// กดปุ่มเพื่อสร้างบุคคลากร
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงข้อมูลจาก Locator และนำ .textContent() เพื่อดึงมาแต่ข้อความจริง ๆ
|
||||||
|
await page.waitForSelector;
|
||||||
|
const displayNameLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='จิรัณ ดุสิตวรรณ']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const displayName = (await displayNameLocator.textContent())?.trim() || '';
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลที่ดึงออกมา
|
||||||
|
expect(displayName).toBe('จิรัณ ดุสิตวรรณ');
|
||||||
|
console.log(displayName);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการสร้างตำแหน่งงานถูกต้อง');
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเข้าใช้งาน ผู้ใช้งานสิทธิ์ Branch Manager', async () => {
|
||||||
|
try {
|
||||||
|
// ออกจากระบบและเข้าสู่ระบบด้วย Role ใหม่
|
||||||
|
await page.click('id=btn-profile-menu');
|
||||||
|
await page.click('id=btn-logout');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.fill("input[name='username']", 'branch');
|
||||||
|
await page.fill("input[name='password']", 'branch');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
|
||||||
|
// ใส่รหัสใหม่
|
||||||
|
await page.fill('id=password-new', '1234');
|
||||||
|
await page.fill('id=password-confirm', '1234');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
|
||||||
|
// กรอกอีเมลเพื่อสร้างผู้ใช้งานใหม่
|
||||||
|
await page.fill('id=email', 'branch@email.com');
|
||||||
|
await page.click("//input[@type='submit']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลหลังจากทำการเข้าสู่ระบบ
|
||||||
|
const useRole = await page
|
||||||
|
.locator("//div[normalize-space(text())='Branch Manager']")
|
||||||
|
.textContent();
|
||||||
|
expect(useRole?.trim()).toBe('Branch Manager');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสำเร็จ : สิทธิ์ผู้ใช้งานประเภท Branch Manager');
|
||||||
|
|
||||||
|
// ตรวจสอบเมนูสำหรับสิทธิ์ผู้ใช้งานประเภท Branch Manager ปรากฏ
|
||||||
|
const menuPersonnelManagement = await page.isVisible('id=drawer-menu.user');
|
||||||
|
const menuCustomerManagement = await page.isVisible(
|
||||||
|
'id=drawer-menu.customer',
|
||||||
|
);
|
||||||
|
const menuProductAndService = await page.isVisible(
|
||||||
|
'id=drawer-menu.product',
|
||||||
|
);
|
||||||
|
const menuDocumentManagement = await page.isVisible('id=drawer-menu.dms');
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเมนูปรากฏ
|
||||||
|
expect(menuPersonnelManagement).toBe(true);
|
||||||
|
expect(menuCustomerManagement).toBe(true);
|
||||||
|
expect(menuProductAndService).toBe(true);
|
||||||
|
expect(menuDocumentManagement).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบเมนูต่าง ๆ ของ สิทธิ์ Branch Manager สำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
});
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { test, expect, Page } from '@playwright/test';
|
import { test, expect, Page } from '@playwright/test';
|
||||||
import { strictEqual } from 'assert';
|
import path from 'path';
|
||||||
|
import { off } from 'process';
|
||||||
|
|
||||||
let page: Page;
|
let page: Page;
|
||||||
|
|
||||||
|
|
@ -25,19 +26,167 @@ test('Login', async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Branch Managenment', async () => {
|
test('Create Branch Managenment', async () => {
|
||||||
await page.click('id=menu-icon-branch-management');
|
try {
|
||||||
await page.click('id=hq-add-btn');
|
await page.click('id=menu-icon-branch-management');
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
await page.click('id=hq-add-btn');
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
// await page.click('id=btn-Add');
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
// await page.click("(//div[@class='q-avatar relative-position'])[2]");
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
// const fileInput = page.locator(
|
||||||
await page.click("//div[@role='option']");
|
// "//div[@class='image-dialog-body']//button[1]",
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
// );
|
||||||
await page.click("//span[text()='เมือง']");
|
// await fileInput.waitFor({ state: 'visible' });
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
// // อัปโหลดไฟล์
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
// await fileInput.setInputFiles(
|
||||||
await page.click('id=submitBtn');
|
// '/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests/Datafile/Pic1.jpg',
|
||||||
|
// ); // เปลี่ยน path ให้ตรง
|
||||||
|
|
||||||
|
// await page.setInputFiles(
|
||||||
|
// "//div[@class='image-dialog-body']//button[1]",
|
||||||
|
// '/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests/Datafile/Pic1.jpg',
|
||||||
|
// );
|
||||||
|
// // UploadFile
|
||||||
|
|
||||||
|
// ส่วนข้อมูลพื้นฐาน
|
||||||
|
await page.fill("(//input[@id='input-abbreviation'])[2]", 'CMM');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
||||||
|
await page.fill("(//input[@id='input-name'])[3]", 'บริษัท คาโมมายด์ จำกัด');
|
||||||
|
await page.fill("(//input[@id='input-name-en'])[2]", 'CHAMOMIND');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@aria-label='เลขที่ใบอนุญาต'])[2]",
|
||||||
|
'1228222822822',
|
||||||
|
);
|
||||||
|
|
||||||
|
// ส่วนติดต่อ
|
||||||
|
await page.fill("(//input[@id='input-email'])[2]", 'cmm@support.com');
|
||||||
|
await page.fill("(//input[@id='input-telephone-no'])[2]", '022222262');
|
||||||
|
await page.fill("(//input[@id='input-contact-name'])[2]", 'คุณต่อ');
|
||||||
|
await page.fill("(//input[@id='input-contact'])[2]", '0866224228');
|
||||||
|
await page.fill("(//input[@id='input-line-id'])[2]", 'local2024');
|
||||||
|
|
||||||
|
// ส่วนที่อยู่
|
||||||
|
await page.fill("(//input[@id='default-input-address-no'])[2]", '20/02');
|
||||||
|
await page.fill("(//input[@id='default-input-moo'])[3]", '1');
|
||||||
|
await page.click("(//input[@id='default-select-province'])[2]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-district'])[2]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-sub-district'])[2]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='default-input-address-en'])[2]", '20/02');
|
||||||
|
await page.fill("(//input[@aria-label='Moo'])[2]", '1');
|
||||||
|
|
||||||
|
//ส ส่วนบัญชีธนาคาร
|
||||||
|
await page.click("(//input[@id='select-bankbook'])[3]");
|
||||||
|
await page.click('id=select-bankbook_1');
|
||||||
|
await page.fill("(//input[@aria-label='เลขบัญชี'])[2]", '1202282262226');
|
||||||
|
await page.fill("(//input[@aria-label='สาขาธนาคาร'])[2]", 'เชียงใหม่');
|
||||||
|
await page.fill("(//input[@aria-label='ชื่อบัญชี'])[2]", 'Pongpon Kuntana');
|
||||||
|
await page.click("(//input[@aria-label='ประเภทบัญชี'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-bankbook_0');
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
await page.waitForSelector('id=btn-ok-dialog');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
|
||||||
|
// ตรวจสอบความถูกต้องหลังจากทำการบันทึกสร้างสำนักงานใหญ่
|
||||||
|
const newOfficeLocator = page.locator(
|
||||||
|
"//td[contains(.,'บริษัท คาโมมายด์ จำกัดCMM00000')]",
|
||||||
|
);
|
||||||
|
await newOfficeLocator.waitFor({ state: 'visible' });
|
||||||
|
|
||||||
|
// ดึงข้อความจาก <td> ที่ตรงกับ XPath
|
||||||
|
const newOfficeName = await newOfficeLocator.textContent();
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเนื้อหาที่บันทึกถูกต้อง
|
||||||
|
if (newOfficeName !== null) {
|
||||||
|
const trimmedName = newOfficeName.trim();
|
||||||
|
expect(trimmedName).toBe('บริษัท คาโมมายด์ จำกัดCMM00000');
|
||||||
|
console.log('การตรวจสอบสำเร็จ: ข้อมูลถูกต้อง');
|
||||||
|
} else {
|
||||||
|
throw new Error('ไม่พบข้อมูลที่บันทึกใน <td>');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Branch Managenment Second', async () => {
|
||||||
|
try {
|
||||||
|
// ส่วนข้อมูลพื้นฐาน
|
||||||
|
await page.click('id=hq-add-btn');
|
||||||
|
await page.fill("(//input[@id='input-abbreviation'])[2]", 'CMO');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
||||||
|
await page.fill("(//input[@id='input-name'])[3]", 'บริษัท โคโม่ จำกัด');
|
||||||
|
await page.fill("(//input[@id='input-name-en'])[2]", 'COMO');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@aria-label='เลขที่ใบอนุญาต'])[2]",
|
||||||
|
'1228222822822',
|
||||||
|
);
|
||||||
|
|
||||||
|
// ส่วนติดต่อ
|
||||||
|
await page.fill("(//input[@id='input-email'])[2]", 'como@support.com');
|
||||||
|
await page.fill("(//input[@id='input-telephone-no'])[2]", '022010100');
|
||||||
|
await page.fill("(//input[@id='input-contact-name'])[2]", 'คุณอาท');
|
||||||
|
await page.fill("(//input[@id='input-contact'])[2]", '0866224228');
|
||||||
|
await page.fill("(//input[@id='input-line-id'])[2]", 'como20');
|
||||||
|
|
||||||
|
// ส่วนที่อยู่
|
||||||
|
await page.fill("(//input[@id='default-input-address-no'])[2]", '40/04');
|
||||||
|
await page.fill("(//input[@id='default-input-moo'])[3]", '2');
|
||||||
|
await page.click("(//input[@id='default-select-province'])[2]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-district'])[2]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-sub-district'])[2]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='default-input-address-en'])[2]", '40/04');
|
||||||
|
await page.fill("(//input[@aria-label='Moo'])[2]", '1');
|
||||||
|
|
||||||
|
// ส่วนธนาคาร
|
||||||
|
await page.click("(//input[@id='select-bankbook'])[3]");
|
||||||
|
await page.click('id=select-bankbook_4');
|
||||||
|
await page.fill("(//input[@aria-label='เลขบัญชี'])[2]", '2022822624262');
|
||||||
|
await page.fill("(//input[@aria-label='สาขาธนาคาร'])[2]", 'ลำพูน');
|
||||||
|
await page.fill("(//input[@aria-label='ชื่อบัญชี'])[2]", 'Pongpon Kuntana');
|
||||||
|
await page.click("(//input[@aria-label='ประเภทบัญชี'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-bankbook_0');
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
await page.waitForSelector('id=btn-ok-dialog');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
|
||||||
|
// ตรวจสอบความถูกต้องหลังจากทำการบันทึกสร้างสำนักงานใหญ่
|
||||||
|
const newOfficeLocator = page.locator(
|
||||||
|
"//td[contains(.,'บริษัท โคโม่ จำกัดCMO00000')]",
|
||||||
|
);
|
||||||
|
await newOfficeLocator.waitFor({ state: 'visible' });
|
||||||
|
|
||||||
|
// ดึงข้อความจาก <td> ที่ตรงกับ XPath
|
||||||
|
const newOfficeName = await newOfficeLocator.textContent();
|
||||||
|
|
||||||
|
// ตรวจสอบว่าเนื้อหาที่บันทึกถูกต้อง
|
||||||
|
if (newOfficeName !== null) {
|
||||||
|
const trimmedName = newOfficeName.trim();
|
||||||
|
expect(trimmedName).toBe('บริษัท โคโม่ จำกัดCMO00000');
|
||||||
|
console.log('การตรวจสอบสำเร็จ: ข้อมูลถูกต้อง');
|
||||||
|
} else {
|
||||||
|
throw new Error('ไม่พบข้อมูลที่บันทึกใน <td>');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { test, expect, Page } from '@playwright/test';
|
import { test, expect, Page } from '@playwright/test';
|
||||||
import { strictEqual } from 'assert';
|
import { strictEqual } from 'assert';
|
||||||
|
import exp from 'constants';
|
||||||
|
|
||||||
let page: Page;
|
let page: Page;
|
||||||
|
|
||||||
|
|
@ -24,106 +25,122 @@ test('Login', async () => {
|
||||||
// await page.click('id=acceptBtn');
|
// await page.click('id=acceptBtn');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Branch Managenment Not input data', async () => {
|
test('Create Branch Management - ไม่มีการกรอกข้อมูล', async () => {
|
||||||
await page.click('id=menu-icon-branch-management');
|
await page.click('id=menu-icon-branch-management');
|
||||||
await page.click('id=hq-add-btn');
|
await page.click('id=hq-add-btn');
|
||||||
await page.click('id=submitBtn');
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
const abbreviationError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col'])[1]",
|
||||||
|
);
|
||||||
|
const taxNoError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[2]",
|
||||||
|
);
|
||||||
|
const nameError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[3]",
|
||||||
|
);
|
||||||
|
const nameEnError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[4]",
|
||||||
|
);
|
||||||
|
const LicenseNumberError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[5]",
|
||||||
|
);
|
||||||
|
const addressError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[6]",
|
||||||
|
);
|
||||||
|
const provinceError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[7]",
|
||||||
|
);
|
||||||
|
const districtError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[8]",
|
||||||
|
);
|
||||||
|
const subDistrictError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[9]",
|
||||||
|
);
|
||||||
|
const addressEnError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[10]",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(abbreviationError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้', {
|
||||||
|
timeout: 2000,
|
||||||
|
});
|
||||||
|
await expect(taxNoError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(nameError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(nameEnError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(LicenseNumberError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(addressError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(provinceError).toHaveText('โปรดเลือกจังหวัด');
|
||||||
|
await expect(districtError).toHaveText('โปรดเลือกอำเภอ');
|
||||||
|
await expect(subDistrictError).toHaveText('โปรดเลือกตำบล');
|
||||||
|
await expect(addressEnError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
|
||||||
await page.waitForTimeout(4000);
|
await page.waitForTimeout(4000);
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
await page.click('id=btn-form-cancel');
|
||||||
|
console.log('การตรวจสอบ Validation ถูกต้อง');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Branch Managenment Not input Tax', async () => {
|
test('Create Branch Managenment - กรณีที่กรอกชื่อย่อที่ไม่ใช่ภาษาอังกฤษ', async () => {
|
||||||
|
await page.reload();
|
||||||
await page.click('id=hq-add-btn');
|
await page.click('id=hq-add-btn');
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
await page.fill("(//input[@id='input-abbreviation'])[2]", 'ภาษาไทย');
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
const invalidDataabbreviationError = page.locator(
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
// ตรวจสอบการแสดง Validation แจ้งเตือนชื่อย่อในกรณีที่ไม่ใช้ภาษาอังกฤษ
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
"(//div[contains(@class,'q-field__bottom row')])[1]",
|
||||||
await page.click("//div[@role='option']");
|
);
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
|
||||||
await page.click("//span[text()='เมือง']");
|
await expect(invalidDataabbreviationError).toHaveText(
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
'ข้อมูลไม่ถูกต้อง โปรดใช้เฉพาะตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น',
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
{
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
timeout: 2000,
|
||||||
await page.click('id=submitBtn');
|
},
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่ไม่ใช่ภาษาอังกฤษถูกต้อง',
|
||||||
|
);
|
||||||
|
|
||||||
await page.waitForTimeout(4000);
|
await page.waitForTimeout(4000);
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
await page.click('id=btn-form-cancel');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Branch Managenment Not input Head Office Name Thai', async () => {
|
test('Create Branch Management - กรอกเลขนิติบุคคลในกรณีที่กรอกไม่ครบจำนวน 13 หลัก', async () => {
|
||||||
|
await page.reload();
|
||||||
await page.click('id=hq-add-btn');
|
await page.click('id=hq-add-btn');
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
await page.fill("(//input[@id='input-tax-no'])[2]", '123');
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
const taxNoError = page.locator(
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
// ตรวจสอบการแสดง Validation แจ้งเตือนชื่อย่อในกรณีที่ไม่ใช้ภาษาอังกฤษ
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
"(//div[@class='q-field__messages col']//div)[2]",
|
||||||
await page.click("//div[@role='option']");
|
);
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
|
||||||
await page.click("//span[text()='เมือง']");
|
await expect(taxNoError).toHaveText(
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
'ข้อมูลไม่ถูกต้อง กรุณากรอกให้ครบ 13 หลัก',
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
{
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
timeout: 2000,
|
||||||
await page.click('id=submitBtn');
|
},
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่กรอกทะเบียนนิติบุคคลเลขที่ไม่ครบ 13 หลัก',
|
||||||
|
);
|
||||||
|
|
||||||
await page.waitForTimeout(4000);
|
await page.waitForTimeout(4000);
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
await page.click('id=btn-form-cancel');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Branch Managenment Not input Head Office Name ENG', async () => {
|
test('Create Branch Management - กรอกอีเมลในกรณีที่ไม่ตรงรูปแบบอีเมล', async () => {
|
||||||
|
await page.reload();
|
||||||
await page.click('id=hq-add-btn');
|
await page.click('id=hq-add-btn');
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
await page.fill("(//input[@id='input-email'])[2]", '123');
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
const emailError = page.locator(
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
// ตรวจสอบการแสดง Validation แจ้งเตือนในกรณีที่กรอกอีเมลไม่ถูกรูปแบบ
|
||||||
await page.click("//div[@role='option']");
|
"(//div[@class='q-field__messages col']//div)[2]",
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
);
|
||||||
await page.click("//span[text()='เมือง']");
|
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Create Branch Managenment Not input Address TH ', async () => {
|
await expect(emailError).toHaveText('ข้อมูลไม่ถูกต้อง', {
|
||||||
await page.click('id=hq-add-btn');
|
timeout: 2000,
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
});
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
console.log(
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่กรอกอีเมลไม่ถูกรูปแบบ',
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
);
|
||||||
await page.click("//div[@role='option']");
|
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
|
||||||
await page.click("//span[text()='เมือง']");
|
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Create Branch Managenment Not input Address ENG', async () => {
|
|
||||||
await page.click('id=hq-add-btn');
|
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
|
||||||
await page.click("//div[@role='option']");
|
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
|
||||||
await page.click("//span[text()='เมือง']");
|
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
await page.waitForTimeout(4000);
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
await page.click('id=btn-form-cancel');
|
||||||
});
|
|
||||||
|
|
||||||
test('Create Branch Managenment Not Select Province,District,Sub-District', async () => {
|
|
||||||
await page.click('id=hq-add-btn');
|
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -25,21 +25,88 @@ test('Login', async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Sub Branch Managenment', async () => {
|
test('Create Sub Branch Managenment', async () => {
|
||||||
await page.click('id=menu-icon-branch-management');
|
try {
|
||||||
for (let i = 0; i < 10; i++) {
|
await page.click('id=menu-icon-branch-management');
|
||||||
await page.click('id=create-sub-branch-btn-สีลม');
|
for (let i = 0; i < 5; i++) {
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", `126084622028${i + 1}`);
|
await page.click('id=create-sub-branch-btn-บริษัท โคโม่ จำกัด');
|
||||||
await page.fill("(//input[@id='input-name'])[2]", `สีลม${i + 1}`);
|
await page.click("(//button[@type='submit'])[1]");
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", `Silom${i + 1}`);
|
|
||||||
await page.fill("(//input[@id='input-address'])[2]", `20/0${i + 1}`);
|
// ส่วนข้อมูลพื้นฐาน
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
await page.fill(
|
||||||
await page.click("//div[@role='option']");
|
"(//input[@id='input-tax-no'])[2]",
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
`126084622028${i + 1}`,
|
||||||
await page.click("//span[text()='เมือง']");
|
);
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
await page.fill("(//input[@id='input-name'])[3]", `สีลม${i + 1}`);
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
await page.fill("(//input[@id='input-name-en'])[2]", `Silom${i + 1}`);
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", `20/0${i + 1}`);
|
await page.fill(
|
||||||
await page.click('id=submitBtn');
|
"(//input[@aria-label='เลขที่ใบอนุญาต'])[2]",
|
||||||
|
'1228222822822',
|
||||||
|
);
|
||||||
|
|
||||||
|
// ส่วนติดต่อ
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-email'])[2]",
|
||||||
|
`host${i + 1}@local.co.th`,
|
||||||
|
);
|
||||||
|
await page.fill("(//input[@id='input-telephone-no'])[2]", '022222002');
|
||||||
|
await page.fill("(//input[@id='input-contact-name'])[2]", 'คุณอาท');
|
||||||
|
await page.fill("(//input[@id='input-contact'])[2]", `08622864${i + 1}`);
|
||||||
|
await page.fill("(//input[@id='input-line-id'])[2]", 'company');
|
||||||
|
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='default-input-address-no'])[2]",
|
||||||
|
`20/0${i + 1}`,
|
||||||
|
);
|
||||||
|
await page.click("(//input[@id='default-select-province'])[2]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-district'])[2]");
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-sub-district'])[2]");
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='default-input-address-en'])[2]",
|
||||||
|
`20/0${i + 1}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.click("(//input[@id='select-bankbook'])[3]");
|
||||||
|
await page.click(`id=select-bankbook_${i + 1}`);
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@aria-label='เลขบัญชี'])[2]",
|
||||||
|
`228202002${i + 1}`,
|
||||||
|
);
|
||||||
|
await page.fill("(//input[@aria-label='สาขาธนาคาร'])[2]", 'เชียงใหม่');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@aria-label='ชื่อบัญชี'])[2]",
|
||||||
|
'Pongpon Kuntana',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='ประเภทบัญชี'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-bankbook_0');
|
||||||
|
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ตรวจสอบความถูกต้องหลังจากทำการบันทึกสร้างสำนักงานใหญ่
|
||||||
|
const subBranchErrors = ['สีลม1', 'สีลม2', 'สีลม3', 'สีลม4', 'สีลม5'];
|
||||||
|
|
||||||
|
for (const branch of subBranchErrors) {
|
||||||
|
const subBranchErrors = page.locator(
|
||||||
|
`//div[normalize-space(text())='${branch}']`,
|
||||||
|
);
|
||||||
|
await subBranchErrors.waitFor({ state: 'visible' });
|
||||||
|
const newOfficeName = await subBranchErrors.textContent();
|
||||||
|
const trimmedName = newOfficeName?.trim();
|
||||||
|
|
||||||
|
expect(trimmedName).toBe(branch);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('การตรวจสอบสำเร็จ : ข้อมูลถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -24,106 +24,93 @@ test('Login', async () => {
|
||||||
// await page.click('id=acceptBtn');
|
// await page.click('id=acceptBtn');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Sub-Branch Managenment Not input data', async () => {
|
test('Create Sub-Branch Managenment - ในกรณีที่ไม่กรอกข้อมูล', async () => {
|
||||||
await page.click('id=menu-icon-branch-management');
|
await page.click('id=menu-icon-branch-management');
|
||||||
await page.click('id=create-sub-branch-btn-สีลม');
|
await page.click('id=create-sub-branch-btn-บริษัท โคโม่ จำกัด');
|
||||||
await page.click('id=submitBtn');
|
await page.click("(//button[@type='submit'])[1]");
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
const taxNoError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[1]",
|
||||||
|
);
|
||||||
|
const nameError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[2]",
|
||||||
|
);
|
||||||
|
const nameEnError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[3]",
|
||||||
|
);
|
||||||
|
const lincenseNumberError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[4]",
|
||||||
|
);
|
||||||
|
const addressError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[5]",
|
||||||
|
);
|
||||||
|
const provinceError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[6]",
|
||||||
|
);
|
||||||
|
const districtError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[7]",
|
||||||
|
);
|
||||||
|
const subDistrictError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[8]",
|
||||||
|
);
|
||||||
|
const addressEnError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[9]",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(taxNoError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(nameError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(nameEnError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(lincenseNumberError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(addressError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(provinceError).toHaveText('โปรดเลือกจังหวัด');
|
||||||
|
await expect(districtError).toHaveText('โปรดเลือกอำเภอ');
|
||||||
|
await expect(subDistrictError).toHaveText('โปรดเลือกตำบล');
|
||||||
|
await expect(addressEnError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
|
||||||
await page.waitForTimeout(4000);
|
await page.waitForTimeout(4000);
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
await page.click('id=btn-form-cancel');
|
||||||
|
console.log('การตรวจสอบ Validation ถูกต้อง');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Sub-Branch Managenment Not input Tax', async () => {
|
test('Create Sub-Branch Managenment - ในกรณีที่กรอกทะเบียนนิติบุคคลเลขที่ไม่ครบ 13 หลัก', async () => {
|
||||||
await page.click('id=create-sub-branch-btn-สีลม');
|
await page.reload();
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
await page.click('id=create-sub-branch-btn-บริษัท โคโม่ จำกัด');
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
await page.click("(//button[@type='submit'])[1]");
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
await page.fill("(//input[@id='input-tax-no'])[2]", '123');
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
|
||||||
await page.click("//div[@role='option']");
|
// ตรวจสอบการแจ้งเตือนของทะเบียนนิติบุคคลเลขที่ในกรณีที่กรอกข้อมูลไม่ครบ 13 หลัก
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
const taxNoError = page.locator(
|
||||||
await page.click("//span[text()='เมือง']");
|
"(//div[@class='q-field__messages col']//div)[1]",
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
);
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
await expect(taxNoError).toHaveText(
|
||||||
await page.click('id=submitBtn');
|
'ข้อมูลไม่ถูกต้อง กรุณากรอกให้ครบ 13 หลัก',
|
||||||
|
);
|
||||||
|
|
||||||
await page.waitForTimeout(4000);
|
await page.waitForTimeout(4000);
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
await page.click('id=btn-form-cancel');
|
||||||
|
console.log(
|
||||||
|
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่กรอกทะเบียนนิติบุคคลเลขที่ไม่ครบ 13 หลักถูกต้อง',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create Sub-Branch Managenment Not input Head Office Name Thai', async () => {
|
test('Create Sub-Branch Managenment - กรอกอีเมลในกรณีที่ไม่ตรงรูปแบบอีเมล', async () => {
|
||||||
await page.click('id=create-sub-branch-btn-สีลม');
|
await page.reload();
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
await page.click('id=create-sub-branch-btn-บริษัท โคโม่ จำกัด');
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
await page.click("(//button[@type='submit'])[1]");
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
await page.fill("(//input[@id='input-email'])[2]", 'email');
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
|
||||||
await page.click("//div[@role='option']");
|
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
|
||||||
await page.click("//span[text()='เมือง']");
|
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Create Sub-Branch Managenment Not input Head Office Name ENG', async () => {
|
// ตรวจสอบการแจ้งเตือนของทะเบียนนิติบุคคลเลขที่ในกรณีที่กรอกข้อมูลไม่ครบ 13 หลัก
|
||||||
await page.click('id=create-sub-branch-btn-สีลม');
|
const emailError = page.locator(
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
"(//div[@class='q-field__messages col']//div)[2]",
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
);
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
|
||||||
await page.click("//div[@role='option']");
|
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
|
||||||
await page.click("//span[text()='เมือง']");
|
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Create Sub-Branch Managenment Not input Address TH ', async () => {
|
await expect(emailError).toHaveText('ข้อมูลไม่ถูกต้อง');
|
||||||
await page.click('id=create-sub-branch-btn-สีลม');
|
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
|
||||||
await page.click("//div[@role='option']");
|
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
|
||||||
await page.click("//span[text()='เมือง']");
|
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Create Sub-Branch Managenment Not input Address ENG', async () => {
|
|
||||||
await page.click('id=create-sub-branch-btn-สีลม');
|
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
|
||||||
await page.click("(//div[@id='select-province'])[2]");
|
|
||||||
await page.click("//div[@role='option']");
|
|
||||||
await page.click("(//div[@id='select-district'])[2]");
|
|
||||||
await page.click("//span[text()='เมือง']");
|
|
||||||
await page.click("(//div[@id='select-sub-district'])[2]");
|
|
||||||
await page.click("//span[text()='ช้างเผือก']");
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
await page.waitForTimeout(4000);
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
await page.click('id=btn-form-cancel');
|
||||||
});
|
console.log(
|
||||||
|
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่กรอกอีเมลไม่ตรงรูปแบบถูกต้อง',
|
||||||
test('Create Sub-Branch Managenment Not Select Province,District,Sub-District', async () => {
|
);
|
||||||
await page.click('id=create-sub-branch-btn-สีลม');
|
|
||||||
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สีลม');
|
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Silom');
|
|
||||||
await page.fill("(//input[@id='input-address'])[2]", '20/02 ');
|
|
||||||
await page.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
|
||||||
await page.click('id=submitBtn');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
await page.click("(//button[@id='closeDialog'])[2]");
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Service Point Managenment', async () => {
|
||||||
|
try {
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
await page.click('id=create-sub-branch-btn-บริษัท คาโมมายด์ จำกัด');
|
||||||
|
await page.click("(//button[@type='submit'])[2]");
|
||||||
|
|
||||||
|
// ส่วนข้อมูลพื้นฐาน
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-tax-no'])[2]",
|
||||||
|
`202282628264${i + 1}`,
|
||||||
|
);
|
||||||
|
await page.fill("(//input[@id='input-name'])[3]", `บางรัก${i + 1}`);
|
||||||
|
await page.fill("(//input[@id='input-name-en'])[2]", `Bangrak${i + 1}`);
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@aria-label='เลขที่ใบอนุญาต'])[2]",
|
||||||
|
'1228222822822',
|
||||||
|
);
|
||||||
|
|
||||||
|
// ส่วนติดต่อ
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-email'])[2]",
|
||||||
|
`cmm${i + 1}@local.co.th`,
|
||||||
|
);
|
||||||
|
await page.fill("(//input[@id='input-telephone-no'])[2]", '022222002');
|
||||||
|
await page.fill("(//input[@id='input-contact-name'])[2]", 'คุณอุล');
|
||||||
|
await page.fill("(//input[@id='input-contact'])[2]", `082262286${i + 1}`);
|
||||||
|
await page.fill("(//input[@id='input-line-id'])[2]", 'cmmsupport');
|
||||||
|
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='default-input-address-no'])[2]",
|
||||||
|
`40/0${i + 1}`,
|
||||||
|
);
|
||||||
|
await page.click("(//input[@id='default-select-province'])[2]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-district'])[2]");
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-sub-district'])[2]");
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='default-input-address-en'])[2]",
|
||||||
|
`40/0${i + 1}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.click("(//input[@id='select-bankbook'])[3]");
|
||||||
|
await page.click(`id=select-bankbook_${i + 1}`);
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@aria-label='เลขบัญชี'])[2]",
|
||||||
|
`282264220${i + 1}`,
|
||||||
|
);
|
||||||
|
await page.fill("(//input[@aria-label='สาขาธนาคาร'])[2]", 'ลำพูน');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@aria-label='ชื่อบัญชี'])[2]",
|
||||||
|
'Pongpon Kuntana',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='ประเภทบัญชี'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-bankbook_0');
|
||||||
|
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ตรวจสอบความถูกต้องหลังจากทำการบันทึกสร้างสำนักงานใหญ่
|
||||||
|
const subBranchErrors = [
|
||||||
|
'บางรัก1',
|
||||||
|
'บางรัก2',
|
||||||
|
'บางรัก3',
|
||||||
|
'บางรัก4',
|
||||||
|
'บางรัก5',
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const branch of subBranchErrors) {
|
||||||
|
const subBranchErrors = page.locator(
|
||||||
|
`//div[normalize-space(text())='${branch}']`,
|
||||||
|
);
|
||||||
|
await subBranchErrors.waitFor({ state: 'visible' });
|
||||||
|
const newOfficeName = await subBranchErrors.textContent();
|
||||||
|
const trimmedName = newOfficeName?.trim();
|
||||||
|
|
||||||
|
expect(trimmedName).toBe(branch);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('การตรวจสอบสำเร็จ : ข้อมูลถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
import { test, expect, Page } from '@playwright/test';
|
|
||||||
import { strictEqual } from 'assert';
|
|
||||||
|
|
||||||
let page: Page;
|
|
||||||
|
|
||||||
test.beforeAll(async ({ browser }) => {
|
|
||||||
page = await browser.newPage();
|
|
||||||
});
|
|
||||||
|
|
||||||
test.afterAll(async () => {
|
|
||||||
if (page !== undefined) {
|
|
||||||
await page.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Login', async () => {
|
|
||||||
// Login
|
|
||||||
await page.goto('http://192.168.1.90:20001/');
|
|
||||||
await expect(page).toHaveTitle(/^Sign in to /);
|
|
||||||
await page.fill("input[name='username']", 'admin');
|
|
||||||
await page.fill("input[name='password']", '1234');
|
|
||||||
await page.click('id=kc-login');
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
// await page.click('id=acceptBtn');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Select Type Branch Name Out', async () => {
|
|
||||||
await page.click('id=menu-icon-branch-management');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[1]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Select Type Branch Telephone No. Out', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[2]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
test('Select Type Branch Address Out', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[3]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
test('Select Type Branch Type Out', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[4]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Select Type Branch Status Out', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[5]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Select Type Branch Name In', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[1]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Select Type Branch Telephone No. In', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[2]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
test('Select Type Branch Address In', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[3]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
test('Select Type Branch Type In', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[4]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Select Type Branch Status In', async () => {
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.click("//span[text()='ข้อมูลที่แสดง']");
|
|
||||||
await page.click("(//div[@role='option'])[5]");
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
});
|
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Service Point - ในกรณีที่ไม่กรอกข้อมูล', async () => {
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
await page.click('id=create-sub-branch-btn-บริษัท คาโมมายด์ จำกัด');
|
||||||
|
await page.click("(//button[@type='submit'])[2]");
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
const taxNoError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[1]",
|
||||||
|
);
|
||||||
|
const nameError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[2]",
|
||||||
|
);
|
||||||
|
const nameEnError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[3]",
|
||||||
|
);
|
||||||
|
const addressError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[4]",
|
||||||
|
);
|
||||||
|
const provinceError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[5]",
|
||||||
|
);
|
||||||
|
const districtError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[6]",
|
||||||
|
);
|
||||||
|
const subDistrictError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[7]",
|
||||||
|
);
|
||||||
|
const addressEnError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[8]",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(taxNoError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(nameError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(nameEnError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(addressError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(provinceError).toHaveText('โปรดเลือกจังหวัด');
|
||||||
|
await expect(districtError).toHaveText('โปรดเลือกอำเภอ');
|
||||||
|
await expect(subDistrictError).toHaveText('โปรดเลือกตำบล');
|
||||||
|
await expect(addressEnError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-form-cancel');
|
||||||
|
console.log('การตรวจสอบ Validation ถูกต้อง');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Service Point - ในกรณีที่กรอกทะเบียนนิติบุคคลเลขที่ไม่ครบ 13 หลัก', async () => {
|
||||||
|
await page.reload();
|
||||||
|
await page.click('id=create-sub-branch-btn-บริษัท คาโมมายด์ จำกัด');
|
||||||
|
await page.click("(//button[@type='submit'])[2]");
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[2]", '123');
|
||||||
|
|
||||||
|
// ตรวจสอบการแจ้งเตือนของทะเบียนนิติบุคคลเลขที่ในกรณีที่กรอกข้อมูลไม่ครบ 13 หลัก
|
||||||
|
const taxNoError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[1]",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(taxNoError).toHaveText(
|
||||||
|
'ข้อมูลไม่ถูกต้อง กรุณากรอกให้ครบ 13 หลัก',
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-form-cancel');
|
||||||
|
console.log(
|
||||||
|
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่กรอกทะเบียนนิติบุคคลเลขที่ไม่ครบ 13 หลักถูกต้อง',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Service Point - กรอกอีเมลในกรณีที่ไม่ตรงรูปแบบอีเมล', async () => {
|
||||||
|
await page.reload();
|
||||||
|
await page.click('id=create-sub-branch-btn-บริษัท คาโมมายด์ จำกัด');
|
||||||
|
await page.click("(//button[@type='submit'])[2]");
|
||||||
|
await page.fill("(//input[@id='input-email'])[2]", 'email');
|
||||||
|
|
||||||
|
// ตรวจสอบการแจ้งเตือนของทะเบียนนิติบุคคลเลขที่ในกรณีที่กรอกข้อมูลไม่ครบ 13 หลัก
|
||||||
|
const emailError = page.locator(
|
||||||
|
"(//div[@class='q-field__messages col']//div)[2]",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(emailError).toHaveText('ข้อมูลไม่ถูกต้อง');
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-form-cancel');
|
||||||
|
console.log(
|
||||||
|
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่กรอกอีเมลไม่ตรงรูปแบบถูกต้อง',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
import { test, expect, Page } from '@playwright/test';
|
|
||||||
import { strictEqual } from 'assert';
|
|
||||||
|
|
||||||
let page: Page;
|
|
||||||
|
|
||||||
test.beforeAll(async ({ browser }) => {
|
|
||||||
page = await browser.newPage();
|
|
||||||
});
|
|
||||||
|
|
||||||
test.afterAll(async () => {
|
|
||||||
if (page !== undefined) {
|
|
||||||
await page.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Login', async () => {
|
|
||||||
// Login
|
|
||||||
await page.goto('http://192.168.1.90:20001/');
|
|
||||||
await expect(page).toHaveTitle(/^Sign in to /);
|
|
||||||
await page.fill("input[name='username']", 'admin');
|
|
||||||
await page.fill("input[name='password']", '1234');
|
|
||||||
await page.click('id=kc-login');
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
// await page.click('id=acceptBtn');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Edit Branch', async () => {
|
|
||||||
await page.click('id=menu-icon-branch-management');
|
|
||||||
await page.click('id=view-detail-btn-สีลม');
|
|
||||||
await page.click('id=view-detail-btn-สีลม-edit');
|
|
||||||
await page.fill("(//input[@id='input-name'])[2]", 'สาทร');
|
|
||||||
await page.fill("(//input[@id='input-name-en'])[2]", 'Sathorn');
|
|
||||||
await page.click("(//button[@id='submitBtn'])[2]");
|
|
||||||
await page.click('id=view-detail-btn-สาทร');
|
|
||||||
await page.click('id=view-detail-btn-สาทร-view');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
});
|
|
||||||
|
|
@ -0,0 +1,387 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { watchFile } from 'fs';
|
||||||
|
import { waitForDebugger } from 'inspector';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงผลฟิลด์แสดงผลลำดับที่', async () => {
|
||||||
|
try {
|
||||||
|
// คลิกเมนูเพื่อจัดการสาขา
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อปิดคอลัมน์ที่ 1
|
||||||
|
await page.click('id=select-field_0');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์ถูกซ่อน
|
||||||
|
const column1 = page.locator('id=select-field_0');
|
||||||
|
const column1Cells = page.locator(
|
||||||
|
"//th[normalize-space(text())='ลำดับที่']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const isColumn1Hidden = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display === 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 1 ซ่อนอยู่:', isColumn1Hidden); // เช็ค
|
||||||
|
|
||||||
|
const areCellsHidden = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display === 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 1 ซ่อนอยู่:', areCellsHidden); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Hidden).toBe(false);
|
||||||
|
expect(areCellsHidden).toBe(true);
|
||||||
|
|
||||||
|
// คลิกอีกครั้งเพื่อเปิดคอลัมน์ที่ 1
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
await page.click('id=select-field_0'); // คลิกเพื่อเปิดคอลัมน์
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์แสดงอยู่
|
||||||
|
const isColumn1Visible = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display !== 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 1 แสดงอยู่:', isColumn1Visible); // เช็ค
|
||||||
|
|
||||||
|
const areCellsVisible = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display !== 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 1 แสดงอยู่:', areCellsVisible); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Visible).toBe(true);
|
||||||
|
expect(areCellsVisible).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการเปิด/ซ่อนคอลัมน์ในตารางสำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงผลฟิลด์แสดงผลชื่อ', async () => {
|
||||||
|
try {
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อปิดคอลัมน์ที่ 2
|
||||||
|
await page.click('id=select-field_1');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์ถูกซ่อน
|
||||||
|
const column1 = page.locator('id=select-field_1');
|
||||||
|
const column1Cells = page.locator(
|
||||||
|
"//th[normalize-space(text())='สำนักงาน']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const isColumn1Hidden = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display === 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 2 ซ่อนอยู่:', isColumn1Hidden); // เช็ค
|
||||||
|
|
||||||
|
const areCellsHidden = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display === 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 2 ซ่อนอยู่:', areCellsHidden); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Hidden).toBe(false);
|
||||||
|
expect(areCellsHidden).toBe(true);
|
||||||
|
|
||||||
|
// คลิกอีกครั้งเพื่อเปิดคอลัมน์ที่ 2
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
await page.click('id=select-field_1'); // คลิกเพื่อเปิดคอลัมน์
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์แสดงอยู่
|
||||||
|
const isColumn1Visible = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display !== 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 2 แสดงอยู่:', isColumn1Visible); // เช็ค
|
||||||
|
|
||||||
|
const areCellsVisible = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display !== 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 2 แสดงอยู่:', areCellsVisible); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Visible).toBe(true);
|
||||||
|
expect(areCellsVisible).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการเปิด/ซ่อนคอลัมน์ในตารางสำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงผลฟิลด์แสดงผลทะเบียนนิติบุคคล', async () => {
|
||||||
|
try {
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อปิดคอลัมน์ที่ 3
|
||||||
|
await page.click('id=select-field_2');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์ถูกซ่อน
|
||||||
|
const column1 = page.locator('id=select-field_2');
|
||||||
|
const column1Cells = page.locator(
|
||||||
|
"//th[normalize-space(text())='ทะเบียนนิติบุคคล']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const isColumn1Hidden = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display === 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 3 ซ่อนอยู่:', isColumn1Hidden); // เช็ค
|
||||||
|
|
||||||
|
const areCellsHidden = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display === 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 3 ซ่อนอยู่:', areCellsHidden); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Hidden).toBe(false);
|
||||||
|
expect(areCellsHidden).toBe(true);
|
||||||
|
|
||||||
|
// คลิกอีกครั้งเพื่อเปิดคอลัมน์ที่ 3
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
await page.click('id=select-field_2'); // คลิกเพื่อเปิดคอลัมน์
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์แสดงอยู่
|
||||||
|
const isColumn1Visible = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display !== 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 3 แสดงอยู่:', isColumn1Visible); // เช็ค
|
||||||
|
|
||||||
|
const areCellsVisible = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display !== 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 3 แสดงอยู่:', areCellsVisible); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Visible).toBe(true);
|
||||||
|
expect(areCellsVisible).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการเปิด/ซ่อนคอลัมน์ในตารางสำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงผลฟิลด์แสดงผลเบอร์โทรสำนักงาน', async () => {
|
||||||
|
try {
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อปิดคอลัมน์ที่ 4
|
||||||
|
await page.click('id=select-field_3');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์ถูกซ่อน
|
||||||
|
const column1 = page.locator('id=select-field_3');
|
||||||
|
const column1Cells = page.locator(
|
||||||
|
"//th[normalize-space(text())='เบอร์โทรสำนักงาน']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const isColumn1Hidden = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display === 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 4 ซ่อนอยู่:', isColumn1Hidden); // เช็ค
|
||||||
|
|
||||||
|
const areCellsHidden = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display === 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 4 ซ่อนอยู่:', areCellsHidden); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Hidden).toBe(false);
|
||||||
|
expect(areCellsHidden).toBe(true);
|
||||||
|
|
||||||
|
// คลิกอีกครั้งเพื่อเปิดคอลัมน์ที่ 4
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
await page.click('id=select-field_3'); // คลิกเพื่อเปิดคอลัมน์
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์แสดงอยู่
|
||||||
|
const isColumn1Visible = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display !== 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 4 แสดงอยู่:', isColumn1Visible); // เช็ค
|
||||||
|
|
||||||
|
const areCellsVisible = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display !== 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 4 แสดงอยู่:', areCellsVisible); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Visible).toBe(true);
|
||||||
|
expect(areCellsVisible).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการเปิด/ซ่อนคอลัมน์ในตารางสำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงผลฟิลด์แสดงผลติดต่อ', async () => {
|
||||||
|
try {
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อปิดคอลัมน์ที่ 5
|
||||||
|
await page.click('id=select-field_4');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์ถูกซ่อน
|
||||||
|
const column1 = page.locator('id=select-field_4');
|
||||||
|
const column1Cells = page.locator("//th[normalize-space(text())='ติดต่อ']");
|
||||||
|
|
||||||
|
const isColumn1Hidden = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display === 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 5 ซ่อนอยู่:', isColumn1Hidden); // เช็ค
|
||||||
|
|
||||||
|
const areCellsHidden = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display === 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 5 ซ่อนอยู่:', areCellsHidden); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Hidden).toBe(false);
|
||||||
|
expect(areCellsHidden).toBe(true);
|
||||||
|
|
||||||
|
// คลิกอีกครั้งเพื่อเปิดคอลัมน์ที่ 5
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
await page.click('id=select-field_4'); // คลิกเพื่อเปิดคอลัมน์
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์แสดงอยู่
|
||||||
|
const isColumn1Visible = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display !== 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 5 แสดงอยู่:', isColumn1Visible); // เช็ค
|
||||||
|
|
||||||
|
const areCellsVisible = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display !== 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 5 แสดงอยู่:', areCellsVisible); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Visible).toBe(true);
|
||||||
|
expect(areCellsVisible).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการเปิด/ซ่อนคอลัมน์ในตารางสำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงผลฟิลด์แสดงผลที่อยู่', async () => {
|
||||||
|
try {
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อปิดคอลัมน์ที่ 6
|
||||||
|
await page.click('id=select-field_5');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์ถูกซ่อน
|
||||||
|
const column1 = page.locator('id=select-field_5');
|
||||||
|
const column1Cells = page.locator(
|
||||||
|
"//th[normalize-space(text())='ที่อยู่']",
|
||||||
|
);
|
||||||
|
|
||||||
|
const isColumn1Hidden = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display === 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 6 ซ่อนอยู่:', isColumn1Hidden); // เช็ค
|
||||||
|
|
||||||
|
const areCellsHidden = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display === 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 6 ซ่อนอยู่:', areCellsHidden); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Hidden).toBe(false);
|
||||||
|
expect(areCellsHidden).toBe(true);
|
||||||
|
|
||||||
|
// คลิกอีกครั้งเพื่อเปิดคอลัมน์ที่ 6
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click("(//input[@id='select-field'])[1]");
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
await page.click('id=select-field_5'); // คลิกเพื่อเปิดคอลัมน์
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าคอลัมน์แสดงอยู่
|
||||||
|
const isColumn1Visible = await column1.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).display !== 'none',
|
||||||
|
);
|
||||||
|
console.log('คอลัมน์ที่ 6 แสดงอยู่:', isColumn1Visible); // เช็ค
|
||||||
|
|
||||||
|
const areCellsVisible = await column1Cells.evaluateAll((cells) =>
|
||||||
|
cells.every((cell) => window.getComputedStyle(cell).display !== 'none'),
|
||||||
|
);
|
||||||
|
console.log('เซลล์ในคอลัมน์ที่ 6 แสดงอยู่:', areCellsVisible); // เช็ค
|
||||||
|
|
||||||
|
expect(isColumn1Visible).toBe(true);
|
||||||
|
expect(areCellsVisible).toBe(true);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการเปิด/ซ่อนคอลัมน์ในตารางสำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
import { test, expect, Page } from '@playwright/test';
|
|
||||||
import { strictEqual } from 'assert';
|
|
||||||
|
|
||||||
let page: Page;
|
|
||||||
|
|
||||||
test.beforeAll(async ({ browser }) => {
|
|
||||||
page = await browser.newPage();
|
|
||||||
});
|
|
||||||
|
|
||||||
test.afterAll(async () => {
|
|
||||||
if (page !== undefined) {
|
|
||||||
await page.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Login', async () => {
|
|
||||||
// Login
|
|
||||||
await page.goto('http://192.168.1.90:20001/');
|
|
||||||
await expect(page).toHaveTitle(/^Sign in to /);
|
|
||||||
await page.fill("input[name='username']", 'admin');
|
|
||||||
await page.fill("input[name='password']", '1234');
|
|
||||||
await page.click('id=kc-login');
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
// await page.click('id=acceptBtn');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Close Status Branch Headquater', async () => {
|
|
||||||
await page.click('id=menu-icon-branch-management');
|
|
||||||
await page.click('id=view-detail-btn-สาทร');
|
|
||||||
await page.click(
|
|
||||||
"//div[contains(@class,'q-toggle__inner relative-position')]",
|
|
||||||
);
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Open Status Branch Headquater', async () => {
|
|
||||||
await page.click('id=view-detail-btn-สาทร');
|
|
||||||
await page.click(
|
|
||||||
"//div[contains(@class,'q-toggle__inner relative-position')]",
|
|
||||||
);
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Close Status Sub-Branch Headquater', async () => {
|
|
||||||
await page.click(
|
|
||||||
"(//div[contains(@class,'q-tree__node-header relative-position')])[3]",
|
|
||||||
);
|
|
||||||
await page.click('id=branch-card-สาทร');
|
|
||||||
await page.click('id=view-detail-btn-สีลม3');
|
|
||||||
await page.click(
|
|
||||||
"//div[contains(@class,'q-toggle__inner relative-position')]",
|
|
||||||
);
|
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
await page.keyboard.press('Escape');
|
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
});
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('View Detail Headquter Branch', async () => {
|
||||||
|
try {
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
await page.click('id=btn-kebab-action-บริษัท โคโม่ จำกัด');
|
||||||
|
await page.click('id=btn-kebab-view-detail-บริษัท โคโม่ จำกัด');
|
||||||
|
|
||||||
|
const detailTitle = page.locator(
|
||||||
|
"//span[text()='บริษัท โคโม่ จำกัด ']/following-sibling::span",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(detailTitle).toHaveText('CMO00000'); // เลขรหัสสำนักงานใหญ่
|
||||||
|
|
||||||
|
console.log('ตรวจสอบข้อมูลถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('View Detail Sub Branch', async () => {
|
||||||
|
try {
|
||||||
|
await page.click("(//div[@id='tree-enter-บริษัท โคโม่ จำกัด']//div)[1]");
|
||||||
|
await page.click('id=btn-kebab-action-สีลม1');
|
||||||
|
await page.click('id=btn-kebab-view-detail-สีลม1');
|
||||||
|
|
||||||
|
const detailTitle = page.locator("//span[text()='สีลม1 ']");
|
||||||
|
|
||||||
|
await detailTitle.waitFor({ state: 'visible' });
|
||||||
|
|
||||||
|
await expect(detailTitle).toHaveText('สีลม1'); // เลขรหัสสำนักงานใหญ่
|
||||||
|
|
||||||
|
console.log('ตรวจสอบข้อมูลถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('View Detail Service Point', async () => {
|
||||||
|
try {
|
||||||
|
await page.click("//div[@id='tree-enter-บริษัท คาโมมายด์ จำกัด']/div[1]");
|
||||||
|
await page.click('id=btn-kebab-action-บางรัก1');
|
||||||
|
await page.click('id=btn-kebab-view-detail-บางรัก1');
|
||||||
|
|
||||||
|
const detailTitle = page.locator("//span[text()='บางรัก1 ']");
|
||||||
|
|
||||||
|
await detailTitle.waitFor({ state: 'visible' });
|
||||||
|
|
||||||
|
await expect(detailTitle).toHaveText('บางรัก1'); // เลขรหัสสำนักงานใหญ่
|
||||||
|
|
||||||
|
console.log('ตรวจสอบข้อมูลถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
129
tests/01-Admin-BranchManagement/JWS_BM_009_EditBranch.spec.ts
Normal file
129
tests/01-Admin-BranchManagement/JWS_BM_009_EditBranch.spec.ts
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import exp from 'constants';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Headquter Branch', async () => {
|
||||||
|
try {
|
||||||
|
// แก้ไขสำนักงานใหญ่
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
await page.click('id=btn-kebab-action-บริษัท โคโม่ จำกัด');
|
||||||
|
await page.click('id=btn-kebab-edit-บริษัท โคโม่ จำกัด');
|
||||||
|
await page.fill('id=input-name', 'บริษัท โคโมโดะ จำกัด');
|
||||||
|
await page.fill('id=input-name-en', 'COMODO');
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
|
||||||
|
//ตรวจสอบรายละเอียดการแก้ไข
|
||||||
|
await page.click('id=btn-kebab-action-บริษัท โคโมโดะ จำกัด');
|
||||||
|
await page.click('id=btn-kebab-view-detail-บริษัท โคโมโดะ จำกัด');
|
||||||
|
|
||||||
|
//ตรวจสอบว่าได้ทำการแก้ไขถูกต้องหรือไม่
|
||||||
|
const detailEditName = await page.inputValue(
|
||||||
|
"//input[@value='บริษัท โคโมโดะ จำกัด']",
|
||||||
|
);
|
||||||
|
const detailEditNameEn = await page.inputValue(
|
||||||
|
"//input[@aria-label='ชื่อสำนักงานใหญ่ (EN)']",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(detailEditName).toBe('บริษัท โคโมโดะ จำกัด');
|
||||||
|
await expect(detailEditNameEn).toBe('COMODO');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการแก้ไขข้อมูลสำนักงานใหญ่ถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Sub Branch', async () => {
|
||||||
|
try {
|
||||||
|
// แก้ไขสำนักงานใหญ่
|
||||||
|
await page.click("//div[@id='tree-enter-บริษัท โคโมโดะ จำกัด']/div[1]");
|
||||||
|
await page.waitForSelector('id=btn-kebab-action-สีลม1', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-action-สีลม1');
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click('id=btn-kebab-edit-สีลม1');
|
||||||
|
await page.fill('id=input-name', 'สินสาทร');
|
||||||
|
await page.fill('id=input-name-en', 'Sinsathorn');
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
|
||||||
|
//ตรวจสอบรายละเอียดการแก้ไข
|
||||||
|
await page.click('id=btn-kebab-action-สินสาทร');
|
||||||
|
await page.click('id=btn-kebab-view-detail-สินสาทร');
|
||||||
|
|
||||||
|
//ตรวจสอบว่าได้ทำการแก้ไขถูกต้องหรือไม่
|
||||||
|
const detailEditName = await page.inputValue("//input[@value='สินสาทร']");
|
||||||
|
const detailEditNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Sinsathorn']",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(detailEditName).toBe('สินสาทร');
|
||||||
|
await expect(detailEditNameEn).toBe('Sinsathorn');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการแก้ไขข้อมูลสาขาถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Visual Branch', async () => {
|
||||||
|
try {
|
||||||
|
// แก้ไขสำนักงานใหญ่
|
||||||
|
await page.click("//div[@id='tree-enter-บริษัท คาโมมายด์ จำกัด']/div[1]");
|
||||||
|
await page.click('id=btn-kebab-action-บางรัก1');
|
||||||
|
await page.click('id=btn-kebab-edit-บางรัก1');
|
||||||
|
await page.fill('id=input-name', 'บางจาก');
|
||||||
|
await page.fill('id=input-name-en', 'Bangjak');
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
|
||||||
|
//ตรวจสอบรายละเอียดการแก้ไข
|
||||||
|
await page.click('id=btn-kebab-action-บางจาก');
|
||||||
|
await page.click('id=btn-kebab-view-detail-บางจาก');
|
||||||
|
|
||||||
|
//ตรวจสอบว่าได้ทำการแก้ไขถูกต้องหรือไม่
|
||||||
|
const detailEditName = await page.inputValue("//input[@value='บางจาก']");
|
||||||
|
const detailEditNameEn = await page.inputValue("//input[@value='Bangjak']");
|
||||||
|
|
||||||
|
await expect(detailEditName).toBe('บางจาก');
|
||||||
|
await expect(detailEditNameEn).toBe('Bangjak');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการแก้ไขข้อมูลสาขาเสมือนถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงผลสถานะการใช้งาน เปิด/ปิด สำนักงานใหญ่', async () => {
|
||||||
|
try {
|
||||||
|
// คลิกเมนูเพื่อจัดการสาขา
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
|
||||||
|
// แสดงสถานะที่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังใช้งานอยู่
|
||||||
|
await page.click('id=field-select-status_1');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะใช้งานหรือไม่
|
||||||
|
const statusActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะกำลังใช้งานเท่านั้น');
|
||||||
|
|
||||||
|
// แสดงสถานะที่ไม่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังไม่ใช้งาน
|
||||||
|
await page.click('id=field-select-status_2');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะไม่ใช้งานหรือไม่
|
||||||
|
const statusInActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusInActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะที่ไม่ใช้งาน');
|
||||||
|
|
||||||
|
// แสดงสถานะทั้งหมด
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะทั้งหมด
|
||||||
|
await page.click('id=field-select-status_0');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าแสดงทุกสถานะหรือไม่
|
||||||
|
const statusAll = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('สถานะทั้งหมด', statusAll); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะทั้งหมด');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
// test('ตรวจสอบการแสดงผลสถานะการใช้งาน เปิด/ปิด สาขา', async () => {
|
||||||
|
// try {
|
||||||
|
// // คลิกเข้าสู่สาขา
|
||||||
|
// await page.click("//div[@id='tree-enter-บริษัท โคโมโดะ จำกัด']/div[1]");
|
||||||
|
|
||||||
|
// // แสดงสถานะที่ใช้งาน
|
||||||
|
// // คลิกเพื่อเปิด dropdown
|
||||||
|
// await page.click('id=field-select-status');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// // คลิกเพื่อแสดงสถานะกำลังใช้งานอยู่
|
||||||
|
// await page.click('id=field-select-status_1');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// // ตรวจสอบว่ามีแต่สถานะใช้งานหรือไม่
|
||||||
|
// const statusActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
// console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusActive); // เช็ค
|
||||||
|
|
||||||
|
// expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
// console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะกำลังใช้งานเท่านั้น');
|
||||||
|
|
||||||
|
// // แสดงสถานะที่ไม่ใช้งาน
|
||||||
|
// // คลิกเพื่อเปิด dropdown
|
||||||
|
// await page.keyboard.press('Escape');
|
||||||
|
// await page.click('id=field-select-status');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// // คลิกเพื่อแสดงสถานะกำลังไม่ใช้งาน
|
||||||
|
// await page.click('id=field-select-status_2');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// // ตรวจสอบว่ามีแต่สถานะไม่ใช้งานหรือไม่
|
||||||
|
// const statusInActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
// console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusInActive); // เช็ค
|
||||||
|
|
||||||
|
// expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
// console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะที่ไม่ใช้งาน');
|
||||||
|
|
||||||
|
// // แสดงสถานะทั้งหมด
|
||||||
|
// // คลิกเพื่อเปิด dropdown
|
||||||
|
// await page.keyboard.press('Escape');
|
||||||
|
// await page.click('id=field-select-status');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// // คลิกเพื่อแสดงสถานะทั้งหมด
|
||||||
|
// await page.click('id=field-select-status_0');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// // ตรวจสอบว่าแสดงทุกสถานะหรือไม่
|
||||||
|
// const statusAll = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
// console.log('สถานะทั้งหมด', statusAll); // เช็ค
|
||||||
|
|
||||||
|
// expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
// console.log('ตรวจสอบสถานะทั้งหมด');
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
// throw error;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// await page.waitForTimeout(2000);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// test('ตรวจสอบการแสดงผลสถานะการใช้งาน เปิด/ปิด จุดรับบริการ', async () => {
|
||||||
|
// try {
|
||||||
|
// // คลิกเข้าสู่สาขาเสมือน
|
||||||
|
// await page.click("//div[@id='tree-enter-บริษัท คาโมมายด์ จำกัด']/div[1]");
|
||||||
|
|
||||||
|
// // แสดงสถานะที่ใช้งาน
|
||||||
|
// // คลิกเพื่อเปิด dropdown
|
||||||
|
// await page.click('id=field-select-status');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// // คลิกเพื่อแสดงสถานะกำลังใช้งานอยู่
|
||||||
|
// await page.click('id=field-select-status_1');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// // ตรวจสอบว่ามีแต่สถานะใช้งานหรือไม่
|
||||||
|
// const statusActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
// console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusActive); // เช็ค
|
||||||
|
|
||||||
|
// expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
// console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะกำลังใช้งานเท่านั้น');
|
||||||
|
|
||||||
|
// // แสดงสถานะที่ไม่ใช้งาน
|
||||||
|
// // คลิกเพื่อเปิด dropdown
|
||||||
|
// await page.keyboard.press('Escape');
|
||||||
|
// await page.click('id=field-select-status');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// // คลิกเพื่อแสดงสถานะกำลังไม่ใช้งาน
|
||||||
|
// await page.click('id=field-select-status_2');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// // ตรวจสอบว่ามีแต่สถานะไม่ใช้งานหรือไม่
|
||||||
|
// const statusInActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
// console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusInActive); // เช็ค
|
||||||
|
|
||||||
|
// expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
// console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะที่ไม่ใช้งาน');
|
||||||
|
|
||||||
|
// // แสดงสถานะทั้งหมด
|
||||||
|
// // คลิกเพื่อเปิด dropdown
|
||||||
|
// await page.keyboard.press('Escape');
|
||||||
|
// await page.click('id=field-select-status');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// // คลิกเพื่อแสดงสถานะทั้งหมด
|
||||||
|
// await page.click('id=field-select-status_0');
|
||||||
|
// await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// // ตรวจสอบว่าแสดงทุกสถานะหรือไม่
|
||||||
|
// const statusAll = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
// console.log('สถานะทั้งหมด', statusAll); // เช็ค
|
||||||
|
|
||||||
|
// expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
// console.log('ตรวจสอบสถานะทั้งหมด');
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
// throw error;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// await page.waitForTimeout(2000);
|
||||||
|
// });
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Search Data Branch Management', async () => {
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// กำหนดคำที่จะค้นหา
|
||||||
|
const searchDatas = [
|
||||||
|
'โคโมโดะ',
|
||||||
|
'คาโมมายด์',
|
||||||
|
'CM',
|
||||||
|
'CMO',
|
||||||
|
'00000',
|
||||||
|
'บางจาก',
|
||||||
|
'บางรัก',
|
||||||
|
'สีลม1',
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const searchData of searchDatas) {
|
||||||
|
// พิมพ์คำที่ต้องการค้นหา
|
||||||
|
await page.fill('id=input-search', searchData); // ดึงคำมาจาก searchDatas
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
// ดึงผลลัพฑ์การค้นหาทั้งหมด
|
||||||
|
const searchResults = page.locator("//table[@class='q-table']//tbody[1]");
|
||||||
|
const resultCount = await searchResults.count();
|
||||||
|
|
||||||
|
// ถ้าไม่มีผลลัพธ์ให้ข้ามคำถัดไป
|
||||||
|
if (resultCount === 0) {
|
||||||
|
console.error(`ไม่พบการค้นหา: '${searchData}', ข้ามไปคำถัดไป`);
|
||||||
|
continue; // ข้ามคำค้นหาคำถัดไป
|
||||||
|
}
|
||||||
|
|
||||||
|
// ดึงข้อความทั้งหมดของผลลัพธ์การค้นหา
|
||||||
|
const searchResultTexts = await searchResults.allTextContents();
|
||||||
|
console.log(`ผลลัพธ์ของการค้นหา '${searchData}'`, searchDatas);
|
||||||
|
|
||||||
|
// ตรวจสอบว่าผลลัพธ์ทั้งหมดมีคำที่ค้นหาหรือไม่
|
||||||
|
const allResultContainSearchData = searchResultTexts.every((result) =>
|
||||||
|
result.includes(searchData),
|
||||||
|
);
|
||||||
|
|
||||||
|
// ถ้าไม่พบคำค้นหา ให้แค่แจ้งเตือนและข้ามไปคำถัดไป
|
||||||
|
if (!allResultContainSearchData) {
|
||||||
|
console.error(
|
||||||
|
`\x1b[31mผลลัพธ์บางรายการไม่ตรงกับคำค้นหา: '${searchData}', ข้ามไปคำถัดไป\x1b[0m`,
|
||||||
|
);
|
||||||
|
continue; // ข้ามไปคำค้นหาถัดไป
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(allResultContainSearchData).toBe(true);
|
||||||
|
|
||||||
|
console.log(`การค้นหา '${searchData}' และการแสดงผลสำเร็จ`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบการค้นหาหลายคำค้นหา', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ปิดการใช้งานสำนักงานใหญ่', async () => {
|
||||||
|
try {
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
await page.click('id=btn-kebab-action-บริษัท คาโมมายด์ จำกัด');
|
||||||
|
|
||||||
|
await page.click('id=btn-kebab-status-บริษัท คาโมมายด์ จำกัด', {
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
console.log('เปลี่ยนสถานะสำเร็จ');
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
// รอ Update
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
console.log('สถานะถูกเปลี่ยนแล้ว');
|
||||||
|
|
||||||
|
// ตรวจสอบสีของแถวหลังจากทำการเปลี่ยนสถานะ
|
||||||
|
const rowLocator = page.locator(
|
||||||
|
"//td[contains(.,'บริษัท คาโมมายด์ จำกัดCMM00000')]",
|
||||||
|
);
|
||||||
|
const backgroundColor = await rowLocator.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).backgroundColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
// กำหนดสีหลัเปลี่ยนสถานะการใช้งาน
|
||||||
|
const expectedColor = 'rgb(249, 250, 252)';
|
||||||
|
|
||||||
|
// ตรวจสอบสีที่เปลี่ยนไป
|
||||||
|
expect(backgroundColor.trim()).toBe(expectedColor);
|
||||||
|
console.log('สีของแถวถูกเปลี่ยนเป็นสีเทาอ่อน');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('เปิดการใช้งานสำนักงานใหญ่', async () => {
|
||||||
|
try {
|
||||||
|
await page.click('id=btn-kebab-action-บริษัท คาโมมายด์ จำกัด');
|
||||||
|
|
||||||
|
await page.click('id=btn-kebab-status-บริษัท คาโมมายด์ จำกัด', {
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
console.log('เปลี่ยนสถานะสำเร็จ');
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
// รอ Update
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
console.log('สถานะถูกเปลี่ยนแล้ว');
|
||||||
|
|
||||||
|
// ตรวจสอบสีของแถวหลังจากทำการเปลี่ยนสถานะ
|
||||||
|
const rowLocator = page.locator(
|
||||||
|
"//td[contains(.,'บริษัท คาโมมายด์ จำกัดCMM00000')]",
|
||||||
|
);
|
||||||
|
const backgroundColor = await rowLocator.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).backgroundColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
// กำหนดสีหลัเปลี่ยนสถานะการใช้งาน
|
||||||
|
const expectedColor = 'rgba(0, 0, 0, 0)';
|
||||||
|
|
||||||
|
// ตรวจสอบสีที่เปลี่ยนไป
|
||||||
|
expect(backgroundColor.trim()).toBe(expectedColor);
|
||||||
|
console.log('สีของแถวถูกเปลี่ยนเป็นของสถานะการใช้งาน');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
217
tests/01-Admin-BranchManagement/JWS_BM_013_DeleteBranch.spec.ts
Normal file
217
tests/01-Admin-BranchManagement/JWS_BM_013_DeleteBranch.spec.ts
Normal file
|
|
@ -0,0 +1,217 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { Console, error, log } from 'console';
|
||||||
|
import exp from 'constants';
|
||||||
|
import { it } from 'node:test';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการลบจัดการสาขา', async () => {
|
||||||
|
await page.click('id=menu-icon-branch-management');
|
||||||
|
|
||||||
|
// จำลองการสร้างสำนักงานใหญ่
|
||||||
|
|
||||||
|
await page.click('id=hq-add-btn');
|
||||||
|
await page.fill("(//input[@id='input-abbreviation'])[2]", 'TES');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
||||||
|
await page.fill("(//input[@id='input-name'])[2]", 'บริษัท จำลอง จำกัด');
|
||||||
|
await page.fill("(//input[@id='input-name-en'])[2]", 'JOMLONG');
|
||||||
|
await page.fill("(//input[@id='input-email'])[2]", 'JOM@support.com');
|
||||||
|
await page.fill("(//input[@id='input-telephone-no'])[2]", '022010100');
|
||||||
|
await page.fill("(//input[@id='input-contact-name'])[2]", 'คุณอาท');
|
||||||
|
await page.fill("(//input[@id='input-contact'])[2]", '0866224228');
|
||||||
|
await page.fill("(//input[@id='input-line-id'])[2]", 'como20');
|
||||||
|
await page.fill("(//input[@id='default-input-address'])[2]", '40/04');
|
||||||
|
await page.click("(//input[@id='default-select-province'])[2]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-district'])[2]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-sub-district'])[2]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='default-input-address-en'])[2]", '40/04');
|
||||||
|
await page.click("(//input[@id='select-bankbook'])[3]");
|
||||||
|
await page.click('id=select-bankbook_4');
|
||||||
|
await page.fill("(//input[@aria-label='เลขบัญชี'])[2]", '2022822624262');
|
||||||
|
await page.fill("(//input[@aria-label='สาขาธนาคาร'])[2]", 'ลำพูน');
|
||||||
|
await page.fill("(//input[@aria-label='ชื่อบัญชี'])[2]", 'Pongpon Kuntana');
|
||||||
|
await page.click("(//input[@aria-label='ประเภทบัญชี'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-bankbook_0');
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
await page.waitForSelector('id=btn-ok-dialog');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
|
||||||
|
// จำลองการสร้างสาขา
|
||||||
|
|
||||||
|
await page.click('id=create-sub-branch-btn-บริษัท จำลอง จำกัด');
|
||||||
|
await page.click("(//button[@type='submit'])[1]");
|
||||||
|
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[2]", '1260846220281');
|
||||||
|
await page.fill("(//input[@id='input-name'])[3]", 'สาขาจำลอง');
|
||||||
|
await page.fill("(//input[@id='input-name-en'])[2]", 'SAKAJOMLONG');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@aria-label='เลขที่ใบอนุญาต'])[2]",
|
||||||
|
'1228222822822',
|
||||||
|
);
|
||||||
|
await page.fill("(//input[@id='input-email'])[2]", 'test@support.com');
|
||||||
|
await page.fill("(//input[@id='input-telephone-no'])[2]", '022222002');
|
||||||
|
await page.fill("(//input[@id='input-contact-name'])[2]", 'คุณอาท');
|
||||||
|
await page.fill("(//input[@id='input-contact'])[2]", '0822262228');
|
||||||
|
await page.fill("(//input[@id='input-line-id'])[2]", 'company');
|
||||||
|
|
||||||
|
await page.fill("(//input[@id='default-input-address-no'])[2]", '20/02');
|
||||||
|
await page.click("(//input[@id='default-select-province'])[2]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-district'])[2]");
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-sub-district'])[2]");
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='default-input-address-en'])[2]", '20/02');
|
||||||
|
|
||||||
|
await page.click("(//input[@id='select-bankbook'])[3]");
|
||||||
|
await page.click('id=select-bankbook_1');
|
||||||
|
await page.fill("(//input[@aria-label='เลขบัญชี'])[2]", '2282020021');
|
||||||
|
await page.fill("(//input[@aria-label='สาขาธนาคาร'])[2]", 'เชียงใหม่');
|
||||||
|
await page.fill("(//input[@aria-label='ชื่อบัญชี'])[2]", 'Pongpon Kuntana');
|
||||||
|
await page.click("(//input[@aria-label='ประเภทบัญชี'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-bankbook_0');
|
||||||
|
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
// จำลองการสร้างสาขาเสมือน
|
||||||
|
|
||||||
|
await page.click('id=create-sub-branch-btn-บริษัท จำลอง จำกัด');
|
||||||
|
await page.click("(//button[@type='submit'])[2]");
|
||||||
|
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[2]", '2022826282642');
|
||||||
|
await page.fill("(//input[@id='input-name'])[2]", 'สาขาเสมือน');
|
||||||
|
await page.fill("(//input[@id='input-name-en'])[2]", 'VISUALBRANCH');
|
||||||
|
await page.fill("(//input[@id='input-email'])[2]", 'visual@local.co.th');
|
||||||
|
await page.fill("(//input[@id='input-telephone-no'])[2]", '022222002');
|
||||||
|
await page.fill("(//input[@id='input-contact-name'])[2]", 'คุณอุล');
|
||||||
|
await page.fill("(//input[@id='input-contact'])[2]", '0822622862');
|
||||||
|
await page.fill("(//input[@id='input-line-id'])[2]", 'cmmsupport');
|
||||||
|
|
||||||
|
await page.fill("(//input[@id='default-input-address'])[2]", '40/04');
|
||||||
|
await page.click("(//input[@id='default-select-province'])[2]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-district'])[2]");
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//input[@id='default-select-sub-district'])[2]");
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='default-input-address-en'])[2]", '40/04');
|
||||||
|
|
||||||
|
await page.click("(//input[@id='select-bankbook'])[3]");
|
||||||
|
await page.click('id=select-bankbook_2');
|
||||||
|
await page.fill("(//input[@aria-label='เลขบัญชี'])[2]", '2822642201');
|
||||||
|
await page.fill("(//input[@aria-label='สาขาธนาคาร'])[2]", 'ลำพูน');
|
||||||
|
await page.fill("(//input[@aria-label='ชื่อบัญชี'])[2]", 'Pongpon Kuntana');
|
||||||
|
await page.click("(//input[@aria-label='ประเภทบัญชี'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-bankbook_0');
|
||||||
|
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
// ลบสาขาและตรวจสอบการลบสาขา
|
||||||
|
try {
|
||||||
|
await page.click('id=btn-kebab-action-สาขาจำลอง');
|
||||||
|
await page.click('id=btn-kebab-delete-สาขาจำลอง');
|
||||||
|
|
||||||
|
// ยืนยันการลบ
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
|
// ตรวจสอบการลบสาขา
|
||||||
|
const itemLocator = page.locator(
|
||||||
|
"//tr[contains(.,'1 สาขาจำลองTES0000112608462202810822262228คุณอาท20/02')]",
|
||||||
|
);
|
||||||
|
|
||||||
|
// ตรวจสอบว่าถูกลบออกจากระบบหรือไม่
|
||||||
|
await expect(itemLocator).toBeHidden();
|
||||||
|
|
||||||
|
console.log('ตรวจสอบข้อมูลการลบสาขาสำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการลบสาขา', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ลบสาขาเสมือนและตรวจสอบการลบสาขาเสมือน
|
||||||
|
|
||||||
|
try {
|
||||||
|
await page.click('id=btn-kebab-action-สาขาเสมือน');
|
||||||
|
await page.click('id=btn-kebab-delete-สาขาเสมือน');
|
||||||
|
|
||||||
|
// ยืนยันการลบ
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
|
||||||
|
// ตรวจสอบการลบสาขาเสมือน
|
||||||
|
const itemLocator = page.locator(
|
||||||
|
"//tr[contains(.,'2 สาขาเสมือนTES0000220228262826420822622862คุณอุล40/04')]",
|
||||||
|
);
|
||||||
|
|
||||||
|
// ตรวจสอบว่าถูกลบออกจากระบบหรือไม่
|
||||||
|
await expect(itemLocator).toBeHidden();
|
||||||
|
|
||||||
|
console.log('ตรวจสอบข้อมูลการลบสาขาเสมือนสำเร็จ');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการลบสาขาเสมือน', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// // ลบสำนักงานใหญ่และตรวจสอบการลบสำนักงานใหญ่
|
||||||
|
|
||||||
|
// await page.click("//div[@id='tree-enter-บริษัท จำลอง จำกัด']/div[1]");
|
||||||
|
// try {
|
||||||
|
// await page.click('id=btn-kebab-action-บริษัท จำลอง จำกัด');
|
||||||
|
// await page.click('id=btn-kebab-delete-บริษัท จำลอง จำกัด');
|
||||||
|
|
||||||
|
// // ยืนยันการลบ
|
||||||
|
// await page.click('id=btn-ok-dialog');
|
||||||
|
// await page.waitForTimeout(1000);
|
||||||
|
|
||||||
|
// // ตรวจสอบการลบสำนักงานใหญ่
|
||||||
|
// const itemLocator = page.locator(
|
||||||
|
// "//tr[contains(.,'9 บริษัท จำลอง จำกัดTES0000012608462202840866224228คุณอาท40/04')]",
|
||||||
|
// );
|
||||||
|
|
||||||
|
// // ตรวจสอบว่าถูกลบออกจากระบบหรือไม่
|
||||||
|
// await expect(itemLocator).toBeHidden();
|
||||||
|
|
||||||
|
// console.log('ตรวจสอบข้อมูลการลบสำนักงานใหญ่สำเร็จ');
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('เกิดข้อผิดพลาดในการลบสำนักงานใหญ่', error);
|
||||||
|
// throw error;
|
||||||
|
// }
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,128 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import exp from 'constants';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ในกรณีที่ไม่กรอกข้อมูล', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
await page.click('id=btn-info-basic-save');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
const usernameError = page.locator("(//div[@role='alert'])[1]");
|
||||||
|
const userTypeError = page.locator("(//div[@role='alert'])[2]");
|
||||||
|
const userPermisionError = page.locator("(//div[@role='alert'])[3]");
|
||||||
|
const citizenIdError = page.locator("(//div[@role='alert'])[4]");
|
||||||
|
const firstNameError = page.locator("(//div[@role='alert'])[5]");
|
||||||
|
const lastNameError = page.locator("(//div[@role='alert'])[6]");
|
||||||
|
const firstNameEnError = page.locator("(//div[@role='alert'])[7]");
|
||||||
|
const lastNameEnError = page.locator("(//div[@role='alert'])[8]");
|
||||||
|
const brithDateError = page.locator("(//div[@role='alert'])[9]");
|
||||||
|
const citizenIdInError = page.locator("(//div[@role='alert'])[10]");
|
||||||
|
const addressError = page.locator("(//div[@role='alert'])[11]");
|
||||||
|
const provinceError = page.locator("(//div[@role='alert'])[12]");
|
||||||
|
const districtError = page.locator("(//div[@role='alert'])[13]");
|
||||||
|
const subDistrictErrorError = page.locator("(//div[@role='alert'])[14]");
|
||||||
|
const addressEnErrorError = page.locator("(//div[@role='alert'])[15]");
|
||||||
|
|
||||||
|
await expect(usernameError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(userTypeError).toHaveText('โปรดเลือกประเภทผู้ใช้งาน');
|
||||||
|
await expect(userPermisionError).toHaveText('โปรดเลือกสิทธิ์ผู้ใช้งาน');
|
||||||
|
await expect(citizenIdError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(firstNameError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(lastNameError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(firstNameEnError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(lastNameEnError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(brithDateError).toHaveText('โปรดเลือกวันเดือนปีเกิด');
|
||||||
|
await expect(citizenIdInError).toHaveText('โปรดเลือกวันที่ออกบัตร');
|
||||||
|
await expect(addressError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
await expect(provinceError).toHaveText('โปรดเลือกจังหวัด');
|
||||||
|
await expect(districtError).toHaveText('โปรดเลือกอำเภอ');
|
||||||
|
await expect(subDistrictErrorError).toHaveText('โปรดเลือกตำบล');
|
||||||
|
await expect(addressEnErrorError).toHaveText('จำเป็นต้องกรอกข้อมูลนี้');
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=btn-form-close');
|
||||||
|
console.log('การตรวจสอบการทำงานถูกต้อง');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ในกรณีที่กรอกชื่อผู้ใช้งานที่ไม่ตรงกับตัวอักษรที่กำหนด', async () => {
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกชื่อผู้ใช้งาน
|
||||||
|
await page.fill('id=input-username', 'ทดสอบ');
|
||||||
|
|
||||||
|
const usernameError = page.locator("(//div[@role='alert'])[1]");
|
||||||
|
|
||||||
|
await expect(usernameError).toHaveText(
|
||||||
|
'โปรดใช้เฉพาะตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น',
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=btn-form-close');
|
||||||
|
console.log('การตรวจสอบการทำงานถูกต้อง');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ในกรณีที่กรอกชื่อและนามสกุลภาษาอังกฤษไม่ตรงตามรูปแบบ', async () => {
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกชื่อผู้ใช้งาน
|
||||||
|
await page.fill('id=form-dialog-personnel-input-first-name-en', 'ทดสอบ');
|
||||||
|
await page.fill('id=form-dialog-personnel-input-last-name-en', 'ทดสอบ');
|
||||||
|
|
||||||
|
const firstNameEnError = page.locator("(//div[@role='alert'])[1]");
|
||||||
|
const lastNameEnError = page.locator("(//div[@role='alert'])[2]");
|
||||||
|
|
||||||
|
await expect(firstNameEnError).toHaveText(
|
||||||
|
'โปรดใช้เฉพาะตัวอักษรภาษาอังกฤษเท่านั้น',
|
||||||
|
);
|
||||||
|
await expect(lastNameEnError).toHaveText(
|
||||||
|
'โปรดใช้เฉพาะตัวอักษรภาษาอังกฤษเท่านั้น',
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=btn-form-close');
|
||||||
|
console.log('การตรวจสอบการทำงานถูกต้อง');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Personnel - ในกรณีที่กรอกอีเมลไม่ตรงรูปแบบ', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-personne');
|
||||||
|
|
||||||
|
// กรอกชื่อผู้ใช้งาน
|
||||||
|
await page.fill('id=form-dialog-personnel-input-email', 'ทดสอบ');
|
||||||
|
|
||||||
|
const firstNameEnError = page.locator("(//div[@role='alert'])[1]");
|
||||||
|
|
||||||
|
await expect(firstNameEnError).toHaveText('ข้อมูลไม่ถูกต้อง');
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=btn-form-close');
|
||||||
|
console.log('การตรวจสอบการทำงานถูกต้อง');
|
||||||
|
});
|
||||||
109
tests/02-Admin-PersonnelManagement/JWS_PM_003_ViewDetail.spec.ts
Normal file
109
tests/02-Admin-PersonnelManagement/JWS_PM_003_ViewDetail.spec.ts
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('View Deatil Personnel Employee', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
await page.click("(//div[@role='tab'])[2]");
|
||||||
|
|
||||||
|
try {
|
||||||
|
await page.waitForSelector('id=btn-kebab-action-employeem', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-action-employeem');
|
||||||
|
await page.click('id=btn-kebab-view-detail-employeem');
|
||||||
|
|
||||||
|
const detailTitle = page.locator("//span[text()='ธรรมรงด์ ดำรงธรรม']");
|
||||||
|
|
||||||
|
await expect(detailTitle).toHaveText('ธรรมรงด์ ดำรงธรรม');
|
||||||
|
console.log('ตรวจสอบรายละเอียดพนักงานถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('เกิดข้อผิดพลาดในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('View Deatil Personnel Courier', async () => {
|
||||||
|
try {
|
||||||
|
await page.click("(//div[@role='tab'])[3]");
|
||||||
|
await page.click('id=btn-kebab-action-courierw');
|
||||||
|
await page.click('id=btn-kebab-view-detail-courierw');
|
||||||
|
|
||||||
|
const detailTitle = page.locator("//span[text()='มาตา ลดา']");
|
||||||
|
|
||||||
|
await expect(detailTitle).toHaveText('มาตา ลดา');
|
||||||
|
console.log('ตรวจสอบรายละเอียดพนักงานส่งเอกสารถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('เกิดข้อผิดพลาดในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('View Deatil Personnel Delegate', async () => {
|
||||||
|
try {
|
||||||
|
await page.click("(//div[@role='tab'])[4]");
|
||||||
|
await page.click('id=btn-kebab-action-delegatem');
|
||||||
|
await page.click('id=btn-kebab-view-detail-delegatem');
|
||||||
|
|
||||||
|
const detailTitle = page.locator("//span[text()='อาคม พลัง']");
|
||||||
|
|
||||||
|
await expect(detailTitle).toHaveText('อาคม พลัง');
|
||||||
|
console.log('ตรวจสอบรายละเอียดตัวแทนถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('เกิดข้อผิดพลาดในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('View Deatil Personnel Agency', async () => {
|
||||||
|
try {
|
||||||
|
await page.click("(//div[@role='tab'])[5]");
|
||||||
|
await page.click('id=btn-kebab-action-agencyw');
|
||||||
|
await page.waitForSelector('id=btn-kebab-view-detail-agencyw', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-view-detail-agencyw');
|
||||||
|
|
||||||
|
const detailTitle = await page.locator("//span[text()='ธิดา งามตา']");
|
||||||
|
|
||||||
|
await expect(detailTitle).toHaveText('ธิดา งามตา');
|
||||||
|
console.log('ตรวจสอบรายละเอียดเอเจนซี่ถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('เกิดข้อผิดพลาดในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,243 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { exec } from 'child_process';
|
||||||
|
import { log } from 'console';
|
||||||
|
import { writeFileSync } from 'fs';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Personnel - พนักงาน', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// เข้าสู่หน้าแก้ไขพนักงาน
|
||||||
|
await page.click("(//div[@role='tab'])[2]");
|
||||||
|
await page.waitForSelector('id=btn-kebab-action-employeem', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-action-employeem');
|
||||||
|
|
||||||
|
// ตรวจสอบการคลิกว่าได้มีการคลิกหรือการแสดงจริงหรือไม่
|
||||||
|
// const isElementVisible = await page.isVisible(
|
||||||
|
// 'id=btn-kebab-edit-employeem',
|
||||||
|
// );
|
||||||
|
// console.log('Element visibility:', isElementVisible);
|
||||||
|
|
||||||
|
await page.click('id=btn-kebab-edit-employeem');
|
||||||
|
|
||||||
|
// แก้ไขข้อมูล
|
||||||
|
await page.fill('id=drawer-info-personnel-input-first-name', 'อานน');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-last-name', 'รักมาก');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-first-name-en', 'Arnon');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-last-name-en', 'Rakmak');
|
||||||
|
await page.click('id=btn-info-basic-save'); // คลิกปุ่มบันทึก
|
||||||
|
|
||||||
|
// ตรวจสอบหลังแก้ไขเสร็จ
|
||||||
|
await page.waitForSelector('id=btn-kebab-action-employeem', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-action-employeem');
|
||||||
|
await page.waitForSelector('id=btn-kebab-view-detail-employeem', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-view-detail-employeem');
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลว่าทำการแก้ไขถูกหรือไม่
|
||||||
|
const detailEditFistName = await page.inputValue("//input[@value='อานน']");
|
||||||
|
const detailEditLastName = await page.inputValue(
|
||||||
|
"//input[@value='รักมาก']",
|
||||||
|
);
|
||||||
|
const detailEditFistNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Arnon']",
|
||||||
|
);
|
||||||
|
const detailEditLastNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Rakmak']",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(detailEditFistName).toBe('อานน');
|
||||||
|
await expect(detailEditLastName).toBe('รักมาก');
|
||||||
|
await expect(detailEditFistNameEn).toBe('Arnon');
|
||||||
|
await expect(detailEditLastNameEn).toBe('Rakmak');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการแก้ไขข้อมูลพนักงานถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('เกิดข้อผิดพลาดในการทดสอบแก้ไขบุคลากร');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Personnel - พนักงานส่งเอกสาร', async () => {
|
||||||
|
try {
|
||||||
|
// เข้าสู่หน้าแก้ไขพนักงาน
|
||||||
|
await page.click("(//div[@role='tab'])[3]");
|
||||||
|
await page.click('id=btn-kebab-action-courierw');
|
||||||
|
await page.click('id=btn-kebab-edit-courierw');
|
||||||
|
|
||||||
|
// แก้ไขข้อมูล
|
||||||
|
await page.fill('id=drawer-info-personnel-input-first-name', 'ลาดา');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-last-name', 'มดา');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-first-name-en', 'Lada');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-last-name-en', 'Mada');
|
||||||
|
await page.click('id=btn-info-basic-save'); // คลิกปุ่มบันทึก
|
||||||
|
|
||||||
|
// ตรวจสอบหลังแก้ไขเสร็จ
|
||||||
|
await page.waitForSelector('id=btn-kebab-action-courierw', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-action-courierw');
|
||||||
|
await page.waitForSelector('id=btn-kebab-view-detail-courierw', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-view-detail-courierw');
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลว่าทำการแก้ไขถูกหรือไม่
|
||||||
|
const detailEditFistName = await page.inputValue("//input[@value='ลาดา']");
|
||||||
|
const detailEditLastName = await page.inputValue("//input[@value='มดา']");
|
||||||
|
const detailEditFistNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Lada']",
|
||||||
|
);
|
||||||
|
const detailEditLastNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Mada']",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(detailEditFistName).toBe('ลาดา');
|
||||||
|
await expect(detailEditLastName).toBe('มดา');
|
||||||
|
await expect(detailEditFistNameEn).toBe('Lada');
|
||||||
|
await expect(detailEditLastNameEn).toBe('Mada');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการแก้ไขข้อมูลพนักงานส่งเอกสารถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('เกิดข้อผิดพลาดในการทดสอบแก้ไขบุคลากร');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Personnel - ตัวแทน', async () => {
|
||||||
|
try {
|
||||||
|
// เข้าสู่หน้าแก้ไขพนักงาน
|
||||||
|
await page.click("(//div[@role='tab'])[4]");
|
||||||
|
await page.click('id=btn-kebab-action-delegatem');
|
||||||
|
await page.click('id=btn-kebab-edit-delegatem');
|
||||||
|
|
||||||
|
// แก้ไขข้อมูล
|
||||||
|
await page.fill('id=drawer-info-personnel-input-first-name', 'ธนกร');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-last-name', 'ลอยฟ้า');
|
||||||
|
await page.fill(
|
||||||
|
'id=drawer-info-personnel-input-first-name-en',
|
||||||
|
'Thanakorn',
|
||||||
|
);
|
||||||
|
await page.fill('id=drawer-info-personnel-input-last-name-en', 'Loifa');
|
||||||
|
await page.click('id=btn-info-basic-save'); // คลิกปุ่มบันทึก
|
||||||
|
|
||||||
|
// ตรวจสอบหลังแก้ไขเสร็จ
|
||||||
|
await page.waitForSelector('id=btn-kebab-action-delegatem', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-action-delegatem');
|
||||||
|
await page.waitForSelector('id=btn-kebab-view-detail-delegatem', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-view-detail-delegatem');
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลว่าทำการแก้ไขถูกหรือไม่
|
||||||
|
const detailEditFistName = await page.inputValue("//input[@value='ธนกร']");
|
||||||
|
const detailEditLastName = await page.inputValue(
|
||||||
|
"//input[@value='ลอยฟ้า']",
|
||||||
|
);
|
||||||
|
const detailEditFistNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Thanakorn']",
|
||||||
|
);
|
||||||
|
const detailEditLastNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Loifa']",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(detailEditFistName).toBe('ธนกร');
|
||||||
|
await expect(detailEditLastName).toBe('ลอยฟ้า');
|
||||||
|
await expect(detailEditFistNameEn).toBe('Thanakorn');
|
||||||
|
await expect(detailEditLastNameEn).toBe('Loifa');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการแก้ไขข้อมูลตัวแทนถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('เกิดข้อผิดพลาดในการทดสอบแก้ไขบุคลากร');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Personnel - เอเจนซี่', async () => {
|
||||||
|
try {
|
||||||
|
// เข้าสู่หน้าแก้ไขพนักงาน
|
||||||
|
await page.click("(//div[@role='tab'])[5]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.waitForSelector('id=btn-kebab-action-agencyw', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-action-agencyw');
|
||||||
|
await page.click('id=btn-kebab-edit-agencyw');
|
||||||
|
|
||||||
|
// แก้ไขข้อมูล
|
||||||
|
await page.fill('id=drawer-info-personnel-input-first-name', 'นิดา');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-last-name', 'อามา');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-first-name-en', 'Nida');
|
||||||
|
await page.fill('id=drawer-info-personnel-input-last-name-en', 'Arma');
|
||||||
|
await page.click('id=btn-info-basic-save'); // คลิกปุ่มบันทึก
|
||||||
|
|
||||||
|
// ตรวจสอบหลังแก้ไขเสร็จ
|
||||||
|
await page.waitForSelector('id=btn-kebab-action-agencyw', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-action-agencyw');
|
||||||
|
await page.waitForSelector('id=btn-kebab-view-detail-agencyw', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
await page.click('id=btn-kebab-view-detail-agencyw');
|
||||||
|
|
||||||
|
// ตรวจสอบข้อมูลว่าทำการแก้ไขถูกหรือไม่
|
||||||
|
const detailEditFistName = await page.inputValue("//input[@value='นิดา']");
|
||||||
|
const detailEditLastName = await page.inputValue("//input[@value='อามา']");
|
||||||
|
const detailEditFistNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Nida']",
|
||||||
|
);
|
||||||
|
const detailEditLastNameEn = await page.inputValue(
|
||||||
|
"//input[@value='Arma']",
|
||||||
|
);
|
||||||
|
|
||||||
|
await expect(detailEditFistName).toBe('นิดา');
|
||||||
|
await expect(detailEditLastName).toBe('อามา');
|
||||||
|
await expect(detailEditFistNameEn).toBe('Nida');
|
||||||
|
await expect(detailEditLastNameEn).toBe('Arma');
|
||||||
|
|
||||||
|
console.log('ตรวจสอบการแก้ไขข้อมูลเอเจนซี่ถูกต้อง');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('เกิดข้อผิดพลาดในการทดสอบแก้ไขบุคลากร');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(4000);
|
||||||
|
await page.click('id=btn-info-close');
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ปิดสถานะการใช้งานบุคลากร', async () => {
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
try {
|
||||||
|
await page.click('id=btn-kebab-action-employeem');
|
||||||
|
|
||||||
|
await page.click('id=btn-kebab-status-employeem', {
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
console.log('เปลี่ยนสถานะสำเร็จ');
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
// รอ Update
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
console.log('สถานะถูกเปลี่ยนแล้ว');
|
||||||
|
|
||||||
|
// ตรวจสอบสีของแถวหลังจากทำการเปลี่ยนสถานะ
|
||||||
|
const rowLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='อานน รักมาก']",
|
||||||
|
);
|
||||||
|
const backgroundColor = await rowLocator.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).backgroundColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
// กำหนดสีหลัเปลี่ยนสถานะการใช้งาน
|
||||||
|
const expectedColor = 'rgba(0, 0, 0, 0)';
|
||||||
|
|
||||||
|
// ตรวจสอบสีที่เปลี่ยนไป
|
||||||
|
expect(backgroundColor.trim()).toBe(expectedColor);
|
||||||
|
console.log('สีของแถวถูกเปลี่ยนเป็นสีเทาอ่อน');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('เปิดสถานะการใช้งานบุคลากร', async () => {
|
||||||
|
try {
|
||||||
|
await page.click('id=btn-kebab-action-employeem');
|
||||||
|
|
||||||
|
await page.click('id=btn-kebab-status-employeem', {
|
||||||
|
force: true,
|
||||||
|
});
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
console.log('เปลี่ยนสถานะสำเร็จ');
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
// รอ Update
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
console.log('สถานะถูกเปลี่ยนแล้ว');
|
||||||
|
|
||||||
|
// ตรวจสอบสีของแถวหลังจากทำการเปลี่ยนสถานะ
|
||||||
|
const rowLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='อานน รักมาก']",
|
||||||
|
);
|
||||||
|
const backgroundColor = await rowLocator.evaluate(
|
||||||
|
(el) => window.getComputedStyle(el).backgroundColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
// กำหนดสีหลัเปลี่ยนสถานะการใช้งาน
|
||||||
|
const expectedColor = 'rgba(0, 0, 0, 0)';
|
||||||
|
|
||||||
|
// ตรวจสอบสีที่เปลี่ยนไป
|
||||||
|
expect(backgroundColor.trim()).toBe(expectedColor);
|
||||||
|
console.log('สีของแถวถูกเปลี่ยนเป็นของสถานะการใช้งาน');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,355 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงสถานะใช้งาน เปิด/ปิด บุคลากรทั้งหมด', async () => {
|
||||||
|
try {
|
||||||
|
// คลิกเมนูจัดการบุคลากร
|
||||||
|
await page.click('id=menu-icon-personnel-management');
|
||||||
|
|
||||||
|
// แสดงสถานะที่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังใช้งานอยู่
|
||||||
|
await page.click('id=field-select-status_1');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะใช้งานหรือไม่
|
||||||
|
const statusActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะกำลังใช้งานเท่านั้น');
|
||||||
|
|
||||||
|
// แสดงสถานะที่ไม่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังไม่ใช้งาน
|
||||||
|
await page.click('id=field-select-status_2');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะไม่ใช้งานหรือไม่
|
||||||
|
const statusInActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusInActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะที่ไม่ใช้งาน');
|
||||||
|
|
||||||
|
// แสดงสถานะทั้งหมด
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะทั้งหมด
|
||||||
|
await page.click('id=field-select-status_0');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าแสดงทุกสถานะหรือไม่
|
||||||
|
const statusAll = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('สถานะทั้งหมด', statusAll); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะทั้งหมด');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงสถานะใช้งาน เปิด/ปิด พนักงาน', async () => {
|
||||||
|
try {
|
||||||
|
// คลิก Tab พนักงาน
|
||||||
|
await page.click("(//div[@role='tab'])[2]");
|
||||||
|
|
||||||
|
// แสดงสถานะที่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังใช้งานอยู่
|
||||||
|
await page.click('id=field-select-status_1');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะใช้งานหรือไม่
|
||||||
|
const statusActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะกำลังใช้งานเท่านั้น');
|
||||||
|
|
||||||
|
// แสดงสถานะที่ไม่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังไม่ใช้งาน
|
||||||
|
await page.click('id=field-select-status_2');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะไม่ใช้งานหรือไม่
|
||||||
|
const statusInActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusInActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะที่ไม่ใช้งาน');
|
||||||
|
|
||||||
|
// แสดงสถานะทั้งหมด
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะทั้งหมด
|
||||||
|
await page.click('id=field-select-status_0');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าแสดงทุกสถานะหรือไม่
|
||||||
|
const statusAll = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('สถานะทั้งหมด', statusAll); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะทั้งหมด');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงสถานะใช้งาน เปิด/ปิด พนักงานส่งเอกสาร', async () => {
|
||||||
|
try {
|
||||||
|
// คลิก Tab พนักงานส่งเอกสาร
|
||||||
|
await page.click("(//div[@role='tab'])[3]");
|
||||||
|
|
||||||
|
// แสดงสถานะที่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังใช้งานอยู่
|
||||||
|
await page.click('id=field-select-status_1');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะใช้งานหรือไม่
|
||||||
|
const statusActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะกำลังใช้งานเท่านั้น');
|
||||||
|
|
||||||
|
// แสดงสถานะที่ไม่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังไม่ใช้งาน
|
||||||
|
await page.click('id=field-select-status_2');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะไม่ใช้งานหรือไม่
|
||||||
|
const statusInActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusInActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะที่ไม่ใช้งาน');
|
||||||
|
|
||||||
|
// แสดงสถานะทั้งหมด
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะทั้งหมด
|
||||||
|
await page.click('id=field-select-status_0');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าแสดงทุกสถานะหรือไม่
|
||||||
|
const statusAll = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('สถานะทั้งหมด', statusAll); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะทั้งหมด');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงสถานะใช้งาน เปิด/ปิด ตัวแทน', async () => {
|
||||||
|
try {
|
||||||
|
// คลิก Tab ตัวแทน
|
||||||
|
await page.click("(//div[@role='tab'])[4]");
|
||||||
|
|
||||||
|
// แสดงสถานะที่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังใช้งานอยู่
|
||||||
|
await page.click('id=field-select-status_1');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะใช้งานหรือไม่
|
||||||
|
const statusActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะกำลังใช้งานเท่านั้น');
|
||||||
|
|
||||||
|
// แสดงสถานะที่ไม่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังไม่ใช้งาน
|
||||||
|
await page.click('id=field-select-status_2');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะไม่ใช้งานหรือไม่
|
||||||
|
const statusInActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusInActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะที่ไม่ใช้งาน');
|
||||||
|
|
||||||
|
// แสดงสถานะทั้งหมด
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะทั้งหมด
|
||||||
|
await page.click('id=field-select-status_0');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าแสดงทุกสถานะหรือไม่
|
||||||
|
const statusAll = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('สถานะทั้งหมด', statusAll); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะทั้งหมด');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ตรวจสอบการแสดงสถานะใช้งาน เปิด/ปิด เอเจนซี่', async () => {
|
||||||
|
try {
|
||||||
|
// คลิก Tab เอเจนซี่
|
||||||
|
await page.click("(//div[@role='tab'])[5]");
|
||||||
|
|
||||||
|
// แสดงสถานะที่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังใช้งานอยู่
|
||||||
|
await page.click('id=field-select-status_1');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะใช้งานหรือไม่
|
||||||
|
const statusActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะกำลังใช้งานเท่านั้น');
|
||||||
|
|
||||||
|
// แสดงสถานะที่ไม่ใช้งาน
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะกำลังไม่ใช้งาน
|
||||||
|
await page.click('id=field-select-status_2');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่ามีแต่สถานะไม่ใช้งานหรือไม่
|
||||||
|
const statusInActive = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('มีเพียงสถานะการใช้งานเท่านั้น', statusInActive); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะการใช้งานมีแต่สถานะที่ไม่ใช้งาน');
|
||||||
|
|
||||||
|
// แสดงสถานะทั้งหมด
|
||||||
|
// คลิกเพื่อเปิด dropdown
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.click('id=field-select-status');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ dropdown เปิด
|
||||||
|
|
||||||
|
// คลิกเพื่อแสดงสถานะทั้งหมด
|
||||||
|
await page.click('id=field-select-status_0');
|
||||||
|
await page.waitForTimeout(1000); // รอให้ UI อัปเดต
|
||||||
|
|
||||||
|
// ตรวจสอบว่าแสดงทุกสถานะหรือไม่
|
||||||
|
const statusAll = await page.isVisible('id=field-select-status_1');
|
||||||
|
|
||||||
|
console.log('สถานะทั้งหมด', statusAll); // เช็ค
|
||||||
|
|
||||||
|
expect(statusActive).toBe(false);
|
||||||
|
|
||||||
|
console.log('ตรวจสอบสถานะทั้งหมด');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดพลาดในการทดสอบ:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,118 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'สีลม');
|
||||||
|
await page.fill("(//input[@id='input-customerEnglishName'])[3]", 'Silom');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-employment-office'])[3]",
|
||||||
|
'กรุงเทพมหานคร',
|
||||||
|
);
|
||||||
|
await page.click("(//div[@id='select-business-type'])[3]");
|
||||||
|
await page.click("//span[text()='ประมง']");
|
||||||
|
await page.click("(//div[@id='select-job-position'])[3]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-job-description'])[3]",
|
||||||
|
'ตรวจสอบการทำการลักษณะงาน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@id='input-start-date'])[3]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-sales-person'])[3]", 'พนักงานขาย');
|
||||||
|
await page.fill("(//input[@id='input-mail'])[3]", 'jws@local.com');
|
||||||
|
await page.fill("(//input[@id='input-telephone'])[3]", '0864228464');
|
||||||
|
await page.setInputFiles(
|
||||||
|
"(//input[contains(@class,'q-field__input fit')])[3]",
|
||||||
|
'/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests/Datafile/Pic1.jpg',
|
||||||
|
); // UploadFile
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person Second', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'วัง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", 'จคภ/คค/ุ//');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'สีลม');
|
||||||
|
await page.fill("(//input[@id='input-customerEnglishName'])[3]", 'Silom');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-employment-office'])[3]",
|
||||||
|
'กรุงเทพมหานคร',
|
||||||
|
);
|
||||||
|
await page.click("(//div[@id='select-business-type'])[3]");
|
||||||
|
await page.click("//span[text()='ประมง']");
|
||||||
|
await page.click("(//div[@id='select-job-position'])[3]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-job-description'])[3]",
|
||||||
|
'ตรวจสอบการทำการลักษณะงาน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@id='input-start-date'])[3]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-sales-person'])[3]", 'พนักงานขาย');
|
||||||
|
await page.fill("(//input[@id='input-mail'])[3]", 'jws@local.com');
|
||||||
|
await page.fill("(//input[@id='input-telephone'])[3]", '0864228464');
|
||||||
|
await page.setInputFiles(
|
||||||
|
"(//input[contains(@class,'q-field__input fit')])[3]",
|
||||||
|
'/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests/Datafile/Pic1.jpg',
|
||||||
|
); // UploadFile
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,249 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person No input Data', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person No Input Employee name', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", '');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person No Input Tax No', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person No Input Customer Name TH', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", '');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person No Input Customer Name EN', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", '');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person No Input Customername', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", '');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person No Input Address TH', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person Not Select Province', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person Not Select District', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person Not Select Sub District', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Natural Person Not Input Address ENG', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-natural-person');
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[3]", 'ปิง');
|
||||||
|
await page.fill("(//input[@id='input-tax-no'])[3]", '1242822482204');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'โคโม่');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Como');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -24,9 +24,10 @@ test('Login', async () => {
|
||||||
// await page.click('id=acceptBtn');
|
// await page.click('id=acceptBtn');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('View Deatil Personnel', async () => {
|
test('Selete Filter Manage Customer Active', async () => {
|
||||||
await page.click('id=menu-icon-personnel-management');
|
await page.click('id=menu-icon-customer-management');
|
||||||
await page.click("(//div[@class='full-width text-right']//button)[1]");
|
await page.click('id=btn-eye-โคโม่');
|
||||||
await page.click("(//div[@class='q-focus-helper']/following-sibling::i)[1]");
|
await page.waitForTimeout(2000);
|
||||||
await page.waitForTimeout(4000);
|
await page.click("(//button[@id='closeDialog'])[1]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Naturalperson', async () => {
|
||||||
|
// รออัพเดท PATH
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("//button[@id='btn-dots-PERS000001']");
|
||||||
|
await page.click('id=view-detail-btn-undefined-edit');
|
||||||
|
await page.click(
|
||||||
|
"//div[contains(@class,'q-field__append q-field__marginal')]/following-sibling::div[1]",
|
||||||
|
);
|
||||||
|
await page.click("//span[text()='บางรัก']");
|
||||||
|
await page.fill("(//input[@id='input-employer-id'])[1]", 'หลินปิง');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[1]", 'บางรัก');
|
||||||
|
await page.fill("(//input[@id='input-customerEnglishName'])[1]", 'Bangrak');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Delete Naturalperson', async () => {
|
||||||
|
// รออัพเดท PATH
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("//button[@id='btn-dots-PERS000002']");
|
||||||
|
await page.click('id=view-detail-btn-undefined-delete');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Status On Natural Person', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("//button[@id='btn-dots-PERS000002']");
|
||||||
|
await page.click('id=view-detail-btn-undefined-status');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Status Off Natural Person', async () => {
|
||||||
|
await page.click('id=btn-dots-โคโม่');
|
||||||
|
await page.click('id=view-detail-btn-undefined-status');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Legalentitly Person', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-legal-entity');
|
||||||
|
await page.click("(//div[@id='input-source-nationality'])[3]");
|
||||||
|
await page.click("//span[text()='บางรัก']");
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'ลอย');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Loi');
|
||||||
|
await page.fill("(//input[@id='input-owner-name'])[3]", 'ปิงปิง');
|
||||||
|
await page.fill("(//input[@id='input-customerEnglishName'])[3]", 'Bangrak');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'บางรัก');
|
||||||
|
await page.fill("(//input[@id='input-taxNo'])[3]", '1284262822028');
|
||||||
|
await page.fill("(//input[@id='input-registerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-authorizedCapital'])[3]", '20000000');
|
||||||
|
await page.click("(//input[@aria-label='จดทะเบียนเมื่อ'])[3]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2560']");
|
||||||
|
await page.click("(//div[text()='30'])[2]");
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//span[text()='เชียงใหม่']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-employment-office'])[3]",
|
||||||
|
'กรุงเทพมหานคร',
|
||||||
|
);
|
||||||
|
await page.click("(//div[@id='select-business-type'])[3]");
|
||||||
|
await page.click("//span[text()='ประมง']");
|
||||||
|
await page.click("(//div[@id='select-job-position'])[3]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-job-description'])[3]",
|
||||||
|
'ตรวจสอบการทำการลักษณะงาน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='วันที่จ่ายค่าแรง'])[3]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-sales-person'])[3]", 'พนักงานขาย');
|
||||||
|
await page.fill("(//input[@id='input-mail'])[3]", 'jws@local.com');
|
||||||
|
await page.fill("(//input[@id='input-telephone'])[3]", '0864228464');
|
||||||
|
await page.setInputFiles(
|
||||||
|
"(//input[contains(@class,'q-field__input fit')])[3]",
|
||||||
|
'/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests/Datafile/Pic1.jpg',
|
||||||
|
); // UploadFile
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Legalentitly Person Second', async () => {
|
||||||
|
await page.click("(//div[@id='btn-add'])[1]");
|
||||||
|
await page.click('id=add-customer-legal-entity');
|
||||||
|
await page.fill("(//input[@id='input-customer-name'])[3]", 'ลาภ');
|
||||||
|
await page.fill("(//input[@id='input-customer-name-en'])[3]", 'Lab');
|
||||||
|
await page.fill("(//input[@id='input-owner-name'])[3]", 'ปิงปิง');
|
||||||
|
await page.fill("(//input[@id='input-customerEnglishName'])[3]", 'Silom');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[3]", 'สีลม');
|
||||||
|
await page.fill("(//input[@id='input-taxNo'])[3]", '1284262822028');
|
||||||
|
await page.fill("(//input[@id='input-registerName'])[3]", 'ปองพล กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-authorizedCapital'])[3]", '20000000');
|
||||||
|
await page.click("(//input[@aria-label='จดทะเบียนเมื่อ'])[3]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2560']");
|
||||||
|
await page.click("(//div[text()='30'])[2]");
|
||||||
|
await page.fill("(//input[@id='input-address-0'])[3]", '20/02');
|
||||||
|
await page.click("(//div[@id='select-province-0'])[3]");
|
||||||
|
await page.click("//span[text()='เชียงใหม่']");
|
||||||
|
await page.click("(//div[@id='select-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click("(//div[@id='select-sub-district-0'])[3]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill("(//input[@id='input-address-en-0'])[3]", '20/02');
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-employment-office'])[3]",
|
||||||
|
'กรุงเทพมหานคร',
|
||||||
|
);
|
||||||
|
await page.click("(//div[@id='select-business-type'])[3]");
|
||||||
|
await page.click("//span[text()='ประมง']");
|
||||||
|
await page.click("(//div[@id='select-job-position'])[3]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-job-description'])[3]",
|
||||||
|
'ตรวจสอบการทำการลักษณะงาน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='วันที่จ่ายค่าแรง'])[3]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-sales-person'])[3]", 'พนักงานขาย');
|
||||||
|
await page.fill("(//input[@id='input-mail'])[3]", 'jws@local.com');
|
||||||
|
await page.fill("(//input[@id='input-telephone'])[3]", '0864228464');
|
||||||
|
await page.setInputFiles(
|
||||||
|
"(//input[contains(@class,'q-field__input fit')])[3]",
|
||||||
|
'/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests/Datafile/Pic1.jpg',
|
||||||
|
); // UploadFile
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -24,9 +24,10 @@ test('Login', async () => {
|
||||||
// await page.click('id=acceptBtn');
|
// await page.click('id=acceptBtn');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Edit Personnel', async () => {
|
test('View Detail Legalentitly', async () => {
|
||||||
await page.click('id=menu-icon-personnel-management');
|
await page.click('id=menu-icon-customer-management');
|
||||||
await page.click("(//div[@class='full-width text-right']//button)[1]");
|
await page.click("//button[@id='btn-dots-CORP000002']");
|
||||||
await page.click("(//div[@class='q-focus-helper']/following-sibling::i)[2]");
|
|
||||||
|
await page.click('id=view-detail-btn-undefined-view');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Legalentitly ', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("//button[@id='btn-dots-CORP000002']");
|
||||||
|
await page.click('id=view-detail-btn-undefined-edit');
|
||||||
|
await page.click("(//div[@id='input-source-nationality'])[1]");
|
||||||
|
await page.click("//span[text()='บางรัก']");
|
||||||
|
await page.fill("(//input[@id='input-customerEnglishName'])[1]", 'Bangrak');
|
||||||
|
await page.fill("(//input[@id='input-customerName'])[1]", 'บางรัก');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Delete Legalentitly', async () => {
|
||||||
|
// รออัพเดท PATH
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("//button[@id='btn-dots-CORP000002']");
|
||||||
|
|
||||||
|
await page.click('id=view-detail-btn-undefined-delete');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Status Off Legalentitly', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click("//button[@id='btn-dots-CORP000002']");
|
||||||
|
await page.click('id=view-detail-btn-undefined-status');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Status On Legalentitly', async () => {
|
||||||
|
await page.click("//button[@id='btn-dots-CORP000002']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=view-detail-btn-undefined-status');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { test, expect, Page } from '@playwright/test';
|
import { test, expect, Page } from '@playwright/test';
|
||||||
import { strictEqual } from 'assert';
|
import { strictEqual } from 'assert';
|
||||||
|
import { escape } from 'querystring';
|
||||||
|
|
||||||
let page: Page;
|
let page: Page;
|
||||||
|
|
||||||
|
|
@ -24,26 +25,33 @@ test('Login', async () => {
|
||||||
// await page.click('id=acceptBtn');
|
// await page.click('id=acceptBtn');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Search Branch Management', async () => {
|
test('Select Dropdown Employer Type Off', async () => {
|
||||||
await page.click('id=menu-icon-branch-management');
|
await page.click('id=menu-icon-customer-management');
|
||||||
await page.fill('id=input-Search', 'สีลม');
|
await page.click('id=select-field');
|
||||||
|
await page.click('id=select-field_0');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
await page.fill('id=input-Search', 'สีลม1');
|
await page.click('id=select-field_1');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
await page.fill('id=input-Search', 'สี');
|
await page.click('id=select-field_2');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
await page.fill('id=input-Search', '1');
|
await page.click('id=select-field_3');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
await page.fill('id=input-Search', '20/02');
|
await page.click('id=select-field_4');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
await page.fill('id=input-Search', 'เชียงใหม่');
|
await page.keyboard.press('Escape');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
await page.fill('id=input-Search', 'เมือง');
|
});
|
||||||
await page.waitForTimeout(2000);
|
|
||||||
await page.fill('id=input-Search', 'ช้างเผือก');
|
test('Select Dropdown Employer Type on', async () => {
|
||||||
await page.waitForTimeout(2000);
|
await page.click('id=select-field');
|
||||||
await page.fill('id=input-Search', 'ดำเนินการอยู่');
|
await page.click('id=select-field_0');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
await page.fill('id=input-Search', 'ปิดดำเนินการ');
|
await page.click('id=select-field_1');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_2');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_3');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_4');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Selete Filter Manage Customer Active', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.fill('id=input-search', 'โค');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'โคโม่');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'นิติบุคคล');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'Como');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'Co');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'Lab');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'L');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -24,21 +24,21 @@ test('Login', async () => {
|
||||||
// await page.click('id=acceptBtn');
|
// await page.click('id=acceptBtn');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Select Filter Status Active Personnel', async () => {
|
test('Selete Filter Manage Customer Active', async () => {
|
||||||
await page.click('id=menu-icon-personnel-management');
|
await page.click('id=menu-icon-customer-management');
|
||||||
await page.click('id=btn-filter');
|
await page.click('id=select-status');
|
||||||
await page.click('id=btn-filter-active');
|
await page.click('id=select-status_1');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Select Filter Status InActive Personnel', async () => {
|
test('Selete Filter Manage Customer Inative', async () => {
|
||||||
await page.click('id=btn-filter');
|
await page.click('id=select-status');
|
||||||
await page.click('id=btn-filter-inactive');
|
await page.click('id=select-status_2');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Select Filter Status All Personnel', async () => {
|
test('Selete Filter Manage Customer All', async () => {
|
||||||
await page.click('id=btn-filter');
|
await page.click('id=select-status');
|
||||||
await page.click('id=btn-filter-all');
|
await page.click('id=select-status_0');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select Employee Tab', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click('id=tab-employee');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=add-employee');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Employee', async () => {
|
||||||
|
await page.click("(//input[@id='select-employer-branch'])[2]");
|
||||||
|
await page.click('id=select-employer-branch_0');
|
||||||
|
await page.fill("(//input[@id='input-nrcNo'])[2]", '6282282246226');
|
||||||
|
await page.fill("(//input[@id='input-first-name'])[2]", 'ปองพล');
|
||||||
|
await page.fill("(//input[@id='input-last-name'])[2]", 'กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-first-name-en'])[2]", 'Pongpon');
|
||||||
|
await page.fill("(//input[@id='input-last-name-en'])[2]", 'Kuntana');
|
||||||
|
await page.click("(//input[@id='input-birth-date'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2536']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.click("(//div[@id='select-gender'])[2]");
|
||||||
|
await page.click("//span[text()='หญิง']");
|
||||||
|
await page.click("(//div[@id='select-nationality'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Detail OCR ', async () => {
|
||||||
|
await page.click("(//div[@id='select-passport-type'])[2]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-passport-no'])[2]", 'TH2862242226262');
|
||||||
|
await page.fill("(//input[@id='input-passport-ref'])[2]", '2042022022426');
|
||||||
|
await page.fill("(//input[@id='input-passport-place'])[2]", 'Bangkok');
|
||||||
|
await page.click("(//div[@id='select-passport-country'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันที่ออกหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//div[text()='2'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันหมดอายุหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2574']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create VISA OCR', async () => {
|
||||||
|
await page.click("(//div[@id='select-visa-type'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-visa-no'])[2]", '200222');
|
||||||
|
await page.click("(//input[@aria-label='ออกให้วันที่'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click("(//input[@aria-label='ใช้ได้ถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-visa-place'])[2]",
|
||||||
|
'กรมตรวจคนเข้าเมืองน่าน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='ให้อยู่ในราชอาณาจักรถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-tm6'])[2]", '204422002');
|
||||||
|
await page.click("(//input[@aria-label='วันที่เดินทางเข้ามาในประเทศ'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,297 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select Employee Tab', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Employee Not Input Data', async () => {
|
||||||
|
await page.click('id=tab-employee');
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=add-employee');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Employee Not Select Employee Code ', async () => {
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=add-employee');
|
||||||
|
await page.fill("(//input[@id='input-nrcNo'])[2]", '6282282246226');
|
||||||
|
await page.fill("(//input[@id='input-first-name'])[2]", 'ปองพล');
|
||||||
|
await page.fill("(//input[@id='input-last-name'])[2]", 'กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-first-name-en'])[2]", 'Pongpon');
|
||||||
|
await page.fill("(//input[@id='input-last-name-en'])[2]", 'Kuntana');
|
||||||
|
await page.click("(//input[@id='input-birth-date'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2536']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.click("(//div[@id='select-gender'])[2]");
|
||||||
|
await page.click("//span[text()='หญิง']");
|
||||||
|
await page.click("(//div[@id='select-nationality'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@id='select-passport-type'])[2]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-passport-no'])[2]", 'TH2862242226262');
|
||||||
|
await page.fill("(//input[@id='input-passport-ref'])[2]", '2042022022426');
|
||||||
|
await page.fill("(//input[@id='input-passport-place'])[2]", 'Bangkok');
|
||||||
|
await page.click("(//div[@id='select-passport-country'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันที่ออกหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//div[text()='2'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันหมดอายุหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2574']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@id='select-visa-type'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-visa-no'])[2]", '200222');
|
||||||
|
await page.click("(//input[@aria-label='ออกให้วันที่'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click("(//input[@aria-label='ใช้ได้ถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-visa-place'])[2]",
|
||||||
|
'กรมตรวจคนเข้าเมืองน่าน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='ให้อยู่ในราชอาณาจักรถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-tm6'])[2]", '204422002');
|
||||||
|
await page.click("(//input[@aria-label='วันที่เดินทางเข้ามาในประเทศ'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Employee Not Input Personal Information ', async () => {
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=add-employee');
|
||||||
|
await page.click("(//input[@id='select-employer-branch'])[2]");
|
||||||
|
await page.click('id=select-employer-branch_0');
|
||||||
|
await page.fill("(//input[@id='input-nrcNo'])[2]", '6282282246226');
|
||||||
|
|
||||||
|
await page.click("(//div[@id='select-passport-type'])[2]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-passport-no'])[2]", 'TH2862242226262');
|
||||||
|
await page.fill("(//input[@id='input-passport-ref'])[2]", '2042022022426');
|
||||||
|
await page.fill("(//input[@id='input-passport-place'])[2]", 'Bangkok');
|
||||||
|
await page.click("(//div[@id='select-passport-country'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันที่ออกหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//div[text()='2'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันหมดอายุหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2574']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
await page.click("(//div[@id='select-visa-type'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-visa-no'])[2]", '200222');
|
||||||
|
await page.click("(//input[@aria-label='ออกให้วันที่'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click("(//input[@aria-label='ใช้ได้ถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-visa-place'])[2]",
|
||||||
|
'กรมตรวจคนเข้าเมืองน่าน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='ให้อยู่ในราชอาณาจักรถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-tm6'])[2]", '204422002');
|
||||||
|
await page.click("(//input[@aria-label='วันที่เดินทางเข้ามาในประเทศ'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Employee Not Input Personal Address ', async () => {
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=add-employee');
|
||||||
|
|
||||||
|
await page.click("(//input[@id='select-employer-branch'])[2]");
|
||||||
|
await page.click('id=select-employer-branch_0');
|
||||||
|
await page.fill("(//input[@id='input-nrcNo'])[2]", '6282282246226');
|
||||||
|
await page.fill("(//input[@id='input-first-name'])[2]", 'ปองพล');
|
||||||
|
await page.fill("(//input[@id='input-last-name'])[2]", 'กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-first-name-en'])[2]", 'Pongpon');
|
||||||
|
await page.fill("(//input[@id='input-last-name-en'])[2]", 'Kuntana');
|
||||||
|
await page.click("(//input[@id='input-birth-date'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2536']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.click("(//div[@id='select-gender'])[2]");
|
||||||
|
await page.click("//span[text()='หญิง']");
|
||||||
|
await page.click("(//div[@id='select-nationality'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
await page.click("(//div[@id='select-passport-type'])[2]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-passport-no'])[2]", 'TH2862242226262');
|
||||||
|
await page.fill("(//input[@id='input-passport-ref'])[2]", '2042022022426');
|
||||||
|
await page.fill("(//input[@id='input-passport-place'])[2]", 'Bangkok');
|
||||||
|
await page.click("(//div[@id='select-passport-country'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันที่ออกหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//div[text()='2'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันหมดอายุหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2574']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
|
||||||
|
await page.click("(//div[@id='select-visa-type'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-visa-no'])[2]", '200222');
|
||||||
|
await page.click("(//input[@aria-label='ออกให้วันที่'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click("(//input[@aria-label='ใช้ได้ถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-visa-place'])[2]",
|
||||||
|
'กรมตรวจคนเข้าเมืองน่าน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='ให้อยู่ในราชอาณาจักรถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-tm6'])[2]", '204422002');
|
||||||
|
await page.click("(//input[@aria-label='วันที่เดินทางเข้ามาในประเทศ'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Employee Not Input Personal Information OCR ', async () => {
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=add-employee');
|
||||||
|
await page.click("(//input[@id='select-employer-branch'])[2]");
|
||||||
|
await page.click('id=select-employer-branch_0');
|
||||||
|
await page.fill("(//input[@id='input-nrcNo'])[2]", '6282282246226');
|
||||||
|
await page.fill("(//input[@id='input-first-name'])[2]", 'ปองพล');
|
||||||
|
await page.fill("(//input[@id='input-last-name'])[2]", 'กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-first-name-en'])[2]", 'Pongpon');
|
||||||
|
await page.fill("(//input[@id='input-last-name-en'])[2]", 'Kuntana');
|
||||||
|
await page.click("(//input[@id='input-birth-date'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2536']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.click("(//div[@id='select-gender'])[2]");
|
||||||
|
await page.click("//span[text()='หญิง']");
|
||||||
|
await page.click("(//div[@id='select-nationality'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
|
||||||
|
await page.click("(//div[@id='select-visa-type'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-visa-no'])[2]", '200222');
|
||||||
|
await page.click("(//input[@aria-label='ออกให้วันที่'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click("(//input[@aria-label='ใช้ได้ถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.fill(
|
||||||
|
"(//input[@id='input-visa-place'])[2]",
|
||||||
|
'กรมตรวจคนเข้าเมืองน่าน',
|
||||||
|
);
|
||||||
|
await page.click("(//input[@aria-label='ให้อยู่ในราชอาณาจักรถึงวันที่'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2568']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill("(//input[@id='input-tm6'])[2]", '204422002');
|
||||||
|
await page.click("(//input[@aria-label='วันที่เดินทางเข้ามาในประเทศ'])[2]");
|
||||||
|
await page.click("//div[text()='18']");
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.click('id=cancelBtn');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Employee Not Input Visa Information OCR ', async () => {
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=add-employee');
|
||||||
|
|
||||||
|
await page.click("(//input[@id='select-employer-branch'])[2]");
|
||||||
|
await page.click('id=select-employer-branch_0');
|
||||||
|
await page.fill("(//input[@id='input-nrcNo'])[2]", '6282282246226');
|
||||||
|
await page.fill("(//input[@id='input-first-name'])[2]", 'ปองพล');
|
||||||
|
await page.fill("(//input[@id='input-last-name'])[2]", 'กันธะณะ');
|
||||||
|
await page.fill("(//input[@id='input-first-name-en'])[2]", 'Pongpon');
|
||||||
|
await page.fill("(//input[@id='input-last-name-en'])[2]", 'Kuntana');
|
||||||
|
await page.click("(//input[@id='input-birth-date'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2536']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.click("(//div[@id='select-gender'])[2]");
|
||||||
|
await page.click("//span[text()='หญิง']");
|
||||||
|
await page.click("(//div[@id='select-nationality'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.click("(//div[@id='select-passport-type'])[2]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill("(//input[@id='input-passport-no'])[2]", 'TH2862242226262');
|
||||||
|
await page.fill("(//input[@id='input-passport-ref'])[2]", '2042022022426');
|
||||||
|
await page.fill("(//input[@id='input-passport-place'])[2]", 'Bangkok');
|
||||||
|
await page.click("(//div[@id='select-passport-country'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันที่ออกหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//div[text()='2'])[1]");
|
||||||
|
await page.click("(//input[@aria-label='วันหมดอายุหนังสือเดินทาง'])[2]");
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2574']");
|
||||||
|
await page.click("//div[text()='8']");
|
||||||
|
await page.click('id=submitBtn');
|
||||||
|
await page.click('id=btn-ok-dialog');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Selete Filter Employee Active', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click('id=tab-employee');
|
||||||
|
await page.fill('id=input-search', 'ปองพล กันธะณะ');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'ปองพล');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'กันธะณะ');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'ไทย');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', '6282282246226');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'TH2862242226262');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.fill('id=input-search', 'บางรัก');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Selete Filter Employee Active', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click('id=tab-employee');
|
||||||
|
await page.click('id=select-status');
|
||||||
|
await page.click('id=select-status_1');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Selete Filter Employee Inative', async () => {
|
||||||
|
await page.click('id=select-status');
|
||||||
|
await page.click('id=select-status_2');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Selete Filter Employee All', async () => {
|
||||||
|
await page.click('id=select-status');
|
||||||
|
await page.click('id=select-status_0');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select Detail Employee', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click('id=tab-employee');
|
||||||
|
await page.click("//button[@id='btn-dots-CORP000003-01-240003']");
|
||||||
|
await page.click('id=view-detail-btn-undefined-view');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Edit Employee', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click('id=tab-employee');
|
||||||
|
await page.click("//button[@id='btn-dots-CORP000003-01-240003']");
|
||||||
|
await page.click('id=view-detail-btn-undefined-edit');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Delete Employee', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click('id=tab-employee');
|
||||||
|
await page.click("//button[@id='btn-dots-CORP000003-01-240003']");
|
||||||
|
await page.click('id=view-detail-btn-undefined-edit');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -24,16 +24,17 @@ test('Login', async () => {
|
||||||
// await page.click('id=acceptBtn');
|
// await page.click('id=acceptBtn');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Status Close Personnel', async () => {
|
test('Status off Employee', async () => {
|
||||||
await page.click('id=menu-icon-personnel-management');
|
await page.click('id=menu-icon-customer-management');
|
||||||
await page.click("(//div[@class='full-width text-right']//button)[1]");
|
await page.click('id=tab-employee');
|
||||||
await page.click("//div[contains(@class,'q-toggle__thumb absolute')]");
|
await page.click("//button[@id='btn-dots-PERS000001-01-240001']");
|
||||||
await page.keyboard.press('Escape');
|
await page.click('id=view-detail-btn-undefined-status');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Status Open Personnel', async () => {
|
test('Status on Employee', async () => {
|
||||||
await page.click("(//div[@class='full-width text-right']//button)[1]");
|
await page.click("//button[@id='btn-dots-PERS000001-01-240001']");
|
||||||
await page.click("//div[contains(@class,'q-toggle__thumb absolute')]");
|
await page.click('id=view-detail-btn-undefined-status');
|
||||||
await page.waitForTimeout(2000);
|
await page.waitForTimeout(2000);
|
||||||
});
|
});
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
import { escape } from 'querystring';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select Dropdown Employee Type Off', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click('id=tab-employee');
|
||||||
|
await page.click('id=select-field');
|
||||||
|
await page.click('id=select-field_0');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_1');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_2');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_3');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_4');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_5');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_6');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_7');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select Dropdown Employee Type on', async () => {
|
||||||
|
await page.click('id=select-field');
|
||||||
|
await page.click('id=select-field_0');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_1');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_2');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_3');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_4');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_5');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_6');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.click('id=select-field_7');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
await page.keyboard.press('Escape');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Open Natural Person', async () => {
|
||||||
|
await page.click('id=menu-icon-customer-management');
|
||||||
|
await page.click('id=row-table-โคโม่');
|
||||||
|
await page.click("(//div[@id='btn-add']//a)[1]");
|
||||||
|
await page.click("(//div[@id='btn-add']//div)[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Sub Branch Natural Person', async () => {
|
||||||
|
await page.fill('id=form-dialog-input-branch-no', '20');
|
||||||
|
await page.fill('id=form-dialog-input-customer-name', 'สยาม');
|
||||||
|
await page.fill('id=form-dialog-input-customer-english-name', 'siam');
|
||||||
|
await page.fill('id=form-dialog-input-address-0', '20/022');
|
||||||
|
await page.click('id=form-dialog-select-province-0');
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click('id=form-dialog-select-district-0');
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.click('id=form-dialog-select-sub-district-0');
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
await page.click("//div[@role='option']");
|
||||||
|
await page.fill('id=form-dialog-input-address-en-0', '20/022');
|
||||||
|
await page.fill('id=form-dialog-input-employment-office', 'กรุงเทพมหานคร');
|
||||||
|
await page.click('id=form-dialog-select-business-type');
|
||||||
|
await page.click("//span[text()='ประมง']");
|
||||||
|
await page.click("(//div[@id='form-dialog-select-job-position'])[1]");
|
||||||
|
await page.click("(//div[@role='option'])[1]");
|
||||||
|
await page.fill(
|
||||||
|
'id=form-dialog-input-job-description',
|
||||||
|
'ตรวจสอบการทำการลักษณะงาน',
|
||||||
|
);
|
||||||
|
await page.click('id=form-dialog-input-start-date');
|
||||||
|
await page.click("(//button[@class='dp__btn dp__month_year_select'])[2]");
|
||||||
|
await page.click("//div[text()='2561']");
|
||||||
|
await page.click("//div[text()='12']");
|
||||||
|
await page.fill('id=form-dialog-input-sales-person', 'พนักงานขาย');
|
||||||
|
await page.fill('id=form-dialog-input-mail', 'jws@local.com');
|
||||||
|
await page.fill('id=form-dialog-input-telephone', '0864228464');
|
||||||
|
// await page.setInputFiles(
|
||||||
|
// "//input[@id='f_55bbcb5d-4316-43c8-93cf-99c4f1f60115']",
|
||||||
|
// '/Users/linping/Desktop/Chamomind&FrappeT/JWS_TestScript/tests/Datafile/Pic1.jpg',
|
||||||
|
// ); // UploadFile
|
||||||
|
await page.click("(//button[@id='submitBtn'])[2]");
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
@ -24,10 +24,8 @@ test('Login', async () => {
|
||||||
// await page.click('id=acceptBtn');
|
// await page.click('id=acceptBtn');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('View Detail', async () => {
|
test('Open Legal Entitly ', async () => {
|
||||||
await page.click('id=menu-icon-branch-management');
|
await page.click('id=menu-icon-customer-management');
|
||||||
await page.click('id=view-detail-btn-สีลม');
|
|
||||||
await page.click('id=view-detail-btn-สีลม-view');
|
await page.waitForTimeout(2000);
|
||||||
await page.waitForTimeout(4000);
|
|
||||||
await page.click('id=closeDialog');
|
|
||||||
});
|
});
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
import { test, expect, Page } from '@playwright/test';
|
||||||
|
import { strictEqual } from 'assert';
|
||||||
|
|
||||||
|
let page: Page;
|
||||||
|
|
||||||
|
test.beforeAll(async ({ browser }) => {
|
||||||
|
page = await browser.newPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterAll(async () => {
|
||||||
|
if (page !== undefined) {
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Login', async () => {
|
||||||
|
// Login
|
||||||
|
await page.goto('http://192.168.1.90:20001/');
|
||||||
|
await expect(page).toHaveTitle(/^Sign in to /);
|
||||||
|
await page.fill("input[name='username']", 'admin');
|
||||||
|
await page.fill("input[name='password']", '1234');
|
||||||
|
await page.click('id=kc-login');
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
// await page.click('id=acceptBtn');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเพิ่มกลุ่มสินค้าและบริการ', async () => {
|
||||||
|
await page.click('id=menu-icon-product-service');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// เพิ่มกลุ่มสินค้าและบริการ
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-product-group');
|
||||||
|
|
||||||
|
// กรอกข้อมูลกลุ่มสินค้าและบริการ
|
||||||
|
await page.fill("(//input[@id='input-name'])[2]", 'ประกัน');
|
||||||
|
await page.fill("(//textarea[@id='input-detail'])[2]", 'รายละเอียดประกัน');
|
||||||
|
await page.fill("(//textarea[@id='input-remark'])[2]", 'หมายเหตุประกัน');
|
||||||
|
|
||||||
|
// บันทึกการสร้างกลุ่มสินค้นและบริการ
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
// ตรวจสอบหลังทำการสร้างกลุ่มสินค้าและบริการ
|
||||||
|
const newProductAndServiceLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ประกัน']",
|
||||||
|
);
|
||||||
|
await newProductAndServiceLocator.waitFor({ state: 'visible' });
|
||||||
|
|
||||||
|
// ดึงข้อความให้ตรงจาก XPath
|
||||||
|
|
||||||
|
const newProductAndServiceName =
|
||||||
|
await newProductAndServiceLocator.textContent();
|
||||||
|
|
||||||
|
// ตรวจสอบความถูกต้องหลังทำการสร้างกลุ่มสินค้าและบริการ
|
||||||
|
if (newProductAndServiceName !== null) {
|
||||||
|
const trimmedName = newProductAndServiceName.trim();
|
||||||
|
expect(trimmedName).toBe('ประกัน');
|
||||||
|
console.log('การตรวจสอบสำเร็จ : ถูกต้อง');
|
||||||
|
} else {
|
||||||
|
throw new Error('ไม่พบข้อมูลที่บันทึก');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดการในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ทดสอบการเพิ่มประเภท', async () => {
|
||||||
|
// เข้าสู่หน้าหลุ่มสินค้าและบริการ
|
||||||
|
await page.click("(//div[@id='tree-enter-ประกัน']//div)[1]");
|
||||||
|
|
||||||
|
try {
|
||||||
|
// เพิ่มกลุ่มสินค้าและบริการ
|
||||||
|
await page.click('id=btn-add');
|
||||||
|
await page.click('id=btn-add-service');
|
||||||
|
|
||||||
|
// กรอกข้อมูลประเภทส่วน "ข้อมูลประเภท"
|
||||||
|
await page.fill('id=input-service-code', 'MOU');
|
||||||
|
await page.fill('id=input-service-name', 'ประกันภัยแบบกลุ่ม');
|
||||||
|
await page.fill('id=input-service-description', 'รายละเอียดประภัยแบบกลุ่ม');
|
||||||
|
|
||||||
|
// เพิ่มคุณสมบัติส่วน "คุณสมบัติของประเภท"
|
||||||
|
await page.click('id=btn-capitalize');
|
||||||
|
|
||||||
|
// บันทึกการสร้างกลุ่มสินค้นและบริการ
|
||||||
|
await page.click('id=btn-form-submit');
|
||||||
|
|
||||||
|
// ตรวจสอบหลังทำการสร้างกลุ่มสินค้าและบริการ
|
||||||
|
const newProductAndServiceLocator = page.locator(
|
||||||
|
"//div[normalize-space(text())='ประกัน']",
|
||||||
|
);
|
||||||
|
await newProductAndServiceLocator.waitFor({ state: 'visible' });
|
||||||
|
|
||||||
|
// ดึงข้อความให้ตรงจาก XPath
|
||||||
|
|
||||||
|
const newProductAndServiceName =
|
||||||
|
await newProductAndServiceLocator.textContent();
|
||||||
|
|
||||||
|
// ตรวจสอบความถูกต้องหลังทำการสร้างกลุ่มสินค้าและบริการ
|
||||||
|
if (newProductAndServiceName !== null) {
|
||||||
|
const trimmedName = newProductAndServiceName.trim();
|
||||||
|
expect(trimmedName).toBe('ประกัน');
|
||||||
|
console.log('การตรวจสอบสำเร็จ : ถูกต้อง');
|
||||||
|
} else {
|
||||||
|
throw new Error('ไม่พบข้อมูลที่บันทึก');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('เกิดข้อผิดการในการทดสอบ');
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
});
|
||||||
BIN
tests/Datafile/Pic1.jpg
Normal file
BIN
tests/Datafile/Pic1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
Loading…
Add table
Add a link
Reference in a new issue