mocks-server / main

Node.js mock server running live, interactive mocks in place of real APIs
https://www.mocks-server.org
Apache License 2.0
290 stars 17 forks source link

Cypress commands failing in docker environment #502

Closed petertellgren closed 2 months ago

petertellgren commented 2 months ago

using @mocks-server/cypress-command when running cypress in docker fails:

spec file:

// fails
cy.mocksUseRouteVariant("get-user:failure");
// works
cy.request(`http://${Cypress.env("MOCKS_SERVER_ADMIN_API_HOST")}:3110/api/mock/routes`).then((response) => {
 cy.log(response.body);
});

so the cy.mocksUseRouteVariant("get-user:failure"); fails where as the cy.request with the same values seems to work.

log [Mocks Server] Error trying to set route variant 'get-user: failure', Error: Network request failed
log [Mocks Server] You should check if the Admin API is listening on http://mocks-server:3110 

To Reproduce docker-compose file with 2 services. mocks-server cypress

a spec file in cypress container that tries to set a custom route

Expected behavior the custom route command works.

petertellgren commented 2 months ago

Closing as upon creating a test repo to reproduce this I was unable to and it works as expected.