test: Create Script JWS Branch Management

This commit is contained in:
Linpiing 2024-06-13 17:19:03 +07:00
parent 791f01a9f0
commit 61f99e7f6f
12 changed files with 674 additions and 18 deletions

View file

@ -0,0 +1,58 @@
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);
});