Files
cypress/circle.yml
T
Zach Bloomquist 6960f7cd78 Rewrite JS/HTML using AST-based approach (#5273)
* Add winPropAccessor to security.js, remove other replacers

* Add start of Cypress.resolveWindowReference

* Add regexes for dot and bracket access

* Some security_spec tests pass with new injection

* Add resolveWindowReference unit tests

* Old security_spec now passes with resolveWindowReference

* Inject stub resolveWindowReference so proxy still works outside of Cypress

* wip: rewrite HTML + JS with tokenizer

* Move to using esprima + hyntax to rewrite JS + HTML

* remove comment; oneLine makes the whole thing commented

* Fix tests, apple.com edge case

* wip: add getOrSet

* Revert "wip: add getOrSet"

This reverts commit a5c647c00f.

* release 3.5.0 [skip ci]

* use recast to replace window property accesses

* replace assignments to top properly

* fix yarn.lock

* bump deps

* update integration tests

* remove old security ts?

* fix integration spec

* always ignore js interception failure

* use globalThis instead of window

* add experimentalSourceRewriting flag

* restore regex-writer spec

* fix types

* update config_spec

* add source rewriting spec

* cleanup

* simplify rewriting logic, move rules into rewriter package

* create threaded rewriting tool for non-streaming use

* update @packages/rewriter to use threads for async

* use async rewriting where convenient

* add worker-shim.js

* add performance info to debug logs

* properly handle +=, -=, ...

* add proxy, rewriter to unit-tests stage

* cleanup

* use parse5 to rewrite HTML, strip SRI

* update tests

* reorganization, cleanup

* rewrite ALL parent, top identifiers except in a few cases

* handle many JS edge cases

* ensure parse5@5.1.1 is installed

* update yarn.lock

* update tests

* add debugging, add tests

* add attempted repro for .href issue

* implement source maps + extending inline source maps

* update opts passing in proxy layer

* fix sourcemap naming structure

* update tests to account for sourcemaps

* sourcemap tests

* remote source maps work

* comment

* update rewriter tests

* clean up TODOs in resolveWindowReference

* remove @types/nock

* clean up todos in deferred-source-map-cache

* fix rewriter build script

* fix concatStream import

* bump expectedresultcount

* clean up js-rules

* threading improvements, workaround for Electron segfault

* no visit_spec for now

* fix 6_visit_spec

* update MAX_WORKER_THREADS

* add repro for #3975

* cleanup

* cleanup

* make better use of namedTypes and builders

* get rid of the horrific closureDetectionTernary

ast-types keeps track of scope, so it is unneeded

* fix #3975, #3994

* add x-sourcemap, sourcemap header support

* snap-shot-it 7.9.3

* add deferred-source-map-cache-spec

* add tests

* Throw error in driver if AST rewriting fails

* Fix "location = 'relative-url'"

* fix max recursion depth

* slim down some fixtures

* fix window.location usage

* don't mess with `frames` at all

* no integration tests

* skip testing apple.com for now

* update wording: regex-based vs. ast-based

* skip real-world tests for now

* add some padding to process.exit workaround

* fix resolvers_spec

* fix html-spec

* cleanup

* Update packages/rewriter/lib/js-rules.ts

* Update packages/driver/src/cypress/resolvers.ts

* just import find by itself

* privatize typedefs for Cypress.state, remove .gitignore, remove dead code

Co-authored-by: Ben Kucera <14625260+Bkucera@users.noreply.github.com>
2020-05-11 12:54:14 -04:00

1508 lines
41 KiB
YAML

version: 2.1
# usually we don't build Mac app - it takes a long time
# but sometimes we want to really confirm we are doing the right thing
# so just add your branch to the list here to build and test on Mac
macBuildFilters: &macBuildFilters
filters:
branches:
only:
- develop
- investigate-spec-on-mac
defaults: &defaults
parallelism: 1
working_directory: ~/cypress
parameters:
executor:
type: executor
default: cy-doc
executor: <<parameters.executor>>
environment:
## set specific timezone
TZ: "/usr/share/zoneinfo/America/New_York"
## store artifacts here
CIRCLE_ARTIFACTS: /tmp/artifacts
## set so that e2e tests are consistent
COLUMNS: 100
LINES: 24
# filters and requires for testing binary with Firefox
testBinaryFirefox: &testBinaryFirefox
filters:
branches:
only:
- develop
requires:
- build-npm-package
- build-binary
executors:
# the Docker image with Cypress dependencies and Chrome browser
cy-doc:
docker:
- image: cypress/browsers:node12.13.0-chrome80-ff74
environment:
PLATFORM: linux
# Docker image with non-root "node" user
non-root-docker-user:
docker:
- image: cypress/base:12.0.0
user: node
environment:
PLATFORM: linux
# executor to run on Mac OS
# https://circleci.com/docs/2.0/executor-types/#using-macos
# https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions
mac:
macos:
## Node 12.10.0 (yarn 1.17.3)
xcode: "11.0.0"
environment:
PLATFORM: mac
commands:
install-latest-chrome:
description: Install latest Google Chrome (stable)
parameters:
browser:
default: "electron"
description: browser shortname to target
type: string
steps:
- run:
name: Install latest Google Chrome (stable)
command: |
if [ << parameters.browser >> == "chrome" ]; then
echo "**** Running Chrome tests. Installing latest stable version of Google Chrome. ****"
apt-get update
apt-get install google-chrome-stable -y
echo "**** Location of Google Chrome Installation: "`which google-chrome`" ****"
echo "**** Google Chrome Version: "`google-chrome --version`" ****"
else
echo "**** Not updating Chrome. Running tests in '<< parameters.browser >>' ****"
fi
run-driver-integration-tests:
parameters:
browser:
description: browser shortname to target
type: string
steps:
- attach_workspace:
at: ~/
- run:
command: yarn start
background: true
working_directory: packages/driver
- run:
command: yarn wait-on http://localhost:3500
- run:
command: |
CYPRESS_KONFIG_ENV=production \
CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \
yarn cypress:run --record --parallel --group 5x-driver-<< parameters.browser >> --browser << parameters.browser >>
working_directory: packages/driver
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
- store_artifacts:
path: /tmp/artifacts
- store-npm-logs
run-e2e-tests:
parameters:
browser:
default: "electron"
description: browser shortname to target
type: string
chunk:
description: e2e test chunk number
type: integer
steps:
- attach_workspace:
at: ~/
- run:
command: yarn lerna exec --scope @packages/server "yarn test ./test/e2e/<< parameters.chunk >>*spec* --browser << parameters.browser >>"
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
- store-npm-logs
store-npm-logs:
description: Saves any NPM debug logs as artifacts in case there is a problem
steps:
- store_artifacts:
path: ~/.npm/_logs
post-install-comment:
description: Post GitHub comment with a blurb on how to install pre-release version
steps:
- run: ls -la
# make sure JSON files with uploaded urls are present
- run: ls -la binary-url.json npm-package-url.json
- run: cat binary-url.json
- run: cat npm-package-url.json
- run:
name: Post pre-release install comment
command: |
node scripts/add-install-comment.js \
--npm npm-package-url.json \
--binary binary-url.json
verify-mocha-results:
description: Double-check that Mocha tests ran as expected.
parameters:
expectedResultCount:
description: The number of result files to expect, ie, the number of Mocha test suites that ran.
type: integer
## by default, assert that at least 1 test ran
default: 0
steps:
- run: yarn verify:mocha:results << parameters.expectedResultCount >>
test-binary-against-repo:
description: |
Takes the built binary and NPM package, clones given example repo
and runs the new version of Cypress against it.
parameters:
repo:
description: Name of the repo like "cypress-example-kitchensink"
type: string
browser:
description: Name of the browser to use
type: enum
enum: ["electron", "chrome", "firefox"]
default: "electron"
command:
description: Test command to run to start Cypress tests
type: string
default: "npm run e2e"
wait-on:
description: Url to wait-on before starting tests
type: string
default: ""
steps:
- attach_workspace:
at: ~/
# make sure the binary and NPM package files are present
- run: ls -l
- run: ls -l cypress.zip cypress.tgz
- run:
name: Cloning project <<parameters.repo>>
command: git clone --depth 1 https://github.com/cypress-io/<<parameters.repo>>.git /tmp/<<parameters.repo>>
- run:
command: npm install
working_directory: /tmp/<<parameters.repo>>
- run:
name: Install Cypress
working_directory: /tmp/<<parameters.repo>>
# force installing the freshly built binary
command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i ~/cypress/cypress.tgz
- run:
working_directory: /tmp/<<parameters.repo>>
command: npm run build --if-present
- run:
working_directory: /tmp/<<parameters.repo>>
command: npm start --if-present
background: true
- when:
condition: <<parameters.wait-on>>
steps:
- run:
name: Wait-on <<parameters.wait-on>>
command: npx wait-on <<parameters.wait-on>> --timeout 120000
- run:
working_directory: /tmp/<<parameters.repo>>
command: <<parameters.command>> -- --browser <<parameters.browser>>
- store-npm-logs
- store_artifacts:
name: screenshots
path: /tmp/<<parameters.repo>>/cypress/screenshots
- store_artifacts:
name: videos
path: /tmp/<<parameters.repo>>/cypress/videos
jobs:
## code checkout and yarn installs
build:
<<: *defaults
steps:
- checkout
- run:
name: Print working folder
command: echo $PWD
- run:
name: print global yarn cache path
command: echo $(yarn global bin)
- run:
name: print Node version
command: node -v
- run:
name: print yarn version
command: yarn -v
- run: yarn check-node-version
## make sure the TERM is set to 'xterm' in node (Linux only)
## else colors (and tests) will fail
## See the following information
## * http://andykdocs.de/development/Docker/Fixing+the+Docker+TERM+variable+issue
## * https://unix.stackexchange.com/questions/43945/whats-the-difference-between-various-term-variables
- run: yarn check-terminal
- run: yarn stop-only-all
- restore_cache:
name: Restore yarn cache
key: v{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ .Branch }}-deps-root-{{ checksum "yarn.lock" }}
# show what is already cached globally
- run: ls $(yarn global bin)
- run: ls $(yarn global bin)/../lib/node_modules
# try several times, because flaky NPM installs ...
- run: yarn --frozen-lockfile || yarn --frozen-lockfile
- run:
name: Top level packages
command: yarn list --depth=0 || true
- store-npm-logs
## save entire folder as artifact for other jobs to run without reinstalling
- persist_to_workspace:
root: ~/
paths:
- cypress
lint:
<<: *defaults
steps:
- attach_workspace:
at: ~/
## this will catch .only's in js/coffee as well
- run: yarn lint-all
- run:
name: cypress info (dev)
command: node cli/bin/cypress info --dev
- store-npm-logs
cli-visual-tests:
<<: *defaults
parallelism: 1
steps:
- attach_workspace:
at: ~/
- run: mkdir -p cli/visual-snapshots
- run:
command: node cli/bin/cypress info --dev | yarn --silent term-to-html | node scripts/sanitize --type cli-info > cli/visual-snapshots/cypress-info.html
environment:
FORCE_COLOR: 2
- run:
command: node cli/bin/cypress help | yarn --silent term-to-html > cli/visual-snapshots/cypress-help.html
environment:
FORCE_COLOR: 2
- store_artifacts:
path: cli/visual-snapshots
- run:
name: Upload CLI snapshots for diffing
command: |
PERCY_TOKEN=$PERCY_TOKEN_CLI \
yarn percy snapshot ./cli/visual-snapshots
unit-tests:
<<: *defaults
parallelism: 1
steps:
- attach_workspace:
at: ~/
# make sure mocha runs
- run: yarn test-mocha
# test binary build code
- run: yarn test-scripts
# make sure our snapshots are compared correctly
- run: yarn test-mocha-snapshot
# make sure packages with TypeScript can be transpiled to JS
- run: yarn lerna run build-prod --stream
# run unit tests from each individual package
- run: yarn test
- verify-mocha-results:
expectedResultCount: 8
- store_test_results:
path: /tmp/cypress
# CLI tests generate HTML files with sample CLI command output
- store_artifacts:
path: cli/test/html
- store-npm-logs
lint-types:
<<: *defaults
parallelism: 1
steps:
- attach_workspace:
at: ~/
- run:
command: ls -la types
working_directory: cli
- run:
command: yarn lerna exec --scope cypress "yarn dtslint"
- run:
command: yarn type-check --ignore-progress
- store-npm-logs
build-system-unit-tests:
<<: *defaults
parallelism: 1
steps:
- attach_workspace:
at: ~/
# make sure mocha runs
- run: yarn test-mocha
# test binary build code
- run: yarn test-scripts
"server-unit-tests":
<<: *defaults
parallelism: 2
steps:
- attach_workspace:
at: ~/
- run: yarn test-unit --scope @packages/server
- verify-mocha-results:
expectedResultCount: 1
- store_test_results:
path: /tmp/cypress
- store-npm-logs
"server-integration-tests":
<<: *defaults
parallelism: 2
steps:
- attach_workspace:
at: ~/
- run: yarn test-integration --scope @packages/server
- verify-mocha-results:
expectedResultCount: 1
- store_test_results:
path: /tmp/cypress
- store-npm-logs
"server-performance-tests":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: yarn lerna exec --scope @packages/server "yarn test-performance"
- verify-mocha-results:
expectedResultCount: 1
- store_test_results:
path: /tmp/cypress
- store_artifacts:
path: /tmp/artifacts
- store-npm-logs
"server-e2e-tests-chrome-1":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 1
"server-e2e-tests-chrome-2":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 2
"server-e2e-tests-chrome-3":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 3
"server-e2e-tests-chrome-4":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 4
"server-e2e-tests-chrome-5":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 5
"server-e2e-tests-chrome-6":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 6
"server-e2e-tests-chrome-7":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 7
"server-e2e-tests-chrome-8":
<<: *defaults
steps:
- run-e2e-tests:
browser: chrome
chunk: 8
"server-e2e-tests-electron-1":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 1
"server-e2e-tests-electron-2":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 2
"server-e2e-tests-electron-3":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 3
"server-e2e-tests-electron-4":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 4
"server-e2e-tests-electron-5":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 5
"server-e2e-tests-electron-6":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 6
"server-e2e-tests-electron-7":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 7
"server-e2e-tests-electron-8":
<<: *defaults
steps:
- run-e2e-tests:
browser: electron
chunk: 8
"server-e2e-tests-firefox-1":
<<: *defaults
steps:
- run-e2e-tests:
browser: firefox
chunk: 1
"server-e2e-tests-firefox-2":
<<: *defaults
steps:
- run-e2e-tests:
browser: firefox
chunk: 2
"server-e2e-tests-firefox-3":
<<: *defaults
steps:
- run-e2e-tests:
browser: firefox
chunk: 3
"server-e2e-tests-firefox-4":
<<: *defaults
steps:
- run-e2e-tests:
browser: firefox
chunk: 4
"server-e2e-tests-firefox-5":
<<: *defaults
steps:
- run-e2e-tests:
browser: firefox
chunk: 5
"server-e2e-tests-firefox-6":
<<: *defaults
steps:
- run-e2e-tests:
browser: firefox
chunk: 6
"server-e2e-tests-firefox-7":
<<: *defaults
steps:
- run-e2e-tests:
browser: firefox
chunk: 7
"server-e2e-tests-firefox-8":
<<: *defaults
steps:
- run-e2e-tests:
browser: firefox
chunk: 8
"driver-integration-tests-chrome":
<<: *defaults
parallelism: 5
steps:
- run-driver-integration-tests:
browser: chrome
# "driver-integration-tests-electron":
# <<: *defaults
# parallelism: 5
# steps:
# - run-driver-integration-tests:
# browser: electron
"driver-integration-tests-firefox":
<<: *defaults
parallelism: 5
steps:
- run-driver-integration-tests:
browser: firefox
"desktop-gui-integration-tests-2x":
<<: *defaults
parallelism: 2
steps:
- attach_workspace:
at: ~/
- run:
command: yarn build-prod
working_directory: packages/desktop-gui
- run:
name: Desktop GUI server
command: yarn start
working_directory: packages/desktop-gui
background: true
- run:
command: |
CYPRESS_KONFIG_ENV=production \
CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \
yarn cypress:run --record --parallel --group 2x-desktop-gui
working_directory: packages/desktop-gui
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
- store_artifacts:
path: /tmp/artifacts
- store-npm-logs
desktop-gui-visual-tests:
<<: *defaults
parallelism: 1
steps:
- attach_workspace:
at: ~/
- run:
command: yarn build-prod
working_directory: packages/desktop-gui
- run:
name: Desktop GUI server
command: yarn start
working_directory: packages/desktop-gui
background: true
- run:
# will use PERCY_TOKEN environment variable if available
command: |
CYPRESS_KONFIG_ENV=production \
yarn percy exec -- yarn cypress:run --spec cypress/integration/settings_spec.js,cypress/integration/specs_list_spec.js
working_directory: packages/desktop-gui
- verify-mocha-results
# we don't really need any artifacts - we are only interested in visual screenshots
- store-npm-logs
"reporter-integration-tests":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: yarn build-for-tests
working_directory: packages/reporter
- run:
command: |
CYPRESS_KONFIG_ENV=production \
CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \
yarn cypress:run --record --parallel --group reporter
working_directory: packages/reporter
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
- store_artifacts:
path: /tmp/artifacts
- store-npm-logs
"ui-components-integration-tests":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: yarn build-for-tests
working_directory: packages/ui-components
- run:
command: |
CYPRESS_KONFIG_ENV=production \
CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \
yarn cypress:run --record --parallel --group ui-components
working_directory: packages/ui-components
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
- store_artifacts:
path: /tmp/artifacts
- store-npm-logs
"run-launcher":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
command: node index.js
working_directory: packages/launcher
build-binary:
<<: *defaults
shell: /bin/bash --login
steps:
- run:
name: Check environment variables before code sign (if on Mac)
# NOTE
# our Mac code sign works via electron-builder
# by default, electron-builder will NOT sign app built in a pull request
# even our internal one (!)
# Usually this is not a problem, since we only build and test binary
# built on "develop" and "master" branches
# but if you need to really build and sign a Mac binary in a PR
# set variable CSC_FOR_PULL_REQUEST=true
command: |
set -e
if [[ "$OSTYPE" == "darwin"* ]]; then
if [ -z "$CSC_LINK" ]; then
echo "Need to provide environment variable CSC_LINK"
echo "with base64 encoded certificate .p12 file"
exit 1
fi
if [ -z "$CSC_KEY_PASSWORD" ]; then
echo "Need to provide environment variable CSC_KEY_PASSWORD"
echo "with password for unlocking certificate .p12 file"
exit 1
fi
else
echo "Not Mac platform, skipping code sign setup"
fi
- attach_workspace:
at: ~/
- run: $(yarn bin)/print-arch
- run:
environment:
DEBUG: electron-builder,electron-osx-sign*
# notarization on Mac can take a while
no_output_timeout: "30m"
# if this is a forked pull request, the NEXT_DEV_VERSION environment variable
# won't be set and we will use default version, since we are not going to
# upload the dev binary build anywhere
command: yarn binary-build --platform $PLATFORM --version ${NEXT_DEV_VERSION:-0.0.0-development}
- run: yarn binary-zip --platform $PLATFORM
# Cypress binary file should be zipped to cypress.zip
- run: ls -l *.zip
- store-npm-logs
- persist_to_workspace:
root: ~/
paths:
- cypress/cypress.zip
upload-binary:
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run: ls -l
- run:
name: upload unique binary
command: |
node scripts/binary.js upload-unique-binary \
--file cypress.zip \
--version $NEXT_DEV_VERSION
- run: cat binary-url.json
- store-npm-logs
- persist_to_workspace:
root: ~/
paths:
- cypress/binary-url.json
test-kitchensink:
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
name: Cloning test project
command: git clone https://github.com/cypress-io/cypress-example-kitchensink.git /tmp/repo
- run:
name: Install prod dependencies
command: yarn --production
working_directory: /tmp/repo
- run:
name: Example server
command: yarn start
working_directory: /tmp/repo
background: true
- run:
name: Run Kitchensink example project
command: yarn cypress:run --project /tmp/repo
- store_artifacts:
path: /tmp/repo/cypress/screenshots
- store_artifacts:
path: /tmp/repo/cypress/videos
- store-npm-logs
"test-kitchensink-against-staging":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
name: Cloning test project
command: git clone https://github.com/cypress-io/cypress-example-kitchensink.git /tmp/repo
- run:
name: Install prod dependencies
command: yarn --production
working_directory: /tmp/repo
- run:
name: Example server
command: yarn start
working_directory: /tmp/repo
background: true
- run:
name: Run Kitchensink example project
command: |
CYPRESS_PROJECT_ID=$TEST_KITCHENSINK_PROJECT_ID \
CYPRESS_RECORD_KEY=$TEST_KITCHENSINK_RECORD_KEY \
CYPRESS_INTERNAL_ENV=staging \
CYPRESS_video=false \
yarn cypress:run --project /tmp/repo --record
- store-npm-logs
"test-against-staging":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run:
name: Cloning test project
command: git clone https://github.com/cypress-io/cypress-test-tiny.git /tmp/repo
- run:
name: Run test project
command: |
CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \
CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \
CYPRESS_INTERNAL_ENV=staging \
yarn cypress:run --project /tmp/repo --record
- store-npm-logs
build-npm-package:
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run: yarn check-next-dev-version
- run:
name: bump NPM version
command: yarn version --no-git-tag-version --new-version ${NEXT_DEV_VERSION:-0.0.0-development}
- run:
name: build NPM package
command: yarn build --scope cypress
- run:
command: ls -la types
working_directory: cli/build
- run:
name: list NPM package contents
command: yarn lerna run --scope cypress size
- run:
name: pack NPM package
working_directory: cli/build
command: yarn pack
- run:
name: list created NPM package
working_directory: cli/build
command: ls -l
# created file should have filename cypress-<version>.tgz
- run: mkdir /tmp/urls
- run: cp cli/build/cypress-v${NEXT_DEV_VERSION:-0.0.0-development}.tgz cypress.tgz
- run: cp cli/build/cypress-v${NEXT_DEV_VERSION:-0.0.0-development}.tgz /tmp/urls/cypress.tgz
- run: ls -l /tmp/urls
- store-npm-logs
- run: pwd
- run: ls -l
- persist_to_workspace:
root: ~/
paths:
- cypress/cypress.tgz
upload-npm-package:
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run: ls -l
# NPM package file should have filename cypress-<version>.tgz
- run:
name: upload NPM package
command: |
node scripts/binary.js upload-npm-package \
--file cypress.tgz \
--version $NEXT_DEV_VERSION
- store-npm-logs
- run: ls -l
- run: cat npm-package-url.json
- persist_to_workspace:
root: ~/
paths:
- cypress/npm-package-url.json
"test-binary-and-npm-against-other-projects":
<<: *defaults
steps:
# needs uploaded NPM and test binary
- attach_workspace:
at: ~/
- run: ls -la
# make sure JSON files with uploaded urls are present
- run: ls -la binary-url.json npm-package-url.json
- run: cat binary-url.json
- run: cat npm-package-url.json
- run: mkdir /tmp/testing
- run:
name: create dummy package
working_directory: /tmp/testing
command: npm init -y
- run:
# install NPM from unique urls
name: Install Cypress
command: |
node scripts/test-unique-npm-and-binary.js \
--npm npm-package-url.json \
--binary binary-url.json \
--cwd /tmp/testing
- run:
name: Verify Cypress binary
working_directory: /tmp/testing
command: $(yarn bin)/cypress verify
- run:
name: Running other test projects with new NPM package and binary
command: |
node scripts/test-other-projects.js \
--npm npm-package-url.json \
--binary binary-url.json \
--provider circle
- store-npm-logs
post-pre-release-install-comment:
<<: *defaults
steps:
# needs uploaded NPM and test binary
- attach_workspace:
at: ~/
- run: ls -la
- post-install-comment
"test-npm-module-and-verify-binary":
<<: *defaults
steps:
- attach_workspace:
at: ~/
# make sure we have cypress.zip received
- run: ls -l
- run: ls -l cypress.zip cypress.tgz
- run: mkdir test-binary
- run:
name: Create new NPM package
working_directory: test-binary
command: npm init -y
- run:
# install NPM from built NPM package folder
name: Install Cypress
working_directory: test-binary
# force installing the freshly built binary
command: CYPRESS_INSTALL_BINARY=/root/cypress/cypress.zip npm i /root/cypress/cypress.tgz
- run:
name: Verify Cypress binary
working_directory: test-binary
command: $(yarn bin)/cypress verify
- run:
name: Cypress help
working_directory: test-binary
command: $(yarn bin)/cypress help
- run:
name: Cypress info
working_directory: test-binary
command: $(yarn bin)/cypress info
- store-npm-logs
test-npm-module-on-minimum-node-version:
<<: *defaults
docker:
- image: cypress/base:8.0.0
steps:
- attach_workspace:
at: ~/
# make sure we have cypress.zip received
- run: ls -l
- run: ls -l cypress.zip cypress.tgz
- run: mkdir test-binary
- run: node --version
- run: npm --version
- run:
name: Create new NPM package
working_directory: test-binary
command: npm init -y
- run:
name: Install Cypress
working_directory: test-binary
command: CYPRESS_INSTALL_BINARY=/root/cypress/cypress.zip npm install /root/cypress/cypress.tgz
- run:
name: Verify Cypress binary
working_directory: test-binary
command: $(npm bin)/cypress verify
- run:
name: Print Cypress version
working_directory: test-binary
command: $(npm bin)/cypress version
- run:
name: Cypress info
working_directory: test-binary
command: $(npm bin)/cypress info
# install NPM + binary zip and run against staging API
"test-binary-against-staging":
<<: *defaults
steps:
- attach_workspace:
at: ~/
- run: ls -l
# make sure we have the binary and NPM package
- run: ls -l cypress.zip cypress.tgz
- run:
name: Cloning test project
command: git clone https://github.com/cypress-io/cypress-test-tiny.git /tmp/cypress-test-tiny
- run:
name: Install Cypress
working_directory: /tmp/cypress-test-tiny
# force installing the freshly built binary
command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i ~/cypress/cypress.tgz
- run:
name: Run test project
working_directory: /tmp/cypress-test-tiny
command: |
CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \
CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \
CYPRESS_INTERNAL_ENV=staging \
$(yarn bin)/cypress run --record
- store-npm-logs
"test-binary-against-recipes-firefox":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-example-recipes
command: npm run test:ci:firefox
"test-binary-against-kitchensink":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-example-kitchensink
"test-binary-against-kitchensink-firefox":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-example-kitchensink
browser: firefox
"test-binary-against-kitchensink-chrome":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-example-kitchensink
browser: chrome
"test-binary-against-todomvc-firefox":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-example-todomvc
browser: firefox
"test-binary-against-documentation-firefox":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-documentation
browser: firefox
command: "npm run cypress:run"
wait-on: "http://localhost:2222"
"test-binary-against-realworld-firefox":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-example-realworld
browser: firefox
command: "npm run cypress:run"
wait-on: "http://localhost:4100"
"test-binary-against-api-testing-firefox":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-example-api-testing
browser: firefox
command: "npm run cy:run"
wait-on: "http://localhost:3000"
"test-binary-against-piechopper-firefox":
<<: *defaults
steps:
- test-binary-against-repo:
repo: cypress-example-piechopper
browser: firefox
command: "npm run cypress:run"
wait-on: "http://localhost:8080"
test-binary-as-specific-user:
<<: *defaults
steps:
- attach_workspace:
at: ~/
# the user should be "node"
- run: whoami
- run: pwd
# prints the current user's effective user id
# for root it is 0
# for other users it is a positive integer
- run: node -e 'console.log(process.geteuid())'
# make sure the binary and NPM package files are present
- run: ls -l
- run: ls -l cypress.zip cypress.tgz
- run: mkdir test-binary
- run:
name: Create new NPM package
working_directory: test-binary
command: npm init -y
- run:
# install NPM from built NPM package folder
name: Install Cypress
working_directory: test-binary
# force installing the freshly built binary
command: CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i ~/cypress/cypress.tgz
- run:
name: Cypress help
working_directory: test-binary
command: $(yarn bin)/cypress help
- run:
name: Cypress info
working_directory: test-binary
command: $(yarn bin)/cypress info
- run:
name: Add Cypress demo
working_directory: test-binary
command: npx @bahmutov/cly init
- run:
name: Verify Cypress binary
working_directory: test-binary
command: DEBUG=cypress:cli $(yarn bin)/cypress verify
- run:
name: Run Cypress binary
working_directory: test-binary
command: DEBUG=cypress:cli $(yarn bin)/cypress run
- store-npm-logs
linux-workflow: &linux-workflow
jobs:
- build
- lint:
name: Linux lint
requires:
- build
- lint-types:
requires:
- build
# unit, integration and e2e tests
- cli-visual-tests:
requires:
- build
- build-system-unit-tests:
requires:
- build
- unit-tests:
requires:
- build
- server-unit-tests:
requires:
- build
- server-integration-tests:
requires:
- build
- server-performance-tests:
requires:
- build
- server-e2e-tests-chrome-1:
requires:
- build
- server-e2e-tests-chrome-2:
requires:
- build
- server-e2e-tests-chrome-3:
requires:
- build
- server-e2e-tests-chrome-4:
requires:
- build
- server-e2e-tests-chrome-5:
requires:
- build
- server-e2e-tests-chrome-6:
requires:
- build
- server-e2e-tests-chrome-7:
requires:
- build
- server-e2e-tests-chrome-8:
requires:
- build
- server-e2e-tests-electron-1:
requires:
- build
- server-e2e-tests-electron-2:
requires:
- build
- server-e2e-tests-electron-3:
requires:
- build
- server-e2e-tests-electron-4:
requires:
- build
- server-e2e-tests-electron-5:
requires:
- build
- server-e2e-tests-electron-6:
requires:
- build
- server-e2e-tests-electron-7:
requires:
- build
- server-e2e-tests-electron-8:
requires:
- build
- server-e2e-tests-firefox-1:
requires:
- build
- server-e2e-tests-firefox-2:
requires:
- build
- server-e2e-tests-firefox-3:
requires:
- build
- server-e2e-tests-firefox-4:
requires:
- build
- server-e2e-tests-firefox-5:
requires:
- build
- server-e2e-tests-firefox-6:
requires:
- build
- server-e2e-tests-firefox-7:
requires:
- build
- server-e2e-tests-firefox-8:
requires:
- build
- driver-integration-tests-chrome:
requires:
- build
- driver-integration-tests-firefox:
requires:
- build
## TODO: add these back in when flaky tests are fixed
# - driver-integration-tests-electron:
# requires:
# - build
- desktop-gui-integration-tests-2x:
requires:
- build
- desktop-gui-visual-tests:
requires:
- build
- reporter-integration-tests:
requires:
- build
- ui-components-integration-tests:
requires:
- build
- run-launcher:
requires:
- build
# various testing scenarios, like building full binary
# and testing it on a real project
- test-against-staging:
context: test-runner:record-tests
filters:
branches:
only:
- develop
requires:
- build
- test-kitchensink:
requires:
- build
- test-kitchensink-against-staging:
context: test-runner:record-tests
filters:
branches:
only:
- develop
requires:
- build
- build-npm-package:
requires:
- build
- upload-npm-package:
context: test-runner:upload
filters:
branches:
only:
- develop
requires:
- build-npm-package
- build-binary:
requires:
- build
- upload-binary:
context: test-runner:upload
filters:
branches:
only:
- develop
requires:
- build-binary
- test-npm-module-on-minimum-node-version:
requires:
- build-binary
- build-npm-package
- post-pre-release-install-comment:
context: test-runner:commit-status-checks
filters:
branches:
only:
- develop
requires:
- upload-npm-package
- upload-binary
- test-binary-and-npm-against-other-projects:
context: test-runner:trigger-test-jobs
filters:
branches:
only:
- develop
requires:
- upload-npm-package
- upload-binary
- test-npm-module-and-verify-binary:
filters:
branches:
only:
- develop
requires:
- build-npm-package
- build-binary
- test-binary-against-staging:
context: test-runner:record-tests
filters:
branches:
only:
- develop
requires:
- build-npm-package
- build-binary
- test-binary-against-recipes-firefox:
<<: *testBinaryFirefox
- test-binary-against-kitchensink:
<<: *testBinaryFirefox
- test-binary-against-kitchensink-firefox:
<<: *testBinaryFirefox
- test-binary-against-kitchensink-chrome:
<<: *testBinaryFirefox
- test-binary-against-todomvc-firefox:
<<: *testBinaryFirefox
- test-binary-against-documentation-firefox:
<<: *testBinaryFirefox
- test-binary-against-api-testing-firefox:
<<: *testBinaryFirefox
- test-binary-against-realworld-firefox:
<<: *testBinaryFirefox
- test-binary-against-piechopper-firefox:
<<: *testBinaryFirefox
- test-binary-as-specific-user:
name: "test binary as a non-root user"
executor: non-root-docker-user
requires:
- build-npm-package
- build-binary
- test-binary-as-specific-user:
name: "test binary as a root user"
requires:
- build-npm-package
- build-binary
mac-workflow: &mac-workflow
jobs:
- build:
name: Mac build
executor: mac
<<: *macBuildFilters
- lint:
name: Mac lint
executor: mac
<<: *macBuildFilters
requires:
- Mac build
- build-system-unit-tests:
name: Mac build system unit tests
executor: mac
requires:
- Mac build
<<: *macBuildFilters
# maybe run all unit tests?
- build-npm-package:
name: Mac NPM package
executor: mac
requires:
- Mac build
<<: *macBuildFilters
- upload-npm-package:
name: Mac NPM package upload
context: test-runner:upload
executor: mac
<<: *macBuildFilters
requires:
- Mac NPM package
- build-binary:
name: Mac binary
context: test-runner:sign-mac-binary
executor: mac
<<: *macBuildFilters
requires:
- Mac build
- upload-binary:
name: Mac binary upload
executor: mac
context: test-runner:upload
<<: *macBuildFilters
requires:
- Mac binary
- test-kitchensink:
name: Test Mac Kitchensink
executor: mac
<<: *macBuildFilters
requires:
- Mac build
- test-binary-against-kitchensink:
name: Test Mac binary against kitchensink
executor: mac
<<: *macBuildFilters
requires:
- Mac NPM package
- Mac binary
- test-binary-against-staging:
context: test-runner:record-tests
name: Test Mac binary against staging
executor: mac
filters:
branches:
only:
- develop
requires:
- Mac NPM package
- Mac binary
- post-pre-release-install-comment:
context: test-runner:commit-status-checks
name: Post Mac pre-release install comment
executor: mac
filters:
branches:
only:
- develop
requires:
- Mac NPM package upload
- Mac binary upload
- test-binary-and-npm-against-other-projects:
context: test-runner:trigger-test-jobs
name: Test Mac binary against other projects
executor: mac
filters:
branches:
only:
- develop
requires:
- Mac NPM package upload
- Mac binary upload
workflows:
linux:
<<: *linux-workflow
mac:
<<: *mac-workflow