ToolJet/cypress-tests/cypress/support/utils/inspector.js
Midhun Kumar E 763b1eaa27
Added automation for runjs (#6536)
* Initial Utils and spec

* Add automation for set and unset variable

* Add validations for globals, and rename

* Modify config file

* Add all the fixes

* Revert config
2023-05-30 10:32:10 +05:30

32 lines
1.1 KiB
JavaScript

export const verifyNodeData = (node, type, children, index = 0) => {
cy.get(
`[data-cy="inspector-node-${node.toLowerCase()}"] > .node-length-color`
)
.eq(index)
.realHover()
.verifyVisibleElement("have.text", `${children}`);
cy.get(`[data-cy="inspector-node-${node.toLowerCase()}"] > .node-key`)
.eq(index)
.verifyVisibleElement("have.text", node);
cy.get(`[data-cy="inspector-node-${node.toLowerCase()}"] > .node-type`)
.eq(index)
.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);
};