Cypress .intercept() not working in CircleCI, works locally

Viewed 132

I have a set of tests running fine locally, but when they're running inside of a CircleCI build, the intercept command doesn't work as intended. Checking the Cypress recording shows that no request is ever made.

Test Code:

before( () => {
   cy.intercept( 'GET', '**wp-json/wp/v2/pages?context=edit&status%5B0%5D=publish**' ).as( 'getPages' );
   cy.intercept( 'GET', '**wp-json/wp/v2/posts?context=edit&status%5B0%5D=publish**' ).as( 'getPosts' );

   openComplementaryArea( 'Site contents' );

   // Make sure our data has loaded.
   cy.wait( '@getPages' ).its( 'response.statusCode' ).should( 'eq', 200 );
   cy.wait( '@getPosts' ).its( 'response.statusCode' ).should( 'eq', 200 );
} );

I've tried increasing the length of time the intercept command waits, but still the request never comes through.

Any ideas why this would be working locally, but not up in a CircleCI build? I've been pulling my hair out for a few days now, trying everything I could think of.

Localhost: enter image description here

CircleCI Build: enter image description here

0 Answers
Related