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

Conversation

zzcr
Copy link
Member

@zzcr zzcr commented Jan 6, 2025

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Style

    • Minor text formatting changes across multiple test files and components
    • Adjusted spacing in text strings and labels
    • Replaced standard colons with full-width colons in some assertions
  • Tests

    • Updated test case expectations to match precise text formatting
    • Maintained overall test logic and functionality while refining text details

Copy link

coderabbitai bot commented Jan 6, 2025

Walkthrough

This pull request involves minor text formatting changes across multiple test files and component implementations, primarily focusing on the Cascader component and its related test cases. The modifications mainly include adjusting whitespace, removing or adding spaces between words and symbols, and updating text assertions to match precise formatting. These changes appear to be cosmetic and do not significantly alter the underlying functionality of the components or tests.

Changes

File Path Change Summary
examples/sites/demos/pc/app/cascader-panel/*.spec.ts Text assertion modifications with whitespace adjustments
examples/sites/demos/pc/app/cascader/*.vue Label formatting changes in lazyLoad function, adding space between "选项" and id
examples/sites/demos/pc/app/cascader/*.spec.ts Text string modifications removing or adjusting spaces in assertions
examples/sites/demos/pc/app/color-picker/predefine.spec.ts Removed space in button text interaction
examples/sites/demos/pc/app/crop/get-cropped-canvas.spec.ts Changed colon from standard to full-width in text assertion

Possibly related PRs

Suggested labels

bug, e2e-test

Poem

🥕 Whitespace dancing, tests so neat
A rabbit's eye for detail, oh so sweet
Semicolons shift, spaces take flight
In cascader's realm, everything's just right! 🐰
Precision is our testing delight


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the bug Something isn't working label Jan 6, 2025
Copy link

Walkthrough

This pull request addresses errors in end-to-end tests for the cascader, color-picker, and crop components. The changes primarily involve correcting text expectations in test cases to ensure they match the actual output, thereby fixing the test failures.

Changes

Files Summary
examples/sites/demos/pc/app/cascader-panel/change.spec.ts, examples/sites/demos/pc/app/cascader-panel/custom-option-content.spec.ts, examples/sites/demos/pc/app/cascader/auto-load-checkStrictly-composition-api.vue, examples/sites/demos/pc/app/cascader/auto-load-checkStrictly.vue, examples/sites/demos/pc/app/cascader/auto-load-composition-api.vue, examples/sites/demos/pc/app/cascader/auto-load.vue, examples/sites/demos/pc/app/cascader/clearable.spec.ts, examples/sites/demos/pc/app/cascader/default-multiple.spec.ts, examples/sites/demos/pc/app/color-picker/predefine.spec.ts, examples/sites/demos/pc/app/crop/get-cropped-canvas.spec.ts Corrected text expectations in test cases to match actual output.

@@ -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.

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.

@@ -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.

@@ -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.

@@ -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.

@@ -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.

@@ -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.

@@ -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 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.

@@ -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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
examples/sites/demos/pc/app/cascader/default-multiple.spec.ts (1)

7-7: Verify the new text format for user clarity.

The text '安装 CLI指南' merges "CLI" and "指南" without spacing, which might reduce clarity. Confirm that the UI labels reflect this format and won’t lead to user confusion.

examples/sites/demos/pc/app/cascader/clearable.spec.ts (1)

7-7: Check for consistency in label formatting.

Removing the spaces from '指南+安装+项目登记' may serve a formatting purpose. Just ensure that similar references in the UI and other tests also omit these spaces to maintain uniformity.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3683e48 and fa0ee34.

📒 Files selected for processing (10)
  • examples/sites/demos/pc/app/cascader-panel/change.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/cascader-panel/custom-option-content.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/cascader/auto-load-checkStrictly-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/cascader/auto-load-checkStrictly.vue (1 hunks)
  • examples/sites/demos/pc/app/cascader/auto-load-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/cascader/auto-load.vue (1 hunks)
  • examples/sites/demos/pc/app/cascader/clearable.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/cascader/default-multiple.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/color-picker/predefine.spec.ts (2 hunks)
  • examples/sites/demos/pc/app/crop/get-cropped-canvas.spec.ts (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • examples/sites/demos/pc/app/crop/get-cropped-canvas.spec.ts
  • examples/sites/demos/pc/app/cascader/auto-load-composition-api.vue
  • examples/sites/demos/pc/app/cascader/auto-load.vue
  • examples/sites/demos/pc/app/cascader/auto-load-checkStrictly-composition-api.vue
  • examples/sites/demos/pc/app/cascader/auto-load-checkStrictly.vue
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (4)
examples/sites/demos/pc/app/cascader-panel/custom-option-content.spec.ts (1)

6-8: Maintain consistent spacing for readability.

The removed spaces in the text (e.g., '指南自定义(2)组件自定义(6)') might hamper quick readability. However, if consistency across the tests demands this removal, these changes are acceptable. Ensure that the text string matches the actual UI labels to avoid false test failures.

examples/sites/demos/pc/app/cascader-panel/change.spec.ts (1)

13-15: Approve text refinement for consistent punctuation.

Using a full-width semicolon in the displayed text is fine, assuming it aligns with the standard textual conventions across the application.

examples/sites/demos/pc/app/color-picker/predefine.spec.ts (2)

11-11: Ensure text alignment with the UI's actual wording.

This change removes a space between Chinese text and English text. Please verify whether the UI label has been updated to reflect this same string; otherwise, the test may fail or become misleading.


26-26: Double-check spacing for consistency with user-facing text.

Similar to line 11, the space between Chinese and English text has been removed. Confirm that this clarifies rather than obscures the intended meaning, and that the UI label now omits the space as well.

@zzcr zzcr merged commit 3f84a27 into dev Jan 6, 2025
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant