Skip to content

Example running Cypress against Apache server running in a Docker container

Notifications You must be signed in to change notification settings

bahmutov/cypress-tests-apache-in-docker

Repository files navigation

cypress-tests-apache-in-docker

Example running Cypress against Apache server running in a Docker container

Install

Install NPM dependencies (mostly Cypress really)

npm install

Build an image

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.

Run image

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.

Test it using Cypress

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.

Cypress test

Shut down 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>

See also

About

Example running Cypress against Apache server running in a Docker container

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published