Skip to content

Comments

Increase assertion timeout#935

Closed
ChinthakaJ98 wants to merge 18 commits intowso2:mainfrom
ChinthakaJ98:e2e-test-fixes-01
Closed

Increase assertion timeout#935
ChinthakaJ98 wants to merge 18 commits intowso2:mainfrom
ChinthakaJ98:e2e-test-fixes-01

Conversation

@ChinthakaJ98
Copy link
Contributor

@ChinthakaJ98 ChinthakaJ98 commented Nov 17, 2025

$subject

Summary by CodeRabbit

  • Tests
    • Streamlined end-to-end mapping tests by skipping several cleanup steps and simplifying a custom-function sequence; added debug logging during file comparisons.
  • Changes
    • Adjusted mapping outputs: reordered properties, added a new uppercase-derived field, and modified an aggregation calculation; one sample output transformation no longer auto-populates.
  • Chores
    • Made the vulnerability scanner non-fatal in CI.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Walkthrough

Disabled/removed portions of an E2E custom-function mapping test (commented/removed interactions and cleanup), adjusted mapping fixture output fields and property order, added debug logging to file comparisons in the DataMapper helper, and made the Trivy CI step non-fatal by treating its exit code as 0.

Changes

Cohort / File(s) Summary
E2E test — commented/removed steps
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts
Custom-function mapping interactions, some editor/tab open-close steps, and several cleanup/trash actions were commented out or removed; core test progression and assertions remain.
Mapping fixtures — output field adjustments
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts, workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts
map.ts: swapped property order in returned object (oCustomFn before oExp). del.ts: changed computations for oManyOne/oManyOneErr, added oExp (using dmUtils.toUppercase), and adjusted returned fields.
DataMapper helper — added logging
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts
Added console.debug calls to print file1Content and file2Content inside compareFiles (both occurrences); comparison logic otherwise unchanged.
CI workflow — Trivy non-fatal
.github/workflows/build.yml
Modified Trivy vulnerability scanner step to treat its exit code as 0, preventing the scan from failing the job.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant E2E as E2E Test
    participant UI as DataMapper UI
    participant Fixture as Mapping Fixture
    participant Helper as DataMapper.compareFiles

    rect rgba(255,244,230,0.9)
    Note over E2E,UI: Custom-function UI mapping sequence removed/commented
    E2E ->> UI: (was) trigger custom-function mapping interactions
    UI --x E2E: interaction skipped / commented out
    end

    rect rgba(232,245,233,0.9)
    Note over E2E,Helper: File comparison now logs contents
    E2E ->> Helper: compareFiles(fileA, fileB)
    Helper ->> Helper: console.debug(fileAContent, fileBContent)
    Helper -->> E2E: comparison result
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Inspect dataMapper.spec.ts for leftover commented code that could cause flakiness or stale expectations.
  • Verify del.ts output changes and map.ts reordering match consuming tests/types.
  • Confirm additional console.debug calls are acceptable for CI logs and do not expose sensitive data.
  • Validate Trivy change aligns with project security requirements.

Suggested reviewers

  • hevayo
  • gigara

Poem

🐇 I nudged a test and hushed a map,

Hid a click between a nap.
Files now murmur what they bear,
Debug whispers float in the air.
A carrot cheer — small shifts, light and apt. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'Increase assertion timeout' does not match the actual changes, which include modifying test sequences, cleanup logic, property ordering, logging additions, and computation logic across multiple files. Revise the title to accurately reflect the main changes (e.g., 'Fix E2E tests: update assertions, logging, and data mappings') or update the changes to match the stated objective.
Description check ⚠️ Warning The pull request description only contains '$subject' (the title), providing no meaningful explanation of the changes, their purpose, or how they address the stated goal of increasing assertion timeout. Complete the description following the repository template, including Purpose, Goals, Approach, and detailed explanations of all changes made across the multiple modified files.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 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: 0

🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

214-214: Consistent timeout increase appropriately addresses test flakiness for focus state transitions.

The explicit 10-second timeout is consistently applied to all assertions verifying the expression bar loses focus after canvas interactions. This aligns with Playwright best practices for handling async UI state changes and is a reasonable extension of the 5-second default timeout.

Consider extracting the timeout to a named constant for improved maintainability:

+const EXPRESSION_BAR_UNFOCUS_TIMEOUT = 10000;

Then apply across all four instances (lines 214, 223, 327, 453):

-await expect(expressionBar).not.toBeFocused({ timeout: 10000 });
+await expect(expressionBar).not.toBeFocused({ timeout: EXPRESSION_BAR_UNFOCUS_TIMEOUT });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95c93ef and c79c1f2.

