This is an example project testing a few different sites
It showcases the use of:-
cy.foo()cd e2e && npm install to install cypress in the e2e folderMakefile for available commandsmake docker-build in the projectMakefile for available docker commandsThe main cypress configuration file, is in the e2e folder
cypress.jsonIt can contain configuration options applicable to all environments
Environment specific config files are stored in e2e/config/<environment.json>
These will override any configurations specific environment vars set in cypress.json
these can be set on the command line by
--env configFile=<environment.json>Currently supported environments are
If no option is provided is will default to the baseUrl defined in e2e/config.json
In order to setup development, you will need a website locally running and your URI_ROOT should be set.
export URI_ROOT=<your_root_url>
If you are using docker then please set your URI_ROOT in your docker-compose file, it is set in this example
environment:
- URI_ROOT=http://the-internet.herokuapp.com
If it's URI_ROOT is not, and you select --env configFile=development the application will error, and ask you to set it.
make docker-build - Build the imagemake docker-test-local - Run the testsmake docker-bash - Access the bash shell in the containerFor more, see the Makefile
make test-localmake test-qamake test-stagingmake test-productionnpm run cypress:open - runs test via guinpm run cypress:run - run tests via command line--env configFile=<env> - select an environment specific config-s '<pathToFile>' path for the spec files you wish to run
-s 'cypress/integration/commands.spec.js' examplemake test-local-gui Opens the GUI with the development configuration selectionmake test-qa-gui Opens the GUI with the qa configuration selectionThe GUI can be opened by npx cypress open but requires a --env configFile=<env> option in order to set the correct BaseURL
e2e/cypress/videose2e/cypress/screenshotse2e/cypress/reportse2e/cypress/reports and combine them into a single HTML document with a random uuid title in e2e/mochareportsmake combine-reports && make generate-reportcombine-reports:
npx mochawesome-merge --reportDir cypress/reports/mocha > mochareports/report-$$(date +'%Y%m%d-%H%M%S').json
generate-report:
npx marge mochareports/*.json -f report-$$(date +'%Y%m%d-%H%M%S') -o mochareports
make publish-reports-s3 export BUCKET_NAME=<YOUR_BUCKET_NAME>
export AWS_ACCESS_ID=<YOUR_AWS_ACCESS_ID>
export AWS_SECRET_KEY=<YOUR_AWS_SECRET_KEY>
example.spec.ts and contained in e2e/cypress/integrationtsconfig.json file in the e2e folder
.ts files. If you add other paths for yours, include them here.tslint.json file in the e2e folder
e2e/webpack.config.jse2e/cypress/plugins/index.js, hooking into cypress's on event.This project is building in CircleCI and can be viewed at the following link
https://circleci.com/gh/YOU54F/cypressio-docker-typescript
See the .circleci folder
config.yml - Contains the CircleCI build configurationA JS file has been written in order to publish results
e2e/scripts/slack/slack-alert.jsIt provides the following distinct message types
It provides the following information
And the following build/test artefacts
You will need to set up a couple of things in order to use this.
First build a Slack app & create an incoming webhook
Set the following environment variables in your localhost or CI configuration
$SLACK_WEBHOOK_URL - The full URL you created in the last step$SLACK_API_CHANNEL - The channel ref you wish to publish to (right-click on your channel and click copy link, check the link, its the digits after the last / )CircleCI builds pass in a CYPRESS_RECORD_KEY in order to publish the results to the Cypress Dashboard.
We run make test-record to set the --record flag and publish the results to the dashboard.
Content type
Image
Digest
Size
353.6 MB
Last updated
over 7 years ago
docker pull you54f/cypressbasechrome