Example running Cypress against Apache server running in a Docker container
Install NPM dependencies (mostly Cypress really)
npm install
If you have Docker running, build a Docker image with Apache webserver and a single static page.
npm run build
See package.json for the example Docker command that runs. Should build image website
.
Once the image is built, start it with npm start
. This should start Docker container my-site
and expose the Apache server at http://localhost:8080
. Set this url as baseUrl
in the cypress.json file.
Start Cypress Test Runner
npm run cy:open
This should open a list of specs, select spec filename like spec.js and it should run a simple end-to-end test against the Apache server running in a Docker container.
You can shutdown the container by name. To find it use
docker ps --filter=name=my-site
# take the ID then stop the container
docker stop <id>