Skip to content

[BI Data Mapper] Update button selectors and file comparisons in e2e tests#1525

Merged
kanushka merged 1 commit intowso2:release/bi-1.8.xfrom
KCSAbeywickrama:bi-dm-e2e-test-fix-1.8.0
Feb 20, 2026
Merged

[BI Data Mapper] Update button selectors and file comparisons in e2e tests#1525
kanushka merged 1 commit intowso2:release/bi-1.8.xfrom
KCSAbeywickrama:bi-dm-e2e-test-fix-1.8.0

Conversation

@KCSAbeywickrama
Copy link
Contributor

@KCSAbeywickrama KCSAbeywickrama commented Feb 20, 2026

Purpose

Fixes button locators
Update formatting excluding logic in file comparison

Summary by CodeRabbit

  • Tests
    • Improved test reliability by updating button selectors for the Data Mapper refresh and clear mappings actions to use more specific VSCode identifiers.
    • Enhanced file comparison logic in tests to better normalize whitespace during validation, ensuring more accurate test results.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

📝 Walkthrough

Walkthrough

Test utility file updated with more specific VSCode button locators for DataMapper refresh and clear mapping actions. FileUtils whitespace normalization logic adjusted to remove all whitespace instead of collapsing to single spaces.

Changes

Cohort / File(s) Summary
Test Utility Selectors
workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts
Updated DataMapper.refresh() and TestScenarios clear mapping locators to use more specific vscode-button[title="..."] selectors. Modified FileUtils.compareFilesSync() whitespace normalization to remove all whitespace rather than collapse to single space, with TODO comment added.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Buttons more precise, selectors refined,
Whitespace trimmed with fresh design,
Tests now click with certainty true,
Mappings refresh through and through! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete, covering only Purpose section minimally. Most required sections from the template are missing or unfilled. Complete the description by filling in Goals, Approach, and other relevant sections from the template, such as Automation tests, Test environment, and Documentation impact.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: updating button selectors and file comparison logic in e2e tests for the BI Data Mapper, which aligns with the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts`:
- Around line 191-192: The current whitespace normalization on file1Content and
file2Content is overly aggressive and contains a redundant replace: remove the
standalone .replace(/\n/g, '') and change the second call from .replace(/\s+/g,
'') to .replace(/\s+/g, ' ') so runs of whitespace collapse to a single space
instead of being removed; update the normalization logic where file1Content and
file2Content are transformed (the two replace(...) calls) to use only the
collapse-to-single-space behavior to preserve token boundaries and avoid
false-positive test matches.

Comment on lines +191 to +192
file1Content = file1Content.replace(/\n/g, '').replace(/\s+/g, '');
file2Content = file2Content.replace(/\n/g, '').replace(/\s+/g, '');
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Whitespace normalization is both redundant and overly aggressive — risk of false-positive test passes.

Two problems with the new logic:

  1. Redundant first replace. JavaScript's \s already matches \n, so .replace(/\n/g, '') is completely subsumed by the immediately following .replace(/\s+/g, ''). The first call is dead code.

  2. Removing all whitespace conflates adjacent tokens. The previous strategy (collapsing runs to a single space) preserved token boundaries: string name stayed string name. The new strategy concatenates everything: string namestringname. This means two semantically different Ballerina snippets that happen to share the same non-whitespace characters (e.g. different variable name casing caused by a formatter introducing a new binding) compare as equal, allowing tests to pass when the generated output is actually wrong.

Consider keeping the collapse-to-single-space approach (replace(/\s+/g, ' ')) instead, which is sufficient to ignore indentation/newline formatting differences while still catching meaningful token-level differences.

♻️ Proposed fix
-            file1Content = file1Content.replace(/\n/g, '').replace(/\s+/g, '');
-            file2Content = file2Content.replace(/\n/g, '').replace(/\s+/g, '');
+            file1Content = file1Content.replace(/\s+/g, ' ').trim();
+            file2Content = file2Content.replace(/\s+/g, ' ').trim();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
file1Content = file1Content.replace(/\n/g, '').replace(/\s+/g, '');
file2Content = file2Content.replace(/\n/g, '').replace(/\s+/g, '');
file1Content = file1Content.replace(/\s+/g, ' ').trim();
file2Content = file2Content.replace(/\s+/g, ' ').trim();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@workspaces/bi/bi-extension/src/test/e2e-playwright-tests/data-mapper/DataMapperUtils.ts`
around lines 191 - 192, The current whitespace normalization on file1Content and
file2Content is overly aggressive and contains a redundant replace: remove the
standalone .replace(/\n/g, '') and change the second call from .replace(/\s+/g,
'') to .replace(/\s+/g, ' ') so runs of whitespace collapse to a single space
instead of being removed; update the normalization logic where file1Content and
file2Content are transformed (the two replace(...) calls) to use only the
collapse-to-single-space behavior to preserve token boundaries and avoid
false-positive test matches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a quick fix until formatting is re-enabled for the data mapper. Replacing multiple spaces with a single space caused some failures after running, atm this change is required

@kanushka kanushka merged commit e19764d into wso2:release/bi-1.8.x Feb 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants