Some checks are pending
Playwright Tests / test (push) Waiting to run
init test test test 划分美管加、慧来客、智荟宝项目 新增美管加demo 新增npm命令 测试智荟宝 test test ii csv test init test test init init
57 lines
2.2 KiB
JavaScript
57 lines
2.2 KiB
JavaScript
const { test, expect } = require('./fixture/common');
|
|
const { Customer } = require('./pom/customerPage');
|
|
|
|
test('demo', async ({ mgjPage, customerPage }) => {
|
|
await test.step('创建顾客', async () => {
|
|
await expect(mgjPage.locator('#autoStationTip').getByText('我知道了')).toBeVisible();
|
|
await mgjPage.locator('#autoStationTip').getByText('我知道了').click();
|
|
await mgjPage.locator('#tab_main li').filter({ hasText: '顾客' }).click();
|
|
const customer = new Customer();
|
|
await customerPage.createCustomer(customer);
|
|
});
|
|
|
|
await test.step('开单结算,购买第一个项目', async () => {
|
|
await mgjPage.getByText('去开单').click();
|
|
await mgjPage.locator('span').filter({ hasText: '确认开单' }).click();
|
|
const firstEnabledElement = mgjPage
|
|
.locator('#createService .content ul .am-clickable:not(.am-disabled)')
|
|
.first();
|
|
await mgjPage.waitForTimeout(1000);
|
|
await firstEnabledElement.click();
|
|
|
|
await expect(
|
|
mgjPage.locator('#cashierTotalPanel span').filter({ hasText: /结\s算/ })
|
|
).toBeVisible();
|
|
|
|
await mgjPage.waitForTimeout(1000);
|
|
|
|
// 选择第一个项目
|
|
await mgjPage.locator('.cashierItems .am-clickable').first().click();
|
|
await expect(mgjPage.locator('.cashierBox tbody tr.am-clickable').first()).toBeVisible();
|
|
await mgjPage
|
|
.locator('#cashierTotalPanel span')
|
|
.filter({ hasText: /结\s算/ })
|
|
.click();
|
|
|
|
await expect(async () => {
|
|
const $signature = mgjPage.locator('#page_pay').getByText('结算签字');
|
|
await $signature.click();
|
|
await expect($signature).not.toHaveClass(/checked/, { timeout: 2000 });
|
|
}).toPass();
|
|
|
|
await expect(async () => {
|
|
const $cashBtn = mgjPage.locator('#page_pay .pay_cash');
|
|
await $cashBtn.click();
|
|
await expect(mgjPage.locator('#page_pay .pay_cash.selected')).toBeVisible();
|
|
await mgjPage
|
|
.locator('#page_pay span')
|
|
.filter({ hasText: /结\s算/ })
|
|
.click();
|
|
await expect(mgjPage.getByText('顾客满意度点评')).toBeVisible({ timeout: 2000 });
|
|
}).toPass();
|
|
|
|
await mgjPage.getByText('不想评价').click();
|
|
await expect(mgjPage.locator('#page_footBathPay').getByText('立即返回')).not.toBeVisible();
|
|
});
|
|
});
|