abramenal/cypress-shadow-dom

[Bug]

sarafs opened this issue · 2 comments

Current behavior:

  1. e2e tests for MP lookup finds the mp lookup embed:
    CypressError: Timed out retrying: Expected to find element: 'undefined', but never found it.

Desired behavior:

Tests pass

Steps to reproduce: (app code and test code)

spec.js ->
import 'cypress-shadow-dom';
describe('e2e tests for MP lookup', () => {
  it('finds the mp lookup embed', () => {
  	cy.visit('https://www.bbc.co.uk/news/uk-politics-49571868');
  	cy.get('.bbc-news-vj-embed-wrapper')
  	cy.wait(500);

  	cy.shadowGet('.bbc-news-vj-wrapper')
  	  .shadowFind('.gel-wrap');

  	cy.shadowGet('.mps-lookup')
  	  .shadowFind('.lookup-header').wait(5000);

  });
 
})
commands.js
import 'cypress-shadow-dom';
index.js
import './commands';
I have created a branch locally, however do not have the right permissions to push to `cypress-io/cypress-test-tiny.git`

Versions

"cypress": "^3.6.1",
"cypress-shadow-dom": "^1.1.1"
Mac OS 10.12.6 , Running tests off Terminal Version 2.7.5 npx cypress run or npx cypress open

Hi @sarafs
Thanks for submitting the issue!

I think the issue should be fixed now with retryability feature across all the commands.
Please take a look on the API reference, there's an optional object where you could state your custom timeout value.

It should look like:

cy.shadowGet('.mps-lookup')
  .shadowFind('.lookup-header', { timeout: 5000 });

Note: this works in any version starting from v1.1.1

Thanks for getting back @abramenal. Sorry, it's taken me longer than expected to try out your solution.
The tests are failing because I suspect Cypress is preventing the Shadow dom component to load in the page when I inspect it using your plugin.
Screen Shot 2019-11-26 at 15 34 54

Screen Shot 2019-11-26 at 15 33 31

I've raised this issue with Cypress - cypress-io/cypress#5798