PromucFlow_constructor/app/client/cypress/support/Pages/Canvas.ts
albinAppsmith 3d2b33c0fa
chore: cypress test for canvas view mode (#32354)
## Description

This PR added cypress test for canvas view mode.

Fixes #31874

## Automation

/ok-to-test tags="@tag.Sanity, @tag.IDE"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!IMPORTANT]  
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/8534736683>
> Commit: `f1d8cc5c4437571b5bbe9a43e892068ae774c75f`
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8534736683&attempt=1"
target="_blank">Click here!</a>
> All cypress tests have passed 🎉🎉🎉

<!-- end of auto-generated comment: Cypress test results  -->





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

- **New Features**
- Introduced testing functionality for Canvas view mode in IDE,
including various interactions and validations.
- Added a new Cypress command for asserting the presence and content of
tooltips.
- Enhanced tooltip message customization in the Canvas view mode with a
new message creation function.

- **Refactor**
- Improved code organization in Canvas support files with better method
implementations.

- **Tests**
- Added end-to-end tests for new and existing functionalities related to
the Canvas view mode.

- **Documentation**
- Updated Cypress support documentation with the new
`assertTooltipPresence` method.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-04-03 14:52:09 +05:30

31 lines
858 B
TypeScript

import { agHelper } from "../Objects/ObjectsCore";
import EditorNavigation from "./EditorNavigation";
class Canvas {
selectMultipleWidgets(widgetNames: string[]) {
EditorNavigation.ShowCanvas();
for (const widget of widgetNames) {
// Ctrl click on widget name component
this.commandClickWidget(widget);
}
}
hoverOnWidget(widgetName: string) {
const selector = `[data-widgetname-cy="${widgetName}"] > div`;
agHelper.Sleep(500);
cy.get(selector).trigger("mouseover", { force: true }).wait(500);
}
commandClickWidget(widgetName: string) {
cy.get(`div[data-widgetname-cy='${widgetName}']`).realHover();
cy.get(`div[data-testid="t--settings-controls-positioned-wrapper"]`)
.contains(widgetName)
.click({
force: true,
ctrlKey: true,
});
}
}
export default new Canvas();