Skip to content

Conversation

@mabaasit
Copy link
Collaborator

@mabaasit mabaasit commented Jul 24, 2025

Ticket: COMPASS-9627

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Copilot AI review requested due to automatic review settings July 24, 2025 14:32
@mabaasit mabaasit requested a review from a team as a code owner July 24, 2025 14:32
@github-actions github-actions bot added the fix label Jul 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a drag-and-drop operation in the e2e tests for the data modeling tab by changing how the pointer moves to the target node position.

  • Simplifies the node positioning logic by using the element reference directly instead of calculating absolute coordinates
  • Removes manual coordinate calculations that may have been causing positioning inaccuracies

x: Math.round(startPosition.x + nodeSize.width / 2),
y: Math.round(startPosition.y + nodeSize.height / 2),
})
.move({ origin: node, x: nodeSize.width / 2, y: nodeSize.height / 2 })
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

The division operations nodeSize.width / 2 and nodeSize.height / 2 could result in fractional pixel values. Consider using Math.round() to ensure precise positioning, similar to the original implementation.

Suggested change
.move({ origin: node, x: nodeSize.width / 2, y: nodeSize.height / 2 })
.move({ origin: node, x: Math.round(nodeSize.width / 2), y: Math.round(nodeSize.height / 2) })

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copilot has a point here, I think I've seen errors before I added the rounding

@Anemy Anemy added no release notes Fix or feature not for release notes no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) labels Jul 24, 2025
@paula-stacho
Copy link
Collaborator

paula-stacho commented Jul 24, 2025

The change makes sense to me, but I don't think this could've been causing the failure in
https://parsley.mongodb.com/test/10gen_compass_main_test_web_sandbox_test_web_sandbox_firefox_2_6881859323681900071339ec_25_07_24_01_00_03/0/92c0864f9996d1a502c0742d63abdb98?bookmarks=0,8&shareLine=0
This seems like the nodes were not displayed yet, leading to this check to fail:

    expect(nodes).to.have.lengthOf(2);

Were there other failures?

@mabaasit mabaasit marked this pull request as draft July 24, 2025 17:19
Copy link
Collaborator

@paula-stacho paula-stacho left a comment

Choose a reason for hiding this comment

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

Thank you! I honestly thought I'd already done this, must've removed it by accident

@mabaasit mabaasit changed the title fix(e2e-tests): move to exact target when dragging node fix(e2e-tests): wait for diagram nodes to be visible Jul 28, 2025
@mabaasit mabaasit changed the title fix(e2e-tests): wait for diagram nodes to be visible fix(e2e-tests): wait for diagram nodes to be visible COMPASS-9627 Jul 29, 2025
@mabaasit mabaasit marked this pull request as ready for review July 29, 2025 08:21
@mabaasit mabaasit merged commit 37dc196 into main Jul 29, 2025
60 of 63 checks passed
@mabaasit mabaasit deleted the fix-diagram-drag-in-tests branch July 29, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix no release notes Fix or feature not for release notes no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants