Configure Tugboat to Run Cypress Tests on Testery
Using Tugboat and Testery is one of the coolest, easiest, and fastest ways to run your E2E Cypress tests on every PR. Follow these four steps and in about 10 minutes, you'll have Cypress tests running in parallel and showing up on the PRs for your Tugboat previews.
Step 1. Update the init section for your service in .tugboat/config.yml
to install Python3 (if not already present).
services:
your-service-name:
commands:
init:
apt-get install -y python3
apt-get install -y python3-pip
Step 2. Update the build section for your service in .tugboat/config.yml to run the tests.
services:
your-service-name:
build: |
# Install the Testery CLI
pip3 install testery --upgrade
# Register the preview environment with Testery.
testery update-environment --create-if-not-exists --token "$TESTERY_TOKEN" --key "${TUGBOAT_PREVIEW}" --name "${TUGBOAT_PREVIEW}" --variable "TUGBOAT_DEFAULT_SERVICE_URL=${TUGBOAT_DEFAULT_SERVICE_URL}"
# Start a test run.
testery create-test-run --token "$TESTERY_TOKEN" --git-ref "$TUGBOAT_PREVIEW_SHA" --project "testery" --environment "${TUGBOAT_PREVIEW}"
Step 3. Create a free Testery account and get your Testery token.
Click here to sign up for a free account. Be sure to select Cypress as your test runner.
Get your Testery token by clicking on Settings
-> Integrations
-> Show API Token
.
Copy the token that is displayed.
Step 4. Save your Testery token in the Tugboat project settings.
In Tugboat, go to your Repository Settings and add your Testery token as an Environment Variable. Be sure to use the same Environment Variable name that was used in Step 2 (we called it TESTERY_TOKEN
).
Step 5. You're All Set!
You should now be able to run your Cypress tests on every PR. If you have any questions or need further assistance, please contact support@testery.io.
You'll now see test results directly on the pull request.
Clicking Details
will show you the results.