- Ensure that you are using the latest version of Node 10 as playwright requires it:
nvm use 10
- Install playwright:
yarn add -D playwright
- Stability over speed in testing
- QaWolf & Playwright had flaky issues
- Stability in Cypress test runner over Playwright
You cannot. You need to pass in --record and login to Cypress Dashboard to do this. This is as good as paid feature.
- Base64 encode the .env file by doing
base64 .env
- Grep the value and paste it as the value in bitbucket pipeline repository variables. Set the key to
APP_ENV_VARS
- In pipeline, do this
echo $APP_ENV_VARS | base64 --decode > .env
to get the .env created
References:
- https://stackoverflow.com/questions/51819335/is-there-any-way-to-use-dotenv-with-bitbucket-pipelines
- https://support.circleci.com/hc/en-us/articles/360003540393-How-to-insert-files-as-environment-variables-with-Base64
There are two levels of parallelisation in the CI pipeline. One on the Bitbucket Pipeline layer (https://bitbucket.org/blog/speed-build-parallel-steps-pipelines) and another on the Cypress layer.
In the pipeline, the node_modules folder is cached. Even as new packages are installed, the node cache will not be updated as this is an open issue on Bitbucket. By default, Bitbucket's cache invalidation will only take place weekly. To force the cache to update, manually delete the node
cache from the pipeline in the Bitbucket repo. Re-run the pipeline to receive the latest node_modules.
yarn add -D cypress cypress-localstorage-commands dotenv-to-json
- Copy from ens-api > cypress
- Copy scripts from ens-api > package.json
- Edit test files and run
yarn test
locally. Don't forget to run a local server at port 3000.
To setup Bitbucket CI,
- Copy
bitbucket-pipelines.yml
from ENS, place in root. - Setup
- Add pipeline env vars to (https://bitbucket.org/1xt/MY_PROJECT/admin/addon/admin/pipelines/repository-variables). For the pipeline to work, the following specific env vars must be added:
NPM_TOKEN
,CYPRESS_RECORD_KEY
andAPP_ENV_VARS
. To getAPP_ENV_VARS
, you need to get a base64 string off your current .env file. Do that by runningbase64 .env
. - Migrate the code from this PR: https://bitbucket.org/1xt/ens-api/pull-requests/3 and ensure that it is in your project.
- Make sure to do the yarn installs.
- Push to repo and make pull request to see E2E running in Bitbucket Pipeline.
yarn cy:open
yarn test
yarn test --spec cypress/integration/examples/cypress_api.spec.js
Add [skip ci]
to the commit message
You can increase the timeout of the action. The default timeout in Cypress is 4000ms. You could do 10,000ms to wait for these network requests to complete. For example: cy.get('[data-cy=page-title]', { timeout: 10000 }).contains('Users')