[Bug]
sarafs opened this issue · 2 comments
Current behavior:
- 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';
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.
I've raised this issue with Cypress - cypress-io/cypress#5798