From c6e57b5fd447c0db94ed1a8cf42d7b3b85642943 Mon Sep 17 00:00:00 2001 From: ajaxzheng <894103554@qq.com> Date: Mon, 2 Dec 2024 16:42:33 +0800 Subject: [PATCH] =?UTF-8?q?test(e2e):=20fix=20input=E3=80=81link=E3=80=81p?= =?UTF-8?q?opeditor=20error=20e2e=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pc/app/input/resize-composition-api.vue | 18 +++++++------ .../sites/demos/pc/app/input/resize.spec.ts | 6 +++-- examples/sites/demos/pc/app/input/resize.vue | 18 +++++++------ .../demos/pc/app/link/basic-usage.spec.ts | 4 +-- .../pc/app/popeditor/condition-form.spec.ts | 27 +++++++------------ 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/examples/sites/demos/pc/app/input/resize-composition-api.vue b/examples/sites/demos/pc/app/input/resize-composition-api.vue index c15a78c724..a42017622e 100644 --- a/examples/sites/demos/pc/app/input/resize-composition-api.vue +++ b/examples/sites/demos/pc/app/input/resize-composition-api.vue @@ -5,14 +5,16 @@ -

autosize

- - +
+

autosize

+ + +

hover-expand

{ page.on('pageerror', (exception) => expect(exception).toBeNull()) await page.goto('input#resize') - const textarea = await page.locator('.demo-input .tiny-textarea > .tiny-textarea-display-only > textarea') + + const demo = page.locator('#resize') + const textarea = await demo.locator('.tiny-textarea > .tiny-textarea-display-only > textarea') await expect(textarea.nth(0)).toHaveCSS('resize', 'vertical') await expect(textarea.nth(1)).toHaveCSS('resize', 'none') await expect(textarea.nth(2)).toHaveCSS('resize', 'both') @@ -12,7 +14,7 @@ test('可缩放文本域', async ({ page }) => { const fillText = 'test1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' - const textarea2 = page.locator('.demo-input .tiny-textarea .tiny-textarea-autosize-display-only > textarea') + const textarea2 = demo.locator('.auto-size .tiny-textarea textarea') // autosize = { minRows: 2, maxRows: 3 } 检查高度 let defaultHeight = await textarea2 diff --git a/examples/sites/demos/pc/app/input/resize.vue b/examples/sites/demos/pc/app/input/resize.vue index 00b5957b4f..e1066a90c9 100644 --- a/examples/sites/demos/pc/app/input/resize.vue +++ b/examples/sites/demos/pc/app/input/resize.vue @@ -6,14 +6,16 @@ -

autosize

- - +
+

autosize

+ + +

hover-expand

{ const preview = page.locator('#basic-usage') const link = preview.locator('a') - await expect(link.first()).toHaveText('默认链接') - await expect(link.nth(1)).toHaveText('默认链接2') await link.first().hover() await expect(link.first()).toHaveCSS('color', 'rgb(20, 118, 255)') @@ -20,5 +18,7 @@ test('基础用法', async ({ page }) => { }) await link.first().click() + await page.waitForTimeout(100) + expect(values[0]).toBe('clicked') }) diff --git a/examples/sites/demos/pc/app/popeditor/condition-form.spec.ts b/examples/sites/demos/pc/app/popeditor/condition-form.spec.ts index 5a1c082efb..0bd2539e2f 100644 --- a/examples/sites/demos/pc/app/popeditor/condition-form.spec.ts +++ b/examples/sites/demos/pc/app/popeditor/condition-form.spec.ts @@ -5,27 +5,18 @@ test('PopEditor 表单中使用并开启表单校验', async ({ page }) => { await page.goto('popeditor#condition-form') const preview = page.locator('#condition-form') - const textBox = preview.getByRole('textbox').nth(2) - const textBoxInput1 = page.getByText('15').nth(1) - const textBoxInput2 = page.getByText('18').nth(1) - const dialogBox = page.locator('div').getByRole('textbox').nth(5) - const del = page + await preview + .locator('div') + .filter({ hasText: /^文本选择确 认取 消$/ }) + .getByRole('textbox') + .click() + await page.getByRole('row', { name: 'GFD科技YX公司 福建 福州' }).locator('path').nth(1).click() + await page.getByRole('button', { name: '确 认' }).click() + await preview .locator('div') .filter({ hasText: /^文本$/ }) .getByRole('img') - const confirmBtn = page.getByRole('button', { name: '确 认' }) - const dataItem = page.getByRole('row', { name: 'GFD科技YX公司 福建 福州' }).locator('.tiny-grid-radio.size__mini') + .click() const tooltip = page.getByRole('tooltip', { name: '必填' }) - - await textBox.click() - await textBoxInput1.click() - await textBoxInput2.click() - await dialogBox.click() - await dataItem.click() - await confirmBtn.click() - await expect(dialogBox).toHaveValue('GFD科技YX公司') - - await del.click() - await expect(dialogBox).toHaveValue('') await expect(tooltip).toBeVisible() })