abramenal/cypress-shadow-dom

[Feature] cy.shadowFind doesn't repeat until a timeout

chiarazambe-smeup opened this issue ยท 10 comments

It seems that cy.shadowFind doesn't work like cy.get because after a click I must use cy.wait(500) and then make a find. It seems that cy.shadowFind doesn't repeat more times until a timeout... Is it true? I'm a newbie with Cypress and I'm not so sure...

This is my code:

it('test first table', () => {
  cy.visit('http://localhost:4000/#/dataTable/basic');

  cy.shadowGet('kup-data-table')
    .shadowFind('.density-medium')
    .its('length')
    .should('eq', 1);

  cy.shadowGet('kup-data-table')
    .shadowFind('kup-button')
    .shadowFind('button')
    .shadowTrigger('click');

  // cy.shadowFind don't seem to be repeated until a timeout like cy.get...  -> actually used a manual wait!
  cy.wait(500);

  cy.shadowGet('kup-data-table')
    .shadowFind('.density-small')
    .its('length')
    .should('eq', 1);
});

Can you help me?
If it is how I think the library can be improved adding a timeout?
If I'm wrong could you tell me how to avoid using cy.wait?

Thanks a lot!

Hi @chiarazambe-smeup
Thanks for submitting the issue.

That is a definitely a to improve, interface and behavior should be similar to cy.get.
Will pick that up later this week.

@abramenal Do you have any updates on this?

Hi all,
still no time to pick this up.. hopefully this week but won't promise anything until it gets started.
Thanks for understanding ๐Ÿ™

Hey all! Started working on this, seems I've found pretty straightforward solution. Will release a beta in the next couple of days to let you test it.

I'd be interested in testing out the beta. Looking forward to the PR!

Hi all!
Feel free to test this out! npm install cypress-shadow-dom@1.1.0.
Please note it is under beta tag at the moment.

@chiarazambe-smeup @mcMickJuice @Postavshik @mandric any chance to test this?

@abramenal I left a review of the PR - #14 (review)

I think we might need to add this timeout functionality to all shadow* methods. I might be able to submit a PR later this week if you don't get to it.

@mcMickJuice sounds good! I think I can only start next week so feel free to start this out if you have time.
And big thanks for PR review, valuable comments! ๐Ÿ‘