Open hausdora opened 1 year ago
When I run .getCurrentState I get back an object with two properties. But I'm having trouble doing anything with them.
const state = cy.getReact("Comp").getCurrentState(); cy.log(state); //logs: {hidden: false, context: Object{6}} const state = cy.getReact("Comp").getCurrentState().context; cy.log(state); //logs nothing
Nothing I'm trying works, how do I make assertions against the getCurrentState return?
cy.getReact("Comp").getCurrentState() .should(($state) => { expect($state.context.active.should("have.length", 3)) });
Attempt 2
cy.getReact("Comp").getCurrentState("context.active").should("have.length", 3)
Attempt 3
const state = cy .getReact("Graphin") .getCurrentState() .then((data) => cy.log(JSON.stringify(data))); cy.log(state); //Throws TypeError: Converting circular structure to JSON --> starting at object with constructor 'HTMLDivElement' | property '__reactInternalInstance$977odfgpjmb' -> object with constructor 'FiberNode' --- property 'stateNode' closes the circle
It doesn't seem to work like getProps, but I can't find any documentation on how I would make assertions against the return.
When I run .getCurrentState I get back an object with two properties. But I'm having trouble doing anything with them.
Nothing I'm trying works, how do I make assertions against the getCurrentState return?
Attempt 2
cy.getReact("Comp").getCurrentState("context.active").should("have.length", 3)
Attempt 3
It doesn't seem to work like getProps, but I can't find any documentation on how I would make assertions against the return.