代码拉取完成,页面将自动刷新
version: 2.1
# testing jobs are all the same, so just use a template
defaults: &defaults
parallelism: 1
working_directory: ~/app
docker:
- image: cypress/base:10
environment:
TERM: xterm
steps:
- attach_workspace:
at: ~/
# some examples have the server part
# so start it in the background
- run:
command: |
cd examples/$CIRCLE_JOB
npm run start --if-present
name: start the server
background: true
- run:
# only record the tests on Cypress Dashboard
# if the record key is set. Usually it is NOT set
# for forked pull request because environment variables
# are not passed to the external PRs
command: |
cd examples/$CIRCLE_JOB
if [ -z "$CYPRESS_RECORD_KEY" ]; then
npm run cypress:run
else
npm run cypress:run -- --record --group $CIRCLE_JOB
fi
name: Cypress tests
jobs:
# a single job that installs dependencies (NPM and Cypress)
build:
working_directory: ~/app
docker:
- image: cypress/base:10
environment:
TERM: xterm
steps:
- checkout
- restore_cache:
key: cache-dirs-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "circle.yml" }}
- run: npm ci
# Use Git commit message to install any pre-release versions of Cypress
- run: npm i -g @cypress/commit-message-install
# if there is no special JSON comment in the current commit body
# then this command does nothing
- run: commit-message-install --else "echo nothing custom to install"
# run verify and then save cache.
# this ensures that the Cypress verified status is cached too
- run: npm run cypress:verify
- run: npm run stop-only
- save_cache:
key: cache-dirs-{{ .Branch }}-{{ checksum "package.json" }}-{{ checksum "circle.yml" }}
paths:
- ~/.npm
- ~/.cache
# all other test jobs will run AFTER this build job finishes
# to avoid reinstalling dependencies, we persist the source folder "app"
# and the Cypress binary to workspace, which is the fastest way
# for Circle jobs to pass files
- persist_to_workspace:
root: ~/
paths:
- app
- .cache/Cypress
lint:
working_directory: ~/app
docker:
- image: cypress/base:10
steps:
- attach_workspace:
at: ~/
- run: npm run lint:json
- run: npm run lint
# dummy job running after all end-to-end tests
after-tests:
docker:
- image: cypress/base:10
steps:
- run: echo "all good"
# a single utility job that can run multiple examples one by one
# but with chunking
test-examples:
parallelism: 20
working_directory: ~/app
docker:
- image: cypress/base:10
environment:
TERM: xterm
steps:
- attach_workspace:
at: ~/
# when running in parallel, the total number of parallel containers
# is in variable CIRCLE_NODE_TOTAL and the current container index in CIRCLE_NODE_INDEX
# which starts at 0 and goes to $CIRCLE_NODE_TOTAL - 1
- run: npm run test:ci -- --chunk $CIRCLE_NODE_INDEX --total-chunks $CIRCLE_NODE_TOTAL
# a single utility script to run multiple examples against Chrome
test-examples-chrome:
parallelism: 10
working_directory: ~/app
docker:
- image: cypress/browsers:node12.0.0-chrome75
environment:
TERM: xterm
# no need to record these runs yet
CYPRESS_RECORD_KEY: ''
# while debugging https://github.com/cypress-io/cypress/issues/6053
DEBUG: cypress:server:protocol
steps:
- attach_workspace:
at: ~/
- run: npm run test:ci:chrome -- --chunk $CIRCLE_NODE_INDEX --total-chunks $CIRCLE_NODE_TOTAL
# run recipes that have "test:ci:chrome:headless" script
test-examples-chrome-headless:
parallelism: 1
working_directory: ~/app
docker:
- image: cypress/browsers:node12.14.0-chrome79-ff71
environment:
TERM: xterm
# no need to record these runs yet
CYPRESS_RECORD_KEY: ''
# while debugging https://github.com/cypress-io/cypress/issues/6053
DEBUG: cypress:server:protocol
steps:
- attach_workspace:
at: ~/
- run: npm run test:ci:chrome:headless -- --chunk $CIRCLE_NODE_INDEX --total-chunks $CIRCLE_NODE_TOTAL
# a single utility script to run multiple examples against Brave browser
test-examples-brave:
# only one recipe shows how to run Cypress using Brave browser
parallelism: 1
working_directory: ~/app
docker:
- image: cypress/browsers:node12.13.0-chrome78-ff70-brave78
environment:
TERM: xterm
steps:
- attach_workspace:
at: ~/
- run: npm run test:ci:brave -- --chunk $CIRCLE_NODE_INDEX --total-chunks $CIRCLE_NODE_TOTAL
# define a new job with defaults for each "examples/*" subfolder
blogs__a11y:
<<: *defaults
blogs__class-decorator:
<<: *defaults
blogs__assertion-counting:
<<: *defaults
blogs__application-actions:
<<: *defaults
blogs__notification:
<<: *defaults
blogs__iframes:
<<: *defaults
blogs__codepen-demo:
<<: *defaults
blogs__direct-control-angular:
<<: *defaults
blogs__e2e-api-testing:
<<: *defaults
blogs__e2e-snapshots:
<<: *defaults
blogs__element-coverage:
<<: *defaults
blogs__testing-redux-store:
<<: *defaults
blogs__vue-vuex-rest:
<<: *defaults
blogs__use-react-devtools:
<<: *defaults
extending-cypress__chai-assertions:
<<: *defaults
file-upload-react:
<<: *defaults
fundamentals__node-modules:
<<: *defaults
fundamentals__fixtures:
<<: *defaults
fundamentals__add-custom-command:
<<: *defaults
logging-in__csrf-tokens:
<<: *defaults
logging-in__html-web-forms:
<<: *defaults
logging-in__single-sign-on:
<<: *defaults
logging-in__xhr-web-forms:
<<: *defaults
logging-in__jwt:
<<: *defaults
logging-in__using-app-code:
<<: *defaults
preprocessors__grep:
<<: *defaults
# in this particular example we want to grep tests
# and run only tests with name having "@admin"
environment:
CYPRESS_grep: '@admin'
preprocessors__flow-browserify:
<<: *defaults
preprocessors__typescript-browserify:
<<: *defaults
preprocessors__typescript-webpack:
<<: *defaults
stubbing-spying__functions:
<<: *defaults
stubbing-spying__window-fetch:
<<: *defaults
stubbing-spying__google-analytics:
<<: *defaults
stubbing-spying__navigator:
<<: *defaults
stubbing-spying__window:
<<: *defaults
stubbing-spying__console:
<<: *defaults
stubbing__resources:
<<: *defaults
testing-dom__drag-drop:
<<: *defaults
testing-dom__form-interactions:
<<: *defaults
testing-dom__hover-hidden-elements:
<<: *defaults
testing-dom__tab-handling-links:
<<: *defaults
testing-dom__wait-for-resource:
<<: *defaults
testing-dom__performance-metrics:
<<: *defaults
testing-dom__csv-table:
<<: *defaults
testing-dom__root-style:
<<: *defaults
testing-dom__select2:
<<: *defaults
unit-testing__application-code:
<<: *defaults
unit-testing__react:
<<: *defaults
unit-testing__react-skeleton:
<<: *defaults
server-communication__bootstrapping-your-app:
<<: *defaults
server-communication__env-variables:
<<: *defaults
server-communication__seeding-database-in-node:
<<: *defaults
server-communication__visit-2nd-domain:
<<: *defaults
server-communication__xhr-assertions:
<<: *defaults
server-communication__stream-tests:
<<: *defaults
fundamentals__dynamic-tests:
<<: *defaults
fundamentals__module-api:
<<: *defaults
fundamentals__chrome-remote-debugging:
<<: *defaults
# list all jobs to run and their dependencies here
# and then use this list from workflow definition
all_jobs: &all_jobs
- build
- lint:
requires:
- build
- test-examples:
requires:
- build
filters:
branches:
only:
- master
- test-examples-chrome:
requires:
- build
- test-examples-chrome-headless:
requires:
- build
# disabled Brave testing for now
# on v3 it needs --browser brave
# but v4 whitelists browser names and does not allow "brave"
# - test-examples-brave:
# requires:
# - build
# filters:
# branches:
# only:
# - master
# when adding new example subfolder with a recipe
# add its name here to "create" CircleCI job
# Do not run Codepen demo by default - because it depends on
# the external service that sometimes gives 502 breaking our tests
# - blogs__codepen-demo:
# requires:
# - build
- blogs__a11y:
requires:
- build
- blogs__class-decorator:
requires:
- build
- blogs__assertion-counting:
requires:
- build
- blogs__notification:
requires:
- build
- blogs__iframes:
requires:
- build
- blogs__application-actions:
requires:
- build
- blogs__direct-control-angular:
requires:
- build
- blogs__e2e-api-testing:
requires:
- build
- blogs__e2e-snapshots:
requires:
- build
- blogs__element-coverage:
requires:
- build
- blogs__testing-redux-store:
requires:
- build
- blogs__vue-vuex-rest:
requires:
- build
- blogs__use-react-devtools:
requires:
- build
- extending-cypress__chai-assertions:
requires:
- build
- file-upload-react:
requires:
- build
- fundamentals__node-modules:
requires:
- build
- fundamentals__add-custom-command:
requires:
- build
- logging-in__csrf-tokens:
requires:
- build
- logging-in__html-web-forms:
requires:
- build
- logging-in__single-sign-on:
requires:
- build
- logging-in__xhr-web-forms:
requires:
- build
- logging-in__jwt:
requires:
- build
- logging-in__using-app-code:
requires:
- build
- preprocessors__grep:
requires:
- build
- preprocessors__flow-browserify:
requires:
- build
- preprocessors__typescript-browserify:
requires:
- build
- preprocessors__typescript-webpack:
requires:
- build
- stubbing-spying__functions:
requires:
- build
- stubbing-spying__window-fetch:
requires:
- build
- stubbing-spying__console:
requires:
- build
- stubbing-spying__window:
requires:
- build
- stubbing-spying__google-analytics:
requires:
- build
- stubbing-spying__navigator:
requires:
- build
- stubbing__resources:
requires:
- build
- testing-dom__drag-drop:
requires:
- build
- testing-dom__form-interactions:
requires:
- build
- testing-dom__hover-hidden-elements:
requires:
- build
- testing-dom__tab-handling-links:
requires:
- build
- testing-dom__wait-for-resource:
requires:
- build
- testing-dom__csv-table:
requires:
- build
- testing-dom__performance-metrics:
requires:
- build
- testing-dom__root-style:
requires:
- build
- testing-dom__select2:
requires:
- build
- unit-testing__application-code:
requires:
- build
- unit-testing__react:
requires:
- build
- unit-testing__react-skeleton:
requires:
- build
- server-communication__bootstrapping-your-app:
requires:
- build
- server-communication__env-variables:
requires:
- build
- server-communication__seeding-database-in-node:
requires:
- build
- server-communication__xhr-assertions:
requires:
- build
- server-communication__visit-2nd-domain:
requires:
- build
- server-communication__stream-tests:
requires:
- build
- fundamentals__dynamic-tests:
requires:
- build
- fundamentals__fixtures:
requires:
- build
- fundamentals__module-api:
requires:
- build
# to avoid constantly tweaking required jobs on CircleCI
# we can have a single job wait on all other test jobs here.
# CircleCI can then just require this 1 job to pass
# see https://glebbahmutov.com/blog/parallel-or-not/
- after-tests:
requires:
- build
- lint
- blogs__a11y
- blogs__class-decorator
- blogs__assertion-counting
- blogs__application-actions
- blogs__notification
- blogs__iframes
- blogs__direct-control-angular
- blogs__e2e-api-testing
- blogs__e2e-snapshots
- blogs__element-coverage
- blogs__testing-redux-store
- blogs__vue-vuex-rest
- blogs__use-react-devtools
- extending-cypress__chai-assertions
- file-upload-react
- fundamentals__node-modules
- fundamentals__fixtures
- fundamentals__dynamic-tests
- fundamentals__module-api
- fundamentals__add-custom-command
- logging-in__csrf-tokens
- logging-in__html-web-forms
- logging-in__single-sign-on
- logging-in__xhr-web-forms
- logging-in__jwt
- logging-in__using-app-code
- preprocessors__grep
- preprocessors__flow-browserify
- preprocessors__typescript-browserify
- preprocessors__typescript-webpack
- server-communication__bootstrapping-your-app
- server-communication__env-variables
- server-communication__seeding-database-in-node
- server-communication__xhr-assertions
- server-communication__visit-2nd-domain
- server-communication__stream-tests
- stubbing-spying__functions
- stubbing-spying__window-fetch
- stubbing-spying__google-analytics
- stubbing-spying__navigator
- stubbing-spying__window
- stubbing-spying__console
- stubbing__resources
- testing-dom__drag-drop
- testing-dom__form-interactions
- testing-dom__hover-hidden-elements
- testing-dom__tab-handling-links
- testing-dom__wait-for-resource
- testing-dom__csv-table
- testing-dom__performance-metrics
- testing-dom__root-style
- testing-dom__select2
- unit-testing__application-code
- unit-testing__react
- unit-testing__react-skeleton
# "meta" jobs
- test-examples
- test-examples-chrome
- test-examples-chrome-headless
workflows:
version: 2
# run this workflow on each commit and pull request
all-recipes:
jobs: *all_jobs
# since this is testing a lot of external sites
# let's run these tests once per day (at night)
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs: *all_jobs
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。