ii
This commit is contained in:
parent
2134398e49
commit
919325202b
@ -2,7 +2,7 @@ const { test, expect } = require('./fixtures/common');
|
||||
const { Customer } = require('./pom/customer');
|
||||
const { faker } = require('@faker-js/faker/locale/zh_CN');
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
test(`登录touch和h5,创建顾客购买会员卡,使用顾客账号到h5商城购买货品${i}`, async ({
|
||||
touchPage,
|
||||
h5Page,
|
||||
|
||||
@ -2,8 +2,7 @@ const { faker } = require('@faker-js/faker');
|
||||
const { test, expect } = require('./fixture/common');
|
||||
const { Customer } = require('./pom/customerPage');
|
||||
|
||||
for (let i = 0; i < 50; i++) {
|
||||
test(`demo${i}`, async ({ zhbPage, customerPage }, workerInfo) => {
|
||||
test(`demo`, async ({ zhbPage, customerPage }, workerInfo) => {
|
||||
const $area = zhbPage
|
||||
.locator('.area')
|
||||
.filter({ has: zhbPage.locator('.area-name', { hasText: '二楼' }) });
|
||||
@ -18,7 +17,9 @@ for (let i = 0; i < 50; i++) {
|
||||
let useRoomName;
|
||||
await test.step('购买商品', async () => {
|
||||
await zhbPage.locator('#tab_main li').filter({ hasText: '营业' }).click();
|
||||
const $emptyRoom = $$room.filter({ has: zhbPage.getByText('空房') }).nth(workerInfo.workerIndex % 3);
|
||||
const $emptyRoom = $$room
|
||||
.filter({ has: zhbPage.getByText('空房') })
|
||||
.nth(workerInfo.workerIndex % 3);
|
||||
useRoomName = await $emptyRoom.locator('.roomName').innerText();
|
||||
expect(useRoomName).not.toBeNull();
|
||||
await $emptyRoom.click();
|
||||
@ -26,7 +27,7 @@ for (let i = 0; i < 50; i++) {
|
||||
if (await zhbPage.locator('.close > .iconfont').first().isVisible()) {
|
||||
await zhbPage.locator('.close > .iconfont').first().click();
|
||||
}
|
||||
await zhbPage.getByRole('button', { name: '选择顾客' }).click();
|
||||
await zhbPage.getByRole('button', { name: '选择顾客' }).click({ timeout: 3000 });
|
||||
await expect(zhbPage.locator('#page_searchMember').getByText('创建会员')).toBeVisible();
|
||||
}).toPass();
|
||||
await zhbPage
|
||||
@ -43,7 +44,10 @@ for (let i = 0; i < 50; i++) {
|
||||
await expect(zhbPage.locator('#page_roomDetail').getByText('服务项目')).toBeVisible();
|
||||
await zhbPage.getByText('选择', { exact: true }).nth(1).click();
|
||||
await expect(zhbPage.locator('#serviceSelector').getByText('项目选择')).toBeVisible();
|
||||
await zhbPage.locator('.goods-content-item').nth(faker.number.int(30)).click();
|
||||
await zhbPage
|
||||
.locator('.goods-content-item')
|
||||
.nth(faker.number.int({ min: 0, max: 14 }))
|
||||
.click();
|
||||
await zhbPage.locator('#serviceSelector').getByText('确认').click();
|
||||
await zhbPage
|
||||
.locator('div')
|
||||
@ -52,15 +56,15 @@ for (let i = 0; i < 50; i++) {
|
||||
.first()
|
||||
.click();
|
||||
await zhbPage.getByRole('button', { name: '完成开单' }).click();
|
||||
await expect(zhbPage.getByRole('button', { name: '结账' })).toBeVisible();
|
||||
await expect(zhbPage.getByRole('button', { name: '结账' })).toBeVisible({ timeout: 30_000 });
|
||||
await zhbPage.getByRole('button', { name: '结账' }).click();
|
||||
await zhbPage.locator('#page_footBathPay').getByText('结算签字').click();
|
||||
|
||||
await expect(async () => {
|
||||
await zhbPage.locator('#page_footBathPay li').filter({ hasText: '现金' }).click();
|
||||
await expect(
|
||||
zhbPage.locator('#page_footBathPay li').filter({ hasText: '现金' })
|
||||
).toHaveClass(/selected/);
|
||||
await expect(zhbPage.locator('#page_footBathPay li').filter({ hasText: '现金' })).toHaveClass(
|
||||
/selected/
|
||||
);
|
||||
await zhbPage
|
||||
.locator('#page_footBathPay span')
|
||||
.filter({ hasText: /结\s算/ })
|
||||
@ -69,7 +73,7 @@ for (let i = 0; i < 50; i++) {
|
||||
}).toPass();
|
||||
|
||||
await zhbPage.getByText('不想评价').click();
|
||||
await expect(zhbPage.locator('#page_footBathPay').getByText('立即返回')).not.toBeVisible();
|
||||
await zhbPage.locator('#page_footBathPay').getByText('立即返回').click();
|
||||
});
|
||||
|
||||
await test.step('起钟下钟,清理房间', async () => {
|
||||
@ -101,8 +105,7 @@ for (let i = 0; i < 50; i++) {
|
||||
.click();
|
||||
await expect($cleanRoom).toContainText('空房');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
test.skip('h5 demo', async ({
|
||||
zhbAdminPage,
|
||||
|
||||
@ -34,7 +34,7 @@ export class CustomerPage {
|
||||
await this.page.getByPlaceholder('请输入手机号码').click();
|
||||
await expect(this.page.getByText('请输入数字')).toBeVisible();
|
||||
await this.page.getByPlaceholder('在此输入').click();
|
||||
await this.page.keyboard.type(customer.phone, { delay: 100 });
|
||||
await this.page.keyboard.type(customer.phone, { delay: 50 });
|
||||
// await this.page.getByPlaceholder('在此输入').type(customer.phone, { delay: 100 });
|
||||
await this.page.locator('#maskBoard').getByText('确认').click();
|
||||
await expect(this.page.getByPlaceholder('请输入手机号码')).toHaveValue(customer.phone, {
|
||||
|
||||
Reference in New Issue
Block a user