Working With Travis CI
Configuring the Applitools CI/CD Integration
-
In the travis.yml file, add the following line to the script section that runs before an Eyes test runs:
script:
- export APPLITOOLS_BATCH_ID=$(echo ${TRAVIS_PULL_REQUEST_SHA:=$TRAVIS_COMMIT}) -
On your project page, click on More options and then select Settings.
-
In the Environment Variables section, enter the following:
- In the Name field enter
APPLITOOLS_API_KEY. - In the Value field enter the value of your API key. To obtain the value of your API key, see How to obtain your API key.
- In the Name field enter
-
Click Add.
Enabling Applitools logs in Travis CI
To capture Applitools SDK logs during Travis builds, enable the log variables and preserve the logs/ directory after the test run:
env:
global:
- APPLITOOLS_SHOW_LOGS=true
- APPLITOOLS_LOG_DIR=logs
Then upload or archive the logs/ folder so it remains available after the build completes. For example, use your Travis artifact upload workflow or create an archive in after_script.
If your Travis CI job runs inside Docker, setting APPLITOOLS_SHOW_LOGS and APPLITOOLS_LOG_DIR is not enough. The log files are written inside the container and can be lost when the container exits unless the log directory is mounted to the workspace.
Example Docker command:
docker run \
-e APPLITOOLS_SHOW_LOGS=true \
-e APPLITOOLS_LOG_DIR=/usr/src/app/logs \
-v ${WORKSPACE}/applitools-logs:/usr/src/app/logs \
your-image-name
Adjust ${WORKSPACE} to the workspace path used by your Travis runner.