This commit is contained in:
LingandRX 2024-11-07 22:31:42 +08:00
parent db0603dcfd
commit d870c80378
3 changed files with 12 additions and 16 deletions

View File

@ -24,7 +24,7 @@ module.exports = defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
retries: process.env.CI ? 1 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */

View File

@ -4,7 +4,6 @@ const { faker } = require('@faker-js/faker/locale/zh_CN');
test('登录touch和h5创建顾客购买会员卡使用顾客账号到h5商城购买货品', async ({
touchPage,
h5Page,
touchCustomerPage,
h5LoginPage,
}) => {
@ -12,15 +11,12 @@ test('登录touch和h5创建顾客购买会员卡使用顾客账号到h5
const customer = new Customer(1, 1, { phone: phone });
await touchCustomerPage.createCustomer(customer);
/** @type string*/
let cardName;
await test.step('在touch页面购买会员卡', async () => {
await touchPage.getByText('去开单').click();
await touchPage.locator('.more > .icon > svg').click();
await touchPage.getByText('去开卡').click();
const $firstCard = touchPage.locator('.memberCard_box').first();
await $firstCard.click();
cardName = await $firstCard.locator('.card_name').innerText();
await touchPage.getByRole('button', { name: '去结算' }).click();
await touchPage.locator('.row').filter({ hasText: '总额' }).locator('.touchIcon').click();
await touchPage.getByPlaceholder('请输入内容').fill('1000');
@ -30,6 +26,7 @@ test('登录touch和h5创建顾客购买会员卡使用顾客账号到h5
await touchPage.getByLabel('结算签字').uncheck();
await touchPage.getByRole('button', { name: /结\s算/ }).click();
await touchPage.getByRole('button', { name: /跳\s过/ }).click();
await touchPage.close();
});
await test.step('登录h5并且商城页面使用会员卡进行购买', async () => {

View File

@ -39,18 +39,17 @@ test('demo', async ({ mgjPage, customerPage }) => {
await expect($signature).not.toHaveClass(/checked/, { timeout: 2000 });
}).toPass();
await expect(async () => {
const $cashBtn = mgjPage.locator('#page_pay .pay_cash');
await expect(async () => {
if ($cashBtn.isVisible()) {
await $cashBtn.click();
await expect(mgjPage.locator('#page_pay .pay_cash.selected')).toBeVisible();
}
await expect(mgjPage.locator('#page_pay .pay_cash.selected')).toBeVisible({ timeout: 2000 });
}).toPass();
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();
await expect(mgjPage.getByText('顾客满意度点评')).toBeVisible();
});
});