test(pc/app/input): [input] Refine e2e test cases (#837)

This commit is contained in:
yoyo 2023-11-16 14:07:43 +08:00 committed by GitHub
parent fec7dd71fa
commit 7cd5270d46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 21 additions and 18 deletions

View File

@ -4,11 +4,11 @@ test('[Input]clearable', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('input#clearable')
const input = page.locator('.demo-input > .tiny-input')
await page.locator('#preview').getByRole('textbox').click()
await page.locator('#preview').getByRole('textbox').fill('hello')
const value = await page.locator('#preview').getByRole('textbox').inputValue()
await input.getByRole('textbox').click()
await input.getByRole('textbox').fill('hello')
const value = await input.getByRole('textbox').inputValue()
await expect(value).toBe('hello')
await input.locator('.tiny-input__clear').click()
const clearableValue = await page.locator('#preview').getByRole('textbox').inputValue()
const clearableValue = await input.getByRole('textbox').inputValue()
await expect(clearableValue).toBe('')
})

View File

@ -3,8 +3,9 @@ import { test, expect } from '@playwright/test'
test('[Input]counter', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('input#counter')
await page.locator('#preview').getByRole('textbox').click()
await page.locator('#preview').getByRole('textbox').fill('123')
const input = page.locator('.demo-input > .tiny-input')
await input.getByRole('textbox').click()
await input.getByRole('textbox').fill('123')
const num = page.locator('.tiny-input__count-upper-limit')
await expect(num).toHaveText('3')
})

View File

@ -15,6 +15,6 @@ test('[Input]method-addMemory', async ({ page }) => {
.click()
await input.click()
await input.fill('')
const box = page.locator('#preview').getByText('1234')
const box = await page.locator('.tiny-modal__body').getByText('1234')
await expect(box).toBeVisible()
})

View File

@ -21,7 +21,7 @@ const textarea = ref('')
<style scoped>
.demo-input .tiny-textarea {
width: 270px;
width: auto;
margin: 5px;
}
</style>

View File

@ -29,7 +29,7 @@ export default {
<style scoped>
.demo-input .tiny-textarea {
width: 270px;
width: auto;
margin: 5px;
}
</style>

View File

@ -15,7 +15,8 @@ const input = ref('')
<style scoped>
.demo-input .tiny-textarea {
width: 250px;
width: auto;
max-width: 100%;
margin: 5px;
}
</style>

View File

@ -23,7 +23,8 @@ export default {
<style scoped>
.demo-input .tiny-textarea {
width: 250px;
width: auto;
max-width: 100%;
margin: 5px;
}
</style>

View File

@ -3,10 +3,10 @@ import { test, expect } from '@playwright/test'
test('[Input]size', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('input#size')
const medium = page.locator('.demo-input > .tiny-input-medium')
const small = page.locator('.demo-input > .tiny-input-small ')
const mini = page.locator('.demo-input > .tiny-input-mini')
await expect(medium).toBeVisible()
await expect(small).toBeVisible()
await expect(mini).toBeVisible()
const medium = page.locator('.demo-input > .tiny-input-medium .tiny-input__inner')
const small = page.locator('.demo-input > .tiny-input-small .tiny-input__inner')
const mini = page.locator('.demo-input > .tiny-input-mini .tiny-input__inner')
await expect(medium).toHaveCSS('height', '40px')
await expect(small).toHaveCSS('height', '32px')
await expect(mini).toHaveCSS('height', '24px')
})

View File

@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
test('[Input]validate-event', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('input#validate-event')
await page.locator('#preview').getByRole('textbox').click()
await page.locator('.demo-form .tiny-input').getByRole('textbox').click()
await page
.locator('div')
.filter({ hasText: /^活动名称$/ })