1 Star 0 Fork 0

孟献鹏/cypress-example-recipes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
circle.yml 15.00 KB
一键复制 编辑 原始数据 按行查看 历史
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mengxianpeng/cypress-example-recipes.git
[email protected]:mengxianpeng/cypress-example-recipes.git
mengxianpeng
cypress-example-recipes
cypress-example-recipes
master

搜索帮助