ToolJet/cypress-tests/cypress/support/utils/inspector.js
Midhun Kumar E e21de08794
Fixed cypress for v2.6.0 (#6430)
* Add data-cy for the event handler input fields (#6382)

* Added automation for inspector. (#6380)

* Add utils for inspector node verification

* Add inspector verification spec

* Add verification for inspector buttons

* Fix cypress failure

* update toast message

* Modify Config

---------

Co-authored-by: Mekhla Asopa <[email protected]>
2023-05-17 12:14:03 +05:30

31 lines
1 KiB
JavaScript

export const verifyNodeData = (node, type, children) => {
cy.get(
`[data-cy="inspector-node-${node.toLowerCase()}"] > .node-length-color`
)
.realHover()
.verifyVisibleElement("have.text", `${children}`);
cy.get(
`[data-cy="inspector-node-${node.toLowerCase()}"] > .node-key`
).verifyVisibleElement("have.text", node);
cy.get(
`[data-cy="inspector-node-${node.toLowerCase()}"] > .node-type`
).verifyVisibleElement("have.text", type);
};
export const openNode = (node, index = 0) => {
cy.get(`[data-cy="inspector-node-${node.toLowerCase()}"] > .node-key`)
.eq(index)
.click();
};
export const verifyValue = (node, type, children) => {
cy.get(`[data-cy="inspector-node-${node.toLowerCase()}"] > .mx-2`)
.realHover()
.verifyVisibleElement("have.text", `${children}`);
cy.get(
`[data-cy="inspector-node-${node.toLowerCase()}"] > .node-key`
).verifyVisibleElement("have.text", node);
cy.get(
`[data-cy="inspector-node-${node.toLowerCase()}"] > .mx-1`
).verifyVisibleElement("have.text", type);
};