From 54afc865ce07bf3c465f6cbe0e7f14698062effd Mon Sep 17 00:00:00 2001 From: ajaxzheng <894103554@qq.com> Date: Mon, 21 Oct 2024 19:36:12 +0800 Subject: [PATCH] test(e2e): update some components e2e test --- .../demos/pc/app/dialog-box/destroy-on-close.spec.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/sites/demos/pc/app/dialog-box/destroy-on-close.spec.ts b/examples/sites/demos/pc/app/dialog-box/destroy-on-close.spec.ts index dae40d2b70..f6947cd398 100644 --- a/examples/sites/demos/pc/app/dialog-box/destroy-on-close.spec.ts +++ b/examples/sites/demos/pc/app/dialog-box/destroy-on-close.spec.ts @@ -5,13 +5,14 @@ test('关闭时销毁主体元素', async ({ page }) => { const dialogBox = page.locator('.tiny-dialog-box') await page.goto('dialog-box#destroy-on-close') const demo = page.locator('#destroy-on-close') - await demo.getByRole('button', { name: '打开弹框' }).click() - await demo.getByLabel('Close').click() + await demo.locator('label').filter({ hasText: '关闭时不销毁' }).click() await demo.getByRole('button', { name: '打开弹框' }).click() - await page.getByRole('button', { name: '确定' }).click() + await demo.locator('.tiny-dialog-box__footer').getByRole('button', { name: '确定' }).click() + await expect(dialogBox).toBeHidden() + await demo.locator('label').filter({ hasText: '关闭时销毁' }).click() await demo.getByRole('button', { name: '打开弹框' }).click() - await page.getByRole('button', { name: '确定' }).click() - await expect(dialogBox).toBeHidden() + await demo.locator('.tiny-dialog-box__footer').getByRole('button', { name: '确定' }).click() + await expect(dialogBox).toHaveCount(0) })