Random failures over Regexp: Invalid regular expression
See original GitHub issueI get very strange non-deterministic errors when opening my website in Cypress. It complains about a failing Regexp, but the weird thing is that this never causes a problem in a normal browser, and in fact, even within the Cypress browser, if I open a new tab and reload the code, it works perfectly. And I also added on Cypress.on(‘uncaught.exception’) to my code, which does not seem to help.
Here’s my test script:
const uuid = require('cuid');
Cypress.on('uncaught:exception', (err, runnable) => {
return false;
});
describe('My First Test', function() {
it('finds the content "type"', function() {
const id = uuid();
// cy.wait(30000 * Math.random());
cy.visit(`https://icchilisrv3.epfl.ch:7000/w948?login=${id}`);
cy.get('video', { timeout: 90000 });
cy
// .wait(10000)
.then(() => cy.wrap(Cypress.$('video')[0].networkState).should('eq', 2));
cy.wait(180000);
});
});
Here you see two tabs of the same browser, consistently showing completely different behaviour (even when reloading etc). What’s very strange is that when I deploy this in 30 different browsers using Kubernetes, I get half of them failing with this error, and the other half working normally! Perhaps this is a timing issue (the reason for the non-determinism) with some interaction between my code and Cypress test code?
Here you see examples of failing and successful Cypress runs - these are exactly the same code in different Kubernetes containers:
(in this case, I don’t get the error exceptions, because of the uncaught.exception setting, but the behaviour is exactly the same as in interactive mode, making me believe that the problem is identical).
Reference to Cypress dashboard run
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:18 (5 by maintainers)
Top GitHub Comments
@houshuang Not sure if you fixed this issue or not but I’ve managed to get around it by adding
"modifyObstructiveCode": false
to my cypress.jsonI think this might be related to #1396 ?
Ran this example https://github.com/cypress-io/cypress/issues/2112#issuecomment-510899430 with the #4698 build and I still get invalid regular expression.