更新 Playwright 配置以增加超时设置,重构测试用例以提高可读性和结构清晰度
This commit is contained in:
parent
44a701cbed
commit
be91605c3c
@ -30,6 +30,12 @@ module.exports = defineConfig({
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: 'html',
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
timeout: 5 * 60000,
|
||||
expect: {
|
||||
toPass: {
|
||||
timeout: 30000,
|
||||
},
|
||||
},
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: process.env.BASE_URL,
|
||||
|
||||
@ -8,11 +8,11 @@ test.describe
|
||||
const customer = new Customer(1, 1, { phone: phone });
|
||||
console.log(`${customer.phone}-${customer.username}`);
|
||||
|
||||
test('创建顾客', async ({ touchCustomerPage }) => {
|
||||
test('登录touch和h5,创建顾客购买会员卡', async ({ touchPage, touchCustomerPage }) => {
|
||||
await test.step('创建顾客', async () => {
|
||||
await touchCustomerPage.createCustomer(customer);
|
||||
});
|
||||
|
||||
test('登录touch和h5,创建顾客购买会员卡', async ({ touchPage }) => {
|
||||
await test.step('在touch页面购买会员卡', async () => {
|
||||
await touchPage.getByText('去开单').click();
|
||||
await touchPage.locator('.more > .icon > svg').click();
|
||||
|
||||
@ -65,8 +65,10 @@ test('csv', async ({ zhbPage }, workerInfo) => {
|
||||
.locator('span')
|
||||
.first()
|
||||
.click();
|
||||
await expect(async () => {
|
||||
await zhbPage.getByRole('button', { name: '完成开单' }).click();
|
||||
await expect(zhbPage.getByRole('button', { name: '结账' })).toBeVisible();
|
||||
await expect(zhbPage.getByRole('button', { name: '结账' })).toBeVisible({ timeout: 2000 });
|
||||
}).toPass();
|
||||
await zhbPage.getByRole('button', { name: '结账' }).click();
|
||||
await zhbPage.locator('#page_footBathPay').getByText('结算签字').click();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user