Skip to content

Commit 1cf548e

Browse files
authored
test(e2e): fix input、link、popeditor error e2e test (#2586)
1 parent a1cc857 commit 1cf548e

File tree

5 files changed

+35
-38
lines changed

5 files changed

+35
-38
lines changed

examples/sites/demos/pc/app/input/resize-composition-api.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
<tiny-input type="textarea" v-model="input" resize="both" placeholder="resize = both"></tiny-input>
66
<tiny-input type="textarea" v-model="input" resize="horizontal" placeholder="resize = horizontal"></tiny-input>
77
<tiny-input type="textarea" v-model="input" resize="vertical" placeholder="resize = vertical"></tiny-input>
8-
<p>autosize</p>
9-
<tiny-input
10-
type="textarea"
11-
v-model="textarea"
12-
placeholder="autosize = { minRows: 2, maxRows: 3 }"
13-
:autosize="{ minRows: 2, maxRows: 3 }"
14-
></tiny-input>
15-
<tiny-input type="textarea" v-model="textarea" placeholder="autosize" autosize></tiny-input>
8+
<div class="auto-size">
9+
<p>autosize</p>
10+
<tiny-input
11+
type="textarea"
12+
v-model="textarea"
13+
placeholder="autosize = { minRows: 2, maxRows: 3 }"
14+
:autosize="{ minRows: 2, maxRows: 3 }"
15+
></tiny-input>
16+
<tiny-input type="textarea" v-model="textarea" placeholder="autosize" autosize></tiny-input>
17+
</div>
1618
<p>hover-expand</p>
1719
<tiny-input
1820
class="expand"

examples/sites/demos/pc/app/input/resize.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { test, expect } from '@playwright/test'
33
test('可缩放文本域', async ({ page }) => {
44
page.on('pageerror', (exception) => expect(exception).toBeNull())
55
await page.goto('input#resize')
6-
const textarea = await page.locator('.demo-input .tiny-textarea > .tiny-textarea-display-only > textarea')
6+
7+
const demo = page.locator('#resize')
8+
const textarea = await demo.locator('.tiny-textarea > .tiny-textarea-display-only > textarea')
79
await expect(textarea.nth(0)).toHaveCSS('resize', 'vertical')
810
await expect(textarea.nth(1)).toHaveCSS('resize', 'none')
911
await expect(textarea.nth(2)).toHaveCSS('resize', 'both')
@@ -12,7 +14,7 @@ test('可缩放文本域', async ({ page }) => {
1214

1315
const fillText =
1416
'test1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'
15-
const textarea2 = page.locator('.demo-input .tiny-textarea .tiny-textarea-autosize-display-only > textarea')
17+
const textarea2 = demo.locator('.auto-size .tiny-textarea textarea')
1618

1719
// autosize = { minRows: 2, maxRows: 3 } 检查高度
1820
let defaultHeight = await textarea2

examples/sites/demos/pc/app/input/resize.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
<tiny-input type="textarea" v-model="input" resize="both" placeholder="resize = both"></tiny-input>
77
<tiny-input type="textarea" v-model="input" resize="horizontal" placeholder="resize = horizontal"></tiny-input>
88
<tiny-input type="textarea" v-model="input" resize="vertical" placeholder="resize = vertical"></tiny-input>
9-
<p>autosize</p>
10-
<tiny-input
11-
type="textarea"
12-
v-model="textarea"
13-
placeholder="autosize = { minRows: 2, maxRows: 3 }"
14-
:autosize="{ minRows: 2, maxRows: 3 }"
15-
></tiny-input>
16-
<tiny-input type="textarea" v-model="textarea" placeholder="autosize" autosize></tiny-input>
9+
<div class="auto-size">
10+
<p>autosize</p>
11+
<tiny-input
12+
type="textarea"
13+
v-model="textarea"
14+
placeholder="autosize = { minRows: 2, maxRows: 3 }"
15+
:autosize="{ minRows: 2, maxRows: 3 }"
16+
></tiny-input>
17+
<tiny-input type="textarea" v-model="textarea" placeholder="autosize" autosize></tiny-input>
18+
</div>
1719
<p>hover-expand</p>
1820
<tiny-input
1921
class="expand"

examples/sites/demos/pc/app/link/basic-usage.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ test('基础用法', async ({ page }) => {
66
const preview = page.locator('#basic-usage')
77
const link = preview.locator('a')
88

9-
await expect(link.first()).toHaveText('默认链接')
10-
await expect(link.nth(1)).toHaveText('默认链接2')
119
await link.first().hover()
1210
await expect(link.first()).toHaveCSS('color', 'rgb(20, 118, 255)')
1311

@@ -20,5 +18,7 @@ test('基础用法', async ({ page }) => {
2018
})
2119
await link.first().click()
2220

21+
await page.waitForTimeout(100)
22+
2323
expect(values[0]).toBe('clicked')
2424
})

examples/sites/demos/pc/app/popeditor/condition-form.spec.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,18 @@ test('PopEditor 表单中使用并开启表单校验', async ({ page }) => {
55
await page.goto('popeditor#condition-form')
66

77
const preview = page.locator('#condition-form')
8-
const textBox = preview.getByRole('textbox').nth(2)
9-
const textBoxInput1 = page.getByText('15').nth(1)
10-
const textBoxInput2 = page.getByText('18').nth(1)
11-
const dialogBox = page.locator('div').getByRole('textbox').nth(5)
12-
const del = page
8+
await preview
9+
.locator('div')
10+
.filter({ hasText: /^ $/ })
11+
.getByRole('textbox')
12+
.click()
13+
await page.getByRole('row', { name: 'GFD科技YX公司 福建 福州' }).locator('path').nth(1).click()
14+
await page.getByRole('button', { name: '确 认' }).click()
15+
await preview
1316
.locator('div')
1417
.filter({ hasText: /^$/ })
1518
.getByRole('img')
16-
const confirmBtn = page.getByRole('button', { name: '确 认' })
17-
const dataItem = page.getByRole('row', { name: 'GFD科技YX公司 福建 福州' }).locator('.tiny-grid-radio.size__mini')
19+
.click()
1820
const tooltip = page.getByRole('tooltip', { name: '必填' })
19-
20-
await textBox.click()
21-
await textBoxInput1.click()
22-
await textBoxInput2.click()
23-
await dialogBox.click()
24-
await dataItem.click()
25-
await confirmBtn.click()
26-
await expect(dialogBox).toHaveValue('GFD科技YX公司')
27-
28-
await del.click()
29-
await expect(dialogBox).toHaveValue('')
3021
await expect(tooltip).toBeVisible()
3122
})

0 commit comments

Comments
 (0)