Skip to content

Commit

Permalink
fix: Cypress scroll on trigger events (#31248)
Browse files Browse the repository at this point in the history
## Description

This PR fixes the cypress failure issue due to scroll.

#### PR fixes following issue(s)
Fixes #31263


#### Type of change

- Bug fix (non-breaking change which fixes an issue)

## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [ ] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Refactor**
- Updated the handling of mouse events in the Entity Explorer to improve
user interaction with draggable elements.
- **Tests**
- Added a new test spec for exporting applications and updated the test
spec for forking applications in the limited tests configuration.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Aishwarya UR <[email protected]>
  • Loading branch information
albinAppsmith and Aishwarya-U-R authored Feb 23, 2024
1 parent 543c475 commit 201d954
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions app/client/cypress/support/Pages/EntityExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,14 @@ export class EntityExplorer {
: this.locator._dropHere,
)
.first()
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" })
.trigger("mousemove", x, y, { eventConstructor: "MouseEvent" });
.trigger("mousemove", x, y, {
eventConstructor: "MouseEvent",
scrollBehavior: false,
})
.trigger("mousemove", x, y, {
eventConstructor: "MouseEvent",
scrollBehavior: false,
});
this.agHelper.Sleep(200);
cy.get(
parentWidgetType
Expand All @@ -182,7 +188,10 @@ export class EntityExplorer {
: this.locator._dropHere,
)
.first()
.trigger("mouseup", x, y, { eventConstructor: "MouseEvent" });
.trigger("mouseup", x, y, {
eventConstructor: "MouseEvent",
scrollBehavior: false,
});
}

public DragDropWidgetNVerify(
Expand Down
2 changes: 1 addition & 1 deletion app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ Cypress.Commands.add("dragAndDropToCanvas", (widgetType, { x, y }) => {
.trigger("dragstart", { force: true })
.trigger("mousemove", x, y, { force: true });

const option = { eventConstructor: "MouseEvent" };
const option = { eventConstructor: "MouseEvent", scrollBehavior: false };

cy.get(explorer.dropHere)
.trigger("mousemove", x, y, option)
Expand Down

0 comments on commit 201d954

Please sign in to comment.