AssertionError: Timed out retrying: expected to not have been called at least once
Current behavior
I upgraded from Angular v22.1 to v22.2 and suddently got a flaky test, Cypress got unchanged in v15.21.1 running via @nx/cypress v23.2.1 executor.
When I open the e2e locally I don't see any issue with this screen, and the local run passes. However, in the CI this screen always fails, even after multiple retries. This is the output I'm getting in the CI:
There's no output in the console, so it's true, console.error has not being called.
But in this case, makes no sense to timeout...
The weird thing, is that all the other 50 tests are fine, but this single screen is not
Desired behavior
To not timeout waiting for something that should('not.be.called').
There's only one usage of this in this setup.
Test code to reproduce
Setup an error detector with this code:
// commands.ts
Cypress.Commands.overwrite('visit', (visit, args) => {
return visit({
onBeforeLoad(win) {
cy.stub(win.console, 'error').callsFake(console.log).as('console.error');
...
// e2e.ts
afterEach(() => {
cy.wait(1000);
// after the test there should be no errors logged
cy.get('@console.error').should('not.be.called');
});the test failing looks like this:
describe('asset-management/trending', () => {
beforeEach(() => {
cy.visit('/asset-management/trending');
});
it('should load trending and check vulnerability type and asset visibility filters', () => {
getMenuActive().contains('Trending');
cy.findByText('Compare From').should('exist');
cy.findByText('Compare To').should('exist');
verifyToggleGroupButton('Vulnerability Type', ['Confirmed', 'Potential']);
verifyToggleGroupButton('Asset Visibility', ['Internal', 'External']);
});
});just like others that are running fine.
Cypress Version
15.21.1
Debug Logs
https://gist.github.com/matheo/c6011fa3d8724e0b33159f25404257c0Other
No response
Source: cypress-io/cypress