更新测试用例以使用 waitFor 方法替代超时检查,提升稳定性和可读性
This commit is contained in:
parent
5247b50c0c
commit
73cce24b80
@ -65,7 +65,7 @@ test('csv', async ({ zhbPage }) => {
|
||||
.click();
|
||||
await expect(async () => {
|
||||
await zhbPage.getByRole('button', { name: '完成开单' }).click();
|
||||
await expect(zhbPage.getByRole('button', { name: '结账' })).toBeVisible({ timeout: 2000 });
|
||||
await zhbPage.getByRole('button', { name: '结账' }).waitFor();
|
||||
}).toPass();
|
||||
await zhbPage.getByRole('button', { name: '结账' }).click();
|
||||
await zhbPage.locator('#page_footBathPay').getByText('结算签字').click();
|
||||
@ -73,8 +73,7 @@ test('csv', async ({ zhbPage }) => {
|
||||
await expect(async () => {
|
||||
await zhbPage.locator('#page_footBathPay li').filter({ hasText: '现金' }).click();
|
||||
await expect(zhbPage.locator('#page_footBathPay li').filter({ hasText: '现金' })).toHaveClass(
|
||||
/selected/,
|
||||
{ timeout: 2000 }
|
||||
/selected/
|
||||
);
|
||||
}).toPass();
|
||||
await zhbPage
|
||||
@ -95,8 +94,10 @@ test('csv', async ({ zhbPage }) => {
|
||||
await expect($cleanRoom).toContainText('已结清');
|
||||
await $cleanRoom.click();
|
||||
await zhbPage.getByText('技师操作').click();
|
||||
await zhbPage.getByText('起钟', { exact: true }).click();
|
||||
await zhbPage.getByText('起钟成功!').click();
|
||||
await expect(async () => {
|
||||
await zhbPage.getByText('起钟', { exact: true }).click();
|
||||
await zhbPage.getByText('起钟成功!').waitFor();
|
||||
}).toPass();
|
||||
await zhbPage.getByText('技师操作').click();
|
||||
await zhbPage.getByText('下钟', { exact: true }).click();
|
||||
await zhbPage
|
||||
|
||||
Reference in New Issue
Block a user