Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(e2e): [cascader,color-picker,crop] fix cascader color-picker crop components e2e-test error #2746

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/sites/demos/pc/app/cascader-panel/change.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ test('选中节点变化', async ({ page }) => {
await page.getByRole('menuitem', { name: '安装' }).click()
await page.getByRole('menuitem', { name: '项目登记' }).click()

await expect(page.getByText('change 事件,当前选中的值为:项目登记;传入的值为:zhinan,anzhuang,xiangmudengji')).toBeVisible()
await expect(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

page.getByText('change 事件,当前选中的值为:项目登记;传入的值为:zhinan,anzhuang,xiangmudengji')
).toBeVisible()

// 清除节点
await expect(page.getByRole('menuitem', { name: '项目登记' })).toHaveClass('tiny-cascader-node is-active')
await page.getByRole('button', { name: '清除选中节点' }).click()
await expect(page.getByRole('menuitem', { name: '项目登记' })).not.toHaveClass('tiny-cascader-node is-active')

})
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
test('自定义节点内容', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('cascader-panel#custom-option-content')
await expect(page.getByText('指南自定义 (2) 组件自定义 (6)')).toBeVisible()
await page.getByRole('menuitem', { name: '指南自定义 (2)' }).click()
await expect(page.getByText('安装自定义 (4) 开发自定义 (2)')).toBeVisible()
await expect(page.getByText('指南自定义(2)组件自定义(6)')).toBeVisible()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

await page.getByRole('menuitem', { name: '指南自定义(2)' }).click()
await expect(page.getByText('安装自定义(4)开发自定义(2)')).toBeVisible()
})
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const propsAuto = ref({
setTimeout(() => {
const nodes = Array.from({ length: level + 1 }).map(() => ({
value: ++id,
label: `选项${id}`,
label: `选项 ${id}`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

leaf: level >= 2
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
setTimeout(() => {
const nodes = Array.from({ length: level + 1 }).map(() => ({
value: ++id,
label: `选项${id}`,
label: `选项 ${id}`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

leaf: level >= 2
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const propsAuto = ref({
setTimeout(() => {
const nodes = Array.from({ length: level + 1 }).map(() => ({
value: ++id,
label: `选项${id}`,
label: `选项 ${id}`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

leaf: level >= 2
}))
// 通过调用 resolve 将子节点数据返回,通知组件数据加载完成
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/cascader/auto-load.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
setTimeout(() => {
const nodes = Array.from({ length: level + 1 }).map(() => ({
value: ++id,
label: `选项${id}`,
label: `选项 ${id}`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

leaf: level >= 2
}))
// 通过调用 resolve 将子节点数据返回,通知组件数据加载完成
Expand Down
2 changes: 1 addition & 1 deletion examples/sites/demos/pc/app/cascader/clearable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test('可清空', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('cascader#clearable')
const text = await page.getByRole('textbox', { name: '请选择' }).inputValue()
await expect(text).toEqual('指南 + 安装 + 项目登记')
await expect(text).toEqual('指南+安装+项目登记')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

await page.locator('.tiny-input__suffix-inner > .tiny-svg').click()
const textClear = await page.getByRole('textbox', { name: '请选择' }).inputValue()
await expect(textClear).toEqual('')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test('多选', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('cascader#default-multiple')
const multiple = page.locator('.tiny-cascader-multiple')
const multipleText = page.getByText('指南 /安装 /项目登记指南 /安装 /安装 CLI 指南 /开发 /引入组件')
const multipleText = page.getByText('指南 /安装 /项目登记指南 /安装 /安装 CLI指南 /开发 /引入组件')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

await expect(multiple).toBeVisible()
await expect(multipleText).toBeVisible()
})
6 changes: 2 additions & 4 deletions examples/sites/demos/pc/app/color-picker/predefine.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ test('测试预定义颜色', async ({ page }) => {
await expect(page.getByRole('button', { name: '预定义颜色' })).toBeVisible()
await page.getByRole('button', { name: '预定义颜色' }).click()
await expect(page.locator('.tiny-color-select-panel__predefine > div:nth-child(8)')).toBeVisible()
await page.getByText('取消选择预定义颜色 Append predefine').click()
await page.getByText('取消选择预定义颜色 Append predefine').click()
await page.getByText('取消选择预定义颜色 Append predefine').click()
await page.getByText('取消选择预定义颜色Append predefine').click()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

await page.getByRole('button', { name: '选择' }).click()
await page.getByRole('button', { name: 'Append predefine color' }).click()
await page.locator('.tiny-color-picker__inner').click()
Expand All @@ -25,5 +23,5 @@ test('测试预定义颜色', async ({ page }) => {
await page.locator('.tiny-color-select-panel__predefine > div:nth-child(8)').click()
await page.getByRole('button', { name: '选择' }).click()
await page.locator('.tiny-color-picker__inner').click()
await page.getByText('取消选择预定义颜色 Append predefine').click()
await page.getByText('取消选择预定义颜色Append predefine').click()
})
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ test('获取裁剪后的图片数据', async ({ page }) => {
await page.getByRole('button', { name: '获取裁剪后的图片数据' }).click()

// 待补充验证:弹窗内数据
await expect(page.getByText('Blob: 337877')).toHaveCount(1)
await expect(page.getByText('Blob337877')).toHaveCount(1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the text expectations are correctly aligned with the actual output to avoid test failures.

})
Loading