This commit is contained in:
rsgltzyd 2024-10-15 23:08:45 +08:00
parent 1b4ae5fa85
commit 392fb7487b

View File

@ -18,7 +18,7 @@ const { faker } = require('@faker-js/faker/locale/zh_CN');
// // Expects page to have a heading with the name of Installation.
// await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
// });
test('登录touch和h5购买会员卡到h5商城购买货品', async ({
test('登录touch和h5创建顾客购买会员卡,使用顾客账号到h5商城购买货品', async ({
touchPage,
h5Page,
touchCustomerPage,
@ -28,44 +28,46 @@ test('登录touch和h5购买会员卡到h5商城购买货品', async ({
const customer = new Customer(1, 1, { phone: phone });
await touchCustomerPage.createCustomer(customer);
//在touch页面购买会员卡
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();
const 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');
await touchPage.locator('div').filter({ hasText: /^789$/ }).getByRole('button').nth(3).click();
await touchPage.locator('.paymentInfoItem', { hasText: '现金' }).click();
await touchPage.getByText('推送消费提醒').click();
await touchPage.getByLabel('结算签字').uncheck();
await touchPage.getByRole('button', { name: /结\s算/ }).click();
await touchPage.getByRole('button', { name: /跳\s过/ }).click();
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();
const 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');
await touchPage.locator('div').filter({ hasText: /^789$/ }).getByRole('button').nth(3).click();
await touchPage.locator('.paymentInfoItem', { hasText: '现金' }).click();
await touchPage.getByText('推送消费提醒').click();
await touchPage.getByLabel('结算签字').uncheck();
await touchPage.getByRole('button', { name: /结\s算/ }).click();
await touchPage.getByRole('button', { name: /跳\s过/ }).click();
});
//在h5商城页面使用会员卡进行购买
await h5LoginPage.login(customer.phone);
await h5Page.locator('.singIn_content > .iconfont').click();
await h5Page.locator('.get_btn').click();
await h5Page.locator('.back').click();
await h5Page.locator('.bar_item', { hasText: '商城' }).click();
await expect(h5Page.locator('.title', { hasText: '商城' })).toBeVisible();
await h5Page.locator('.li span', { hasText: '全部' }).click();
await h5Page.locator('.p-item').first().click();
await h5Page.waitForLoadState();
await h5Page.getByText('立即购买').click();
await h5Page
.locator('.goodsClassBoxMain .footerBug_true_all')
.filter({ hasText: '确定' })
.click();
await h5Page.locator('.mgj-picker-head .mgj-picker-btn').filter({ hasText: '确认' }).click();
await expect(h5Page.locator('.pay-way .form_row', { hasText: cardName })).toHaveClass(
/click-able/
);
await expect(h5Page.getByText('确认支付')).toBeEnabled();
await h5Page.getByText('确认支付').click();
await expect(h5Page.getByText('支付成功').first()).toBeVisible();
await expect(h5Page.getByText('查看订单')).toBeVisible();
await test.step('登录h5并且商城页面使用会员卡进行购买', async () => {
await h5LoginPage.login(customer.phone);
await h5Page.locator('.singIn_content > .iconfont').click();
await h5Page.locator('.get_btn').click();
await h5Page.locator('.back').click();
await h5Page.locator('.bar_item', { hasText: '商城' }).click();
await expect(h5Page.locator('.title', { hasText: '商城' })).toBeVisible();
await h5Page.locator('.li span', { hasText: '全部' }).click();
await h5Page.locator('.p-item').first().click();
await h5Page.waitForLoadState();
await h5Page.getByText('立即购买').click();
await h5Page
.locator('.goodsClassBoxMain .footerBug_true_all')
.filter({ hasText: '确定' })
.click();
await h5Page.locator('.mgj-picker-head .mgj-picker-btn').filter({ hasText: '确认' }).click();
await expect(h5Page.locator('.pay-way .form_row', { hasText: cardName })).toHaveClass(
/click-able/
);
await expect(h5Page.getByText('确认支付')).toBeEnabled();
await h5Page.getByText('确认支付').click();
await expect(h5Page.getByText('支付成功').first()).toBeVisible();
await expect(h5Page.getByText('查看订单')).toBeVisible();
});
});