Situation: Currently, i have a setup of two containers
- testdata container
- e2e container
The e2e container is based on cypress image and does run it's testsuite against an external url (on the internet) for example https://foobar.com
On that url a app runs which does some AJAX requests to foobar.com/api
I would like to point every request to the /api done by the app hosted on foobar.com to the testdata container.
So GET https:foobar.com/api/test needs to go to testdata:8080/api/test
Biggest question: is this even possible? Because the app itself is not hosted locally in docker. And if so: How? Any ideas?
Curl from testData container works:
curl "testdata:8080/api/test"
setup
Docker compose file
testdata:
image:
wiremock/wiremock
restart: always
command: [--enable-stub-cors]
container_name: wiremock-server
volumes:
- ./testData/mappings:/home/wiremock/mappings
- ./testData/__files:/home/wiremock/__files
ports:
- 8080:8080
e2e:
image: cypress
build: ./e2e
container_name: cypress
depends_on:
- testdata
command: npx cypress run --no-exit
volumes:
- ./e2e/cypress:/app/cypress
- ./e2e/cypress.config.js:/app/cypress.config.js
e2e docker file
FROM cypress/base:14
#FROM cypress/browsers:node18.6.0-chrome105-ff104
WORKDIR /app
COPY package.json .
COPY package-lock.json .
ENV CI=1
RUN npm ci
RUN npx cypress verify
testData docker file
FROM wiremock/wiremock