test : Create Script Role&Permission
This commit is contained in:
parent
5bc28bf893
commit
9254c0183e
67 changed files with 11224 additions and 729 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { test, expect, Page } from '@playwright/test';
|
||||
import { strictEqual } from 'assert';
|
||||
import exp from 'constants';
|
||||
|
||||
let page: Page;
|
||||
|
||||
|
|
@ -24,106 +25,122 @@ test('Login', async () => {
|
|||
// 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=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.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.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.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
||||
await page.click('id=submitBtn');
|
||||
await page.fill("(//input[@id='input-abbreviation'])[2]", 'ภาษาไทย');
|
||||
const invalidDataabbreviationError = page.locator(
|
||||
// ตรวจสอบการแสดง Validation แจ้งเตือนชื่อย่อในกรณีที่ไม่ใช้ภาษาอังกฤษ
|
||||
"(//div[contains(@class,'q-field__bottom row')])[1]",
|
||||
);
|
||||
|
||||
await expect(invalidDataabbreviationError).toHaveText(
|
||||
'ข้อมูลไม่ถูกต้อง โปรดใช้เฉพาะตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น',
|
||||
{
|
||||
timeout: 2000,
|
||||
},
|
||||
);
|
||||
console.log(
|
||||
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่ไม่ใช่ภาษาอังกฤษถูกต้อง',
|
||||
);
|
||||
|
||||
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.fill("(//input[@id='input-tax-no'])[2]", '1260846220284');
|
||||
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.fill("(//input[@id='input-address-en'])[2]", '20/02');
|
||||
await page.click('id=submitBtn');
|
||||
await page.fill("(//input[@id='input-tax-no'])[2]", '123');
|
||||
const taxNoError = page.locator(
|
||||
// ตรวจสอบการแสดง Validation แจ้งเตือนชื่อย่อในกรณีที่ไม่ใช้ภาษาอังกฤษ
|
||||
"(//div[@class='q-field__messages col']//div)[2]",
|
||||
);
|
||||
|
||||
await expect(taxNoError).toHaveText(
|
||||
'ข้อมูลไม่ถูกต้อง กรุณากรอกให้ครบ 13 หลัก',
|
||||
{
|
||||
timeout: 2000,
|
||||
},
|
||||
);
|
||||
console.log(
|
||||
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่กรอกทะเบียนนิติบุคคลเลขที่ไม่ครบ 13 หลัก',
|
||||
);
|
||||
|
||||
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.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.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]");
|
||||
});
|
||||
await page.fill("(//input[@id='input-email'])[2]", '123');
|
||||
const emailError = page.locator(
|
||||
// ตรวจสอบการแสดง Validation แจ้งเตือนในกรณีที่กรอกอีเมลไม่ถูกรูปแบบ
|
||||
"(//div[@class='q-field__messages col']//div)[2]",
|
||||
);
|
||||
|
||||
test('Create Branch Managenment Not input Address TH ', 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.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]");
|
||||
});
|
||||
await expect(emailError).toHaveText('ข้อมูลไม่ถูกต้อง', {
|
||||
timeout: 2000,
|
||||
});
|
||||
console.log(
|
||||
'ตรวจสอบการแสดง Vidation แจ้งเตือนในกรณีที่กรอกอีเมลไม่ถูกรูปแบบ',
|
||||
);
|
||||
|
||||
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.click("(//button[@id='closeDialog'])[2]");
|
||||
});
|
||||
|
||||
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]");
|
||||
await page.click('id=btn-form-cancel');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue