Hi there! The next code always passes while runnin...
# help
b
Hi there! The next code always passes while running cypress open but never passes when running cypress run. In both cases we use Electron 94. Do you have any possible idea of how that can happen?
Copy code
typescript
cy.contains('.pack-title', statut)
  .next('div')
  .find("mat-expansion-panel-header")
  .click();
cy.get("mat-form-field")
  .find("textarea")
  .should('be.visible').and('contain', '');
Thanks in advance!
n
I would try to reduce chaining of commands or for testing purpose add fixed timeouts between chained commands and see does it pass in the run mode. Only the last chained command is retried if retry is supported with the command. So if you have multiple
mat-form-field
but only one have
textarea
and that one appeared a bit later than others.
cy.get
will find first x elements and proceed to next chained command which is
find
and then find will try to find
textarea
inside existing set of elements that
cy.get
returned and it will not try to include elements that appeared a bit later. I hope this is clear enough.
b
Thank you so much for the advice in chained commands retry, I didn't know that
6 Views