📒 Files selected for processing (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (4 hunks)

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c79c1f2 and 05ad50d.

📒 Files selected for processing (2)
  • workspaces/mi/mi-extension/package.json (2 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts

@ChinthakaJ98 ChinthakaJ98 force-pushed the e2e-test-fixes-01 branch 2 times, most recently from 1d2574d to e280256 Compare November 17, 2025 11:02
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: 0

🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

214-217: Consider extracting the focus-wait pattern into a helper method.

The same focus-wait pattern appears in four locations. Extracting it into a reusable helper method would reduce duplication and make future maintenance easier.

Example helper method to add to the test file or DataMapper component class:

async function waitForExpressionBarBlur(dmWebView, expressionBar: Locator, timeoutMs: number = 30000) {
  await dmWebView.waitForFunction(
    (el) => el !== document.activeElement,
    await expressionBar.elementHandle(),
    { timeout: timeoutMs }
  );
  await expect(expressionBar).not.toBeFocused();
}

Then replace each occurrence with:

await waitForExpressionBarBlur(dmWebView, expressionBar);

Also applies to: 226-229, 333-336, 462-465

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d2574d and e280256.

📒 Files selected for processing (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (4 hunks)
🔇 Additional comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

214-217: LGTM! Explicit focus waits improve test stability.

The added waitForFunction calls explicitly wait for the expression bar to lose focus before asserting, which addresses potential flakiness in the E2E tests. The 30-second timeout is conservative but appropriate for extension tests that may experience delays in CI environments.

@ChinthakaJ98 ChinthakaJ98 force-pushed the e2e-test-fixes-01 branch 4 times, most recently from 8bfbd3f to 21172fe Compare November 17, 2025 15:34
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: 0

🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1)

136-141: Remove commented-out code.

The old implementation is preserved in version control, so there's no need to keep it as a comment. Removing it improves code readability.

Apply this diff:

-    // public async waitForOutline(locator: Locator, timeout = 5000) {
-    //     await expect(async () => {
-    //         const outline = await locator.evaluate(el => window.getComputedStyle(el).outline);
-    //         expect(outline && !outline.includes('none')).toBeTruthy();
-    //     }).toPass({ timeout });
-    // }
-
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8bfbd3f and 21172fe.

📒 Files selected for processing (2)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1 hunks)
🔇 Additional comments (2)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1)

143-154: Improved outline validation logic.

The new implementation is more robust than string parsing. Separately checking outlineStyle and outlineWidth provides clearer validation that an outline is actually visible.

workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

223-223: LGTM! Explicit blur improves test reliability.

Explicitly calling blur() ensures the expression bar loses focus deterministically, reducing potential flakiness in the test. This complements the more robust outline validation in DataMapper.ts.

@ChinthakaJ98 ChinthakaJ98 force-pushed the e2e-test-fixes-01 branch 2 times, most recently from 78f2153 to 8fc9326 Compare November 17, 2025 16:31
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78f2153 and 8fc9326.

📒 Files selected for processing (2)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1 hunks)
🔇 Additional comments (2)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1)

143-161: Improved focus outline detection.

The enhanced implementation properly validates all outline properties (style, width, color) and also detects focus via box-shadow, which some platforms use as a focus indicator. This is more robust than the previous string-based check and should improve cross-platform test reliability.

workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

222-224: Inconsistency confirmed: explicit blur() at line 223 differs from earlier pattern.

The inconsistency is verified. Line 212–214 uses only a canvas click to remove focus, while line 222–224 adds an explicit evaluate().blur() call before the same assertion. Both patterns have identical assertion intent (not.toBeFocused()).

This pattern difference could indicate:

  • The earlier pattern (line 212–214) is insufficient and should also use explicit blur
  • The explicit blur at line 223 is defensive for timing sensitivity
  • Different contexts justify different approaches

Since git history is unavailable and the sandbox cannot execute tests, manual verification is needed: run the test multiple times without the explicit blur at line 223 to confirm whether it's addressing a genuine race condition or is optional defensive coding. If necessary, apply the same pattern to line 212–214 for consistency.

Comment on lines 136 to 141
// public async waitForOutline(locator: Locator, timeout = 5000) {
// await expect(async () => {
// const outline = await locator.evaluate(el => window.getComputedStyle(el).outline);
// expect(outline && !outline.includes('none')).toBeTruthy();
// }).toPass({ timeout });
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Remove commented-out code.

The old implementation should be deleted rather than commented out. Version control preserves the history if needed.

-    // public async waitForOutline(locator: Locator, timeout = 5000) {
-    //     await expect(async () => {
-    //         const outline = await locator.evaluate(el => window.getComputedStyle(el).outline);
-    //         expect(outline && !outline.includes('none')).toBeTruthy();
-    //     }).toPass({ timeout });
-    // }
-
📝 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
// public async waitForOutline(locator: Locator, timeout = 5000) {
// await expect(async () => {
// const outline = await locator.evaluate(el => window.getComputedStyle(el).outline);
// expect(outline && !outline.includes('none')).toBeTruthy();
// }).toPass({ timeout });
// }
🤖 Prompt for AI Agents
In
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts
around lines 136 to 141, there is a commented-out waitForOutline function block
that should be removed; delete the entire commented code (all lines of the
commented function) so the file contains no dead/commented-out implementation,
relying on version control history if the old code needs to be recovered.

@ChinthakaJ98 ChinthakaJ98 force-pushed the e2e-test-fixes-01 branch 2 times, most recently from fb4267a to 3a755fe Compare November 18, 2025 15:07
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/build.yml (1)

217-227: Critical: Security scanner made non-fatal.

Changing exit-code from '1' to '0' causes Trivy to never fail the build, even when vulnerabilities are detected. This defeats the purpose of vulnerability scanning and allows insecure code to be merged.

If you're experiencing transient scanner failures, consider alternative solutions:

  • Use continue-on-error: true for specific conditions
  • Filter specific vulnerabilities with trivyignores
  • Adjust severity thresholds with severity: 'CRITICAL,HIGH'

Apply this diff to restore security enforcement:

-          exit-code: '0'
+          exit-code: '1'
♻️ Duplicate comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1)

136-141: Remove commented-out code.

This commented-out implementation should be deleted. Version control preserves the history if needed.

Apply this diff:

-    // public async waitForOutline(locator: Locator, timeout = 5000) {
-    //     await expect(async () => {
-    //         const outline = await locator.evaluate(el => window.getComputedStyle(el).outline);
-    //         expect(outline && !outline.includes('none')).toBeTruthy();
-    //     }).toPass({ timeout });
-    // }
-
🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1)

222-228: Reconsider the double-click focus pattern.

This helper uses force clicks and a double-click pattern to ensure focus, which may cause unintended side effects:

  • Double-clicking could trigger unexpected behaviors in the UI
  • The 50ms delay is a magic number without clear justification
  • Force clicks bypass Playwright's actionability checks

If focus is this unreliable, consider investigating why VS Code Webview focus handling is problematic rather than working around it.

A simpler approach:

 private async forceFocus(locator: Locator) {
-    // Click twice with a short delay to ensure real focus
-    await locator.click({ force: true });
+    await locator.click();
     await locator.evaluate(el => el.focus());
-    await locator.click({ force: true });  
-    await this._page.waitForTimeout(50); // tiny stabilization delay
+    await this._page.waitForTimeout(100); // allow focus to settle
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb4267a and 3a755fe.

📒 Files selected for processing (3)
  • .github/workflows/build.yml (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (2 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts
🔇 Additional comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1)

143-161: LGTM: Robust focus detection.

The enhanced waitForOutline correctly handles both CSS outline and box-shadow focus indicators, improving cross-platform reliability.

Comment on lines 168 to 186
// wait for both fields to exist and be visible
await sourceField.waitFor({ state: 'visible' });
await targetField.waitFor({ state: 'visible' });

// Scroll both into view to avoid click misfires in WebViews
await sourceField.scrollIntoViewIfNeeded();
await targetField.scrollIntoViewIfNeeded();

// --- Improve focus reliability ---
// Sometimes one click isn't enough in VS Code Webview
await this.forceFocus(sourceField);

await sourceField.click({force: true});
await this.waitForOutline(sourceField, 30000);
await targetField.click({force: true});
// --- Ensure outline is visible (even on Windows) ---
await this.waitForOutline(sourceField, 30000);

// Now click target
await targetField.scrollIntoViewIfNeeded();
await targetField.click({ force: true });

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

Reduce timeout and avoid force clicks.

Several concerns:

  1. 30-second timeout (line 181): This is excessive and will significantly slow tests. If focus takes 30 seconds to appear, there's a deeper issue. Consider 5-10 seconds maximum.

  2. Force click (line 185): Using { force: true } bypasses Playwright's actionability checks, potentially masking real issues where the target isn't actually clickable in production.

  3. The overall pattern suggests working around timing/focus issues rather than addressing root causes.

Consider this approach:

-    // --- Ensure outline is visible (even on Windows) ---
-    await this.waitForOutline(sourceField, 30000);
+    // Ensure outline is visible
+    await this.waitForOutline(sourceField, 10000);

     // Now click target
     await targetField.scrollIntoViewIfNeeded();
-    await targetField.click({ force: true });
+    await targetField.click();
📝 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
// wait for both fields to exist and be visible
await sourceField.waitFor({ state: 'visible' });
await targetField.waitFor({ state: 'visible' });
// Scroll both into view to avoid click misfires in WebViews
await sourceField.scrollIntoViewIfNeeded();
await targetField.scrollIntoViewIfNeeded();
// --- Improve focus reliability ---
// Sometimes one click isn't enough in VS Code Webview
await this.forceFocus(sourceField);
await sourceField.click({force: true});
await this.waitForOutline(sourceField, 30000);
await targetField.click({force: true});
// --- Ensure outline is visible (even on Windows) ---
await this.waitForOutline(sourceField, 30000);
// Now click target
await targetField.scrollIntoViewIfNeeded();
await targetField.click({ force: true });
// wait for both fields to exist and be visible
await sourceField.waitFor({ state: 'visible' });
await targetField.waitFor({ state: 'visible' });
// Scroll both into view to avoid click misfires in WebViews
await sourceField.scrollIntoViewIfNeeded();
await targetField.scrollIntoViewIfNeeded();
// --- Improve focus reliability ---
// Sometimes one click isn't enough in VS Code Webview
await this.forceFocus(sourceField);
// Ensure outline is visible
await this.waitForOutline(sourceField, 10000);
// Now click target
await targetField.scrollIntoViewIfNeeded();
await targetField.click();
🤖 Prompt for AI Agents
In
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts
around lines 168-186, replace the 30s waitForOutline timeout with a much shorter
5-10s timeout (e.g., 5s) and remove the use of targetField.click({ force: true
}); instead wait for the target to be actionable (visible, enabled, and stable)
using Playwright waitFor / waitForElementState calls and then perform a normal
click; if focus is flaky, retry focus+click a couple of times with short backoff
(e.g., focus(), wait 100-200ms, click()) rather than forcing the click so tests
fail when the UI is not actually clickable.

@ChinthakaJ98 ChinthakaJ98 force-pushed the e2e-test-fixes-01 branch 5 times, most recently from 7bb3323 to ee951c8 Compare November 19, 2025 04:15
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: 0

🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

193-209: Custom function mapping scenario and TS verification look solid; tab locator could be made more robust

The new iCustomFn → oCustomFn mapping plus the three link assertions give good coverage of the o2o‑func behavior, and explicitly closing the ${dmName}.ts tab after verifyTsFileContent should help keep later steps isolated.

One small robustness suggestion: the tab locator getByRole('tab', { name: \${dmName}.ts, Editor Group` })` is tightly coupled to VS Code’s ARIA label format and could break if the label changes (e.g., dirty markers or different suffix). Using a regex/startsWith‑style name instead would make this less brittle, for example:

- const editorTab = page.page.getByRole('tab', { name: `${dmName}.ts, Editor Group` });
+ const editorTab = page.page.getByRole('tab', { name: new RegExp(`^${dmName}\\.ts`) });

You could also optionally standardize on either raw 'basic/map.ts' or path.join('basic', 'map.ts') in verifyTsFileContent calls for consistency, but the current code should work as is.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7bb3323 and ee951c8.

📒 Files selected for processing (3)
  • .github/workflows/build.yml (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/build.yml
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts
🔇 Additional comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

235-241: Explicit blur on the expression editor should reduce focus flakiness

Adding await expressionBar.evaluate((el: HTMLElement) => el.blur()); after clicking the canvas provides a deterministic way to drop focus before asserting not.toBeFocused(), which should help stabilize this flow given the earlier “Fails here” comment in nearby code. The Playwright Locator.evaluate usage and async sequencing look correct.

@ChinthakaJ98 ChinthakaJ98 force-pushed the e2e-test-fixes-01 branch 2 times, most recently from 4f31920 to 84a0ea8 Compare November 19, 2025 06:02
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71e7d26 and 9a388c9.

📒 Files selected for processing (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (3 hunks)
🔇 Additional comments (3)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (3)

193-206: LGTM! Custom function mapping test looks solid.

The test correctly exercises the custom function mapping flow: mapping fields, verifying intermediate ports and connectors, and handling the editor tab lifecycle. The explicit waits for 'attached' and 'detached' states ensure proper synchronization.

Minor observation: The editor tab is closed immediately without verifying its content. If the editor is expected to display specific mapping code, consider adding a content check before closing to strengthen the test coverage.


237-237: Good addition for test stability.

Explicitly calling blur() ensures the expression bar loses focus before the subsequent assertion, reducing potential flakiness from browser timing variations.


263-263: LGTM! Consistent with earlier usage.

Using .first() is appropriate here and matches the pattern established at line 148 for the same test ID. This ensures the test targets a specific element when multiple intermediate ports exist.

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: 0

🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1)

256-259: Remove debug console.log statements before merging.

These console.log statements will clutter test output with full file contents on every comparison. If debugging is needed, consider using a conditional debug flag or Playwright's built-in page.on('console') capture. For production test code, remove these entirely.

Apply this diff to remove the debug statements:

     public compareFiles(file1: string, file2: string) {
         const file1Content = fs.readFileSync(file1, 'utf8').replace(/\r\n/g, '\n');
         const file2Content = fs.readFileSync(file2, 'utf8').replace(/\r\n/g, '\n');
-        console.log("File1:");
-        console.log(file1Content);
-        console.log("File2:");
-        console.log(file2Content);
         return file1Content === file2Content;
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a388c9 and 341d196.

📒 Files selected for processing (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/components/DataMapper.ts (1 hunks)

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: 0

♻️ Duplicate comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

248-272: Re-check delete expectations vs basic/del.ts and .first() vs .nth(1) connector targeting

Commenting out the deletions for loc2 (Line 250–Line 261 scope) and loc4 (Line 269–Line 270) means the test no longer removes the oManyOne and oExp mappings, while the final assertion still compares against basic/del.ts (Line 272). Earlier feedback noted that basic/del.ts only had oManyOneErr and not oManyOne, so there’s a risk that the fixture and these steps are still out of sync.

Also, for the many-one error case you now delete via:

  • const loc3_ = ...getByTestId('link-from-input.iManyOne3.OUT-to-datamapper-intermediate-port').first(); (Line 263)
  • and a sub-link label using .first() (Line 265),

whereas the error-link assertions earlier rely on .nth(1) to target the error connectors. That suggests .first() here may be deleting the non-error mapping instead of the error mapping, depending on connector ordering.

Please verify which mappings basic/del.ts expects to be present/absent and then either:

  • Re-enable the loc2/loc4 deletions, or
  • Update basic/del.ts (and, if needed, the .first()/.nth(...) usage) so that the fixture exactly matches what this sequence produces.

For convenience, you can re-check the fixture with something like:

#!/bin/bash
# Inspect the basic delete fixture for many-one and expression-bar outputs
grep -nE 'oManyOne|oManyOneErr|oExp' \
  workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts
🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

193-206: Custom function mapping flow looks good; consider loosening the tab locator

The custom-function mapping plus connector assertions are clear, and explicitly closing the ${dmName}.ts editor tab is a nice way to finish the flow. The one fragile piece is the hard-coded accessible name '${dmName}.ts, Editor Group', which may change with VS Code UI tweaks or localization.

You could make this locator more robust by just anchoring on the file name and letting the rest of the label vary, e.g.:

-      const editorTab = page.page.getByRole('tab', { name: `${dmName}.ts, Editor Group` });
+      const editorTab = page.page.getByRole('tab', { name: new RegExp(`^${dmName}\\.ts`) });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 341d196 and 474431a.

📒 Files selected for processing (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (3 hunks)
🔇 Additional comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

232-238: Explicit blur on the expression bar should help stabilize focus behavior

Adding await expressionBar.evaluate((el: HTMLElement) => el.blur()); after clicking the canvas makes the loss-of-focus explicit and should reduce flakiness around the subsequent not.toBeFocused() assertion, assuming the element is still attached at this point. No issues from a test-logic perspective.

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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8a911e and dd01a96.

📒 Files selected for processing (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (3 hunks)
🔇 Additional comments (3)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (3)

193-206: Custom function test addition looks good.

The test properly validates custom function mapping with appropriate waits for UI elements and cleans up the editor tab. The placement consolidates the test flow as intended.


237-237: Good addition for test stability.

The explicit blur call ensures focus is properly lost before assertions, improving test reliability.


263-265: Selector stabilization improves test reliability.

Using nth(1) properly handles multiple matching elements and prevents selector ambiguity.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd01a96 and de3e5f7.

📒 Files selected for processing (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (4 hunks)
🔇 Additional comments (2)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (2)

193-206: LGTM! Custom function mapping test properly structured.

The new custom function mapping test follows best practices with proper waits for all UI elements (intermediate port links, connector nodes, editor tab) before proceeding to the next step.


237-237: Good practice: explicit blur for test stability.

The explicit blur() call after clicking the canvas ensures deterministic focus state transitions, which helps prevent flaky tests when native focus management is inconsistent.

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: 0

♻️ Duplicate comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

260-272: Replace fixed 20s sleeps with condition-based waits for deletes.

The new waitForTimeout(20000) calls after deleting loc2 and loc4 reduce flakiness but still rely on arbitrary sleeps and keep the waits for state: 'detached' commented out. This keeps the test non-deterministic and adds up to 40s of idle time in this block. The new loc3_ with .first() and the targeted sub-link trash click are good stabilizations, though.

If possible, prefer a condition-based wait tied to actual UI or file-state changes, for example:

  • A locator-based wait on whatever does change reliably when the mapping is deleted (if loc2/loc4 never detach, wait on another selector instead of sleeping), or
  • Polling dm.verifyTsFileContent('basic/del.ts') with a timeout rather than sleeping and then asserting once.

This will make the test both faster and more deterministic than fixed 20s timeouts.

Also applies to: 264-266

🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

237-237: Type annotation on el is optional here.

The explicit HTMLElement annotation isn’t required; evaluate can infer the element type. You could simplify to avoid depending on DOM typings in the test TS config:

-      await expressionBar.evaluate((el: HTMLElement) => el.blur());
+      await expressionBar.evaluate(el => el.blur());
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41715cd and c2b4a73.

📒 Files selected for processing (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (3 hunks)
🔇 Additional comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

193-205: Custom function mapping flow and editor-tab handling look consistent.

The new custom function mapping (including connector waits) plus the explicit tab close on ${dmName}.ts is coherent with the rest of the test and should help keep focus in the data-mapper view stable before the later expression-bar steps.

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

260-272: Fix loc4 undefined reference error at line 270–272; remove dead commented timeouts.

The loc4 variable declaration at line 222 is commented out as part of the disabled expression-bar block, but lines 270–272 reference it uncommented. This will throw a ReferenceError at runtime. Either uncomment and re-enable the loc4 declaration with its expression-bar mapping steps (lines 207–245), or comment out the loc4 deletion block (lines 270–272) to match the disabled state above it.

Also remove the dead // await page.page.waitForTimeout(20000); comments at lines 262 and 272 or replace them with explicit timeout parameters on the relevant waitFor() calls if longer waits are needed.

       await loc2.locator('.codicon-trash').click({ force: true });
-      // await page.page.waitForTimeout(20000);
       await loc2.waitFor({ state: 'detached' });

-      await loc4.locator('.codicon-trash').click({ force: true });
-      // await page.page.waitForTimeout(20000);
-      await loc4.waitFor({ state: 'detached' });
+      // Expression-bar-based mapping (oExp) is currently disabled above,
+      // so we skip deleting it here. If oExp is re-enabled, restore this block.
+      // await loc4.locator('.codicon-trash').click({ force: true });
+      // await loc4.waitFor({ state: 'detached' });
🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

207-245: Expression-bar and expression-editor coverage is fully disabled; clarify and track intent.

This block now comments out all expression-bar/editor interactions and the basic/map.ts content assertion, so testBasicMappings no longer validates expression-bar behaviour or its generated TS output. If this is a temporary workaround for flakiness, it’d be better to (a) add a clear comment with a linked issue, or (b) move this logic into a dedicated test marked test.skip / test.fixme instead of leaving a large commented block.

A minimal clarification patch could look like:

-      // console.log('- Test expression bar');
+      // Expression bar tests are temporarily disabled (see <ticket/issue-id>).
+      // TODO: Re-enable these steps once the flakiness is resolved.
+      // console.log('- Test expression bar');
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2b4a73 and 589dd55.

📒 Files selected for processing (2)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts (0 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts
🔇 Additional comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

193-200: Custom-function mapping step looks consistent.

The custom-function mapping and surrounding logging follow the same pattern as other mapping tests and use the existing helpers correctly. No issues from a test-logic perspective.

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: 0

🧹 Nitpick comments (2)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1)

230-244: Add TODO comment explaining why custom function test is disabled.

The custom function mapping test is commented out rather than removed, suggesting this is temporary. However, there's no explanation of why it's disabled or when it should be re-enabled.

Given the PR title mentions "Increase assertion timeout," consider either:

  1. Adding a TODO comment explaining the issue and linking to a tracking ticket
  2. Actually increasing the timeout if that's the root cause

Apply this diff to document the temporary state:

+      // TODO: Custom function test temporarily disabled due to flakiness
+      // Track re-enablement in issue #XXX
       // console.log('- Test custom function');
       // custom function mapping
       // objectOutput.oCustomFn = input.iCustomFn;
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts (1)

64-73: Type mismatch: mapFunction signature and return object are inconsistent.

The function signature declares it returns OutputRoot (line 64), but the interface OutputRoot defines oCustomFn and oExp as required properties (lines 51-56), which are not included in the returned object. This would normally be a TypeScript compilation error.

However, since this is a test fixture file used for text comparison (verified at dataMapper.spec.ts line 272), this inconsistency may be acceptable. The change correctly aligns with the disabled custom function test in the spec file.

If this fixture is meant to be valid TypeScript, consider making the omitted properties optional in the interface:

    oObjProp: {
        p1: string
        p2: number
    }
-    oCustomFn: {
+    oCustomFn?: {
        k1: string
        k3: number
    }
-    oExp: string
+    oExp?: string
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e2dbf5 and f925a5c.

📒 Files selected for processing (3)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts

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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts (2)

51-54: TypeScript interface mismatch: oCustomFn declared but never assigned.

The OutputRoot interface declares oCustomFn (lines 51-54), but mapFunction does not assign it in the return statement (lines 64-78). This will result in the field being undefined at runtime, which may cause type errors or unexpected behavior downstream.

Since the custom function test is commented out in dataMapper.spec.ts (lines 230-243), either:

  1. Remove the oCustomFn field from the OutputRoot interface to match the implementation, or
  2. Uncomment the test and restore the assignment: oCustomFn: mapObjectToObject(input.iCustomFn),

</invoke_comment_end -->

Also applies to: 64-78


80-82: Remove unused helper function.

The mapObjectToObject function is defined but never invoked. This is dead code that should be removed to improve maintainability.

Apply this diff to remove the unused function:

-function mapObjectToObject(iCustomFn: Root["iCustomFn"]): OutputRoot["oCustomFn"] {
-    return {};
-}

</invoke_comment_end -->

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f925a5c and 5721483.

📒 Files selected for processing (3)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts

Comment on lines 230 to 243
// console.log('- Test custom function');
// custom function mapping
// objectOutput.oCustomFn = input.iCustomFn;
await dm.mapFields('input.iCustomFn', 'objectOutput.oCustomFn', 'menu-item-o2o-func');
// await dm.mapFields('input.iCustomFn', 'objectOutput.oCustomFn', 'menu-item-o2o-func');

await dmWebView.getByTestId('link-from-input.iCustomFn.OUT-to-datamapper-intermediate-port').waitFor({ state: 'attached' });
await dmWebView.getByTestId('link-from-datamapper-intermediate-port-to-objectOutput.oCustomFn.IN').waitFor({ state: 'attached' });
await dmWebView.getByTestId('link-connector-node-objectOutput.oCustomFn.IN').waitFor();
// await dmWebView.getByTestId('link-from-input.iCustomFn.OUT-to-datamapper-intermediate-port').waitFor({ state: 'attached' });
// await dmWebView.getByTestId('link-from-datamapper-intermediate-port-to-objectOutput.oCustomFn.IN').waitFor({ state: 'attached' });
// await dmWebView.getByTestId('link-connector-node-objectOutput.oCustomFn.IN').waitFor();

const editorTab = page.page.getByRole('tab', { name: `${dmName}.ts, Editor Group` });
await editorTab.waitFor({ state: 'attached' });
// const editorTab = page.page.getByRole('tab', { name: `${dmName}.ts, Editor Group` });
// await editorTab.waitFor({ state: 'attached' });

await editorTab.locator('.codicon-close').click();
await editorTab.waitFor({ state: 'detached' });
// await editorTab.locator('.codicon-close').click();
// await editorTab.waitFor({ state: 'detached' });
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 | 🟡 Minor

PR objective mismatch: test steps disabled instead of timeout increased.

The PR title states "Increase assertion timeout," but these changes disable the custom function mapping test by commenting out the execution steps rather than adjusting timeout values.

If the goal is to address test flakiness or timing issues as implied by the title, consider:

  1. Uncommenting these steps and increasing the timeout parameter in the relevant waitFor() calls (e.g., waitFor({ state: 'attached', timeout: 10000 })), or
  2. Updating the PR title and description to reflect that this change intentionally disables the custom function test path.

</invoke_comment_end -->

🤖 Prompt for AI Agents
In workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts
around lines 230-243, the custom function mapping test steps were commented out
instead of increasing assertion timeouts; restore the commented test steps
(uncomment the mapping and all subsequent waitFor()/locator/editor interactions)
and add explicit timeout options to the relevant waitFor() calls (e.g.,
waitFor({ state: 'attached', timeout: 10000 }) or a suitable value for your CI),
ensuring all awaited locators and editor interactions include timeouts; if the
change was intentional to disable the test, update the PR title/description to
reflect that instead of claiming an "Increase assertion timeout" fix.

Comment on lines 230 to 245
// console.log('- Test custom function');
// custom function mapping
// objectOutput.oCustomFn = input.iCustomFn;
await dm.mapFields('input.iCustomFn', 'objectOutput.oCustomFn', 'menu-item-o2o-func');
// await dm.mapFields('input.iCustomFn', 'objectOutput.oCustomFn', 'menu-item-o2o-func');

await dmWebView.getByTestId('link-from-input.iCustomFn.OUT-to-datamapper-intermediate-port').waitFor({ state: 'attached' });
await dmWebView.getByTestId('link-from-datamapper-intermediate-port-to-objectOutput.oCustomFn.IN').waitFor({ state: 'attached' });
await dmWebView.getByTestId('link-connector-node-objectOutput.oCustomFn.IN').waitFor();
// await dmWebView.getByTestId('link-from-input.iCustomFn.OUT-to-datamapper-intermediate-port').waitFor({ state: 'attached' });
// await dmWebView.getByTestId('link-from-datamapper-intermediate-port-to-objectOutput.oCustomFn.IN').waitFor({ state: 'attached' });
// await dmWebView.getByTestId('link-connector-node-objectOutput.oCustomFn.IN').waitFor();

const editorTab = page.page.getByRole('tab', { name: `${dmName}.ts, Editor Group` });
await editorTab.waitFor({ state: 'attached' });
// const editorTab = page.page.getByRole('tab', { name: `${dmName}.ts, Editor Group` });
// await editorTab.waitFor({ state: 'attached' });

await editorTab.locator('.codicon-close').click();
await editorTab.waitFor({ state: 'detached' });
// await editorTab.locator('.codicon-close').click();
// await editorTab.waitFor({ state: 'detached' });

expect(dm.verifyTsFileContent(path.join('basic', 'map.ts'))).toBeTruthy();
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

Test execution and verification are inconsistent.

The custom function mapping steps are commented out (lines 230-243), meaning oCustomFn is never created in the data mapper. However, the test still verifies the TypeScript file content at line 245 against 'basic/map.ts'.

This creates ambiguity:

  • If the test fixture 'basic/map.ts' includes the oCustomFn assignment, the verification will fail because the mapping was never created.
  • If the test fixture was updated to exclude oCustomFn (as seen in the related map.ts file under review), then the commented test steps are obsolete and should be removed entirely rather than left as comments.

Either uncomment the test steps to execute the full custom function flow, or remove the commented code blocks and update documentation to reflect that custom function mapping is no longer tested in this suite.

</invoke_comment_end -->

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts (1)

79-81: Incomplete implementation of mapObjectToObject.

The function returns an empty object {} but should return an object matching OutputRoot["oCustomFn"]: {k1: string, k3: number}. This will cause the mapping to produce incorrect results and violate the output interface contract.

Based on the PR context mentioning "Disabled/removed portions of an E2E custom-function mapping test," this may be intentionally stubbed. However, for production test data, implement the proper mapping logic.

Apply this diff to implement a basic mapping:

 function mapObjectToObject(iCustomFn: Root["iCustomFn"]): OutputRoot["oCustomFn"] {
-    return {};
+    return {
+        k1: iCustomFn.k1,
+        k3: iCustomFn.k2  // Or apply appropriate transformation
+    };
 }

</review_comment_end>

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5996071 and 52e3dbe.

📒 Files selected for processing (3)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/map.ts
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts

Comment on lines 66 to 67
oManyOne: input.iManyOne1 + input.iManyOne2 + input.iManyOne3,
oManyOneErr: input.iManyOne2 + input.iManyOneErr + input.iManyOne3,
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

Type mismatch in oManyOneErr computation.

Line 67 concatenates iManyOne2 (string) + iManyOneErr (boolean) + iManyOne3 (string), which produces a string (e.g., "value1truevalue2"), but the OutputRoot interface expects oManyOneErr to be a number (line 38). JavaScript's + operator will coerce the boolean to a string rather than perform numeric addition.

If this is intentional test data for error scenarios (suggested by the "Err" suffix), consider documenting the expected behavior or explicitly handling type conversion.

</review_comment_end>

🤖 Prompt for AI Agents
In
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts
around lines 66-67, the oManyOneErr field is computed as input.iManyOne2 +
input.iManyOneErr + input.iManyOne3 which performs string concatenation because
iManyOne2 and iManyOne3 are strings and iManyOneErr is boolean; OutputRoot
expects oManyOneErr to be a number. Fix by converting operands to numbers (e.g.,
Number(input.iManyOne2) + Number(input.iManyOneErr) + Number(input.iManyOne3))
or otherwise compute a numeric value (parseInt/parseFloat as appropriate), or if
the intention is to test a type-error case, add a clarifying comment and adjust
the OutputRoot type to string.

Comment on lines 68 to 73
oObjDirect: input.iObjDirect,
oObjDirectErr: input.iObjDirect,
oObjProp: {
p1: input.iObjDirect.d1 + "HI",
p2: input.iObjProp.op2
},
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

Type mismatches in object field mappings.

Two type safety issues:

  1. Line 69: oObjDirectErr is assigned input.iObjDirect (which has d2: number), but OutputRoot["oObjDirectErr"] expects d2: string (line 45).

  2. Line 72: oObjProp.p2 is assigned input.iObjProp.op2 (which is string per line 21), but the interface expects p2: number (line 49).

If these are intentional for error-scenario testing, consider adding comments or explicit type coercion to clarify intent.

</review_comment_end>

Comment on lines 74 to 75
oCustomFn: mapObjectToObject(input.iCustomFn),
oExp: dmUtils.toUppercase(input.iExp)
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 | 🔴 Critical

oCustomFn assignment relies on incomplete implementation.

Line 74 assigns the result of mapObjectToObject(input.iCustomFn) to oCustomFn, but the function returns an empty object {} (line 80), while OutputRoot["oCustomFn"] expects {k1: string, k3: number}. This will cause type violations and likely test failures.

See the comment on lines 79-81 for details.

</review_comment_end>

🤖 Prompt for AI Agents
In
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts
around lines 74-75 (implementation at ~79-81), the mapObjectToObject function
currently returns an empty object which violates OutputRoot["oCustomFn"] ({k1:
string, k3: number}); update the function to map fields from the input to the
expected output shape (for example set k1 = iCustomFn.k1 and derive k3 from
iCustomFn.k2 or appropriate logic), ensure proper typing/null checks so the
returned object exactly matches {k1: string, k3: number}, and run type
checks/tests to confirm compliance.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 52e3dbe and 833c620.

📒 Files selected for processing (2)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts (1 hunks)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/dataMapper.spec.ts
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-20T06:44:07.498Z
Learnt from: KCSAbeywickrama
Repo: wso2/vscode-extensions PR: 969
File: workspaces/ballerina/data-mapper/src/components/Diagram/utils/node-utils.ts:23-44
Timestamp: 2025-11-20T06:44:07.498Z
Learning: In the data mapper node-utils.ts, when `lastViewIndex == 0`, the code is at the root view and should NOT use `focusInputRootMap` for fallback input node resolution. The truthiness check on `lastViewIndex` is intentional to skip the fallback at the root level.

Applied to files:

  • workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts
🔇 Additional comments (1)
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts (1)

66-66: LGTM!

The oManyOne computation correctly concatenates three string inputs to produce a string output, matching the expected type.

Comment on lines 65 to 76
return {
oManyOneErr: input.iManyOne2 + input.iManyOneErr,
oManyOne: input.iManyOne1 + input.iManyOne2 + input.iManyOne3,
oManyOneErr: input.iManyOne2 + input.iManyOneErr + input.iManyOne3,
oObjDirect: input.iObjDirect,
oObjDirectErr: input.iObjDirect,
oObjProp: {
p1: input.iObjDirect.d1 + "HI",
p2: input.iObjProp.op2
},
oCustomFn: mapObjectToObject(input.iCustomFn)
oCustomFn: mapObjectToObject(input.iCustomFn),
oExp: dmUtils.toUppercase(input.iExp)
}
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 | 🔴 Critical

Missing required fields in mapFunction return statement.

The return statement is missing two required fields from the OutputRoot interface:

  • oPrimDirect (expected type: string, line 35)
  • oPrimDirectErr (expected type: number, line 36)

This will cause TypeScript compilation errors due to type-safety violations.

Apply this diff to add the missing fields:

 export function mapFunction(input: Root): OutputRoot {
     return {
+        oPrimDirect: input.iPrimDirect,
+        oPrimDirectErr: input.iPrimDirectErr,
         oManyOne: input.iManyOne1 + input.iManyOne2 + input.iManyOne3,
         oManyOneErr: input.iManyOne2 + input.iManyOneErr + input.iManyOne3,

Note: oPrimDirectErr expects a number but iPrimDirectErr is a string (line 10). If this is intentional test data for error scenarios, either:

  1. Convert the input: oPrimDirectErr: Number(input.iPrimDirectErr) or parseInt(input.iPrimDirectErr)
  2. Update the interface type to match the intended behavior

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
workspaces/mi/mi-extension/src/test/e2e-playwright-tests/data/datamapper-files/basic/del.ts
around lines 65 to 76, the mapFunction return is missing two required OutputRoot
fields: oPrimDirect (string) and oPrimDirectErr (number); add oPrimDirect:
input.iPrimDirect and add oPrimDirectErr: Number(input.iPrimDirectErr) (or
parseInt) to the returned object so types align, or if the string-to-number
conversion is unintended, update the OutputRoot/interface to accept a string
instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant