forked from cypress-io/circleci-orb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorb.yml
944 lines (871 loc) · 30 KB
/
orb.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
version: 2.1
description: |
Run your Cypress.io end-to-end browser tests without spending time configuring CircleCI.
This orb can also record results on the Cypress Dashboard and load balance tests in parallel mode.
If recording on the dashboard, set `CYPRESS_RECORD_KEY` as CI environment variable.
Repo: https://github.com/cypress-io/circleci-orb
#
# See https://www.cypress.io/
#
# User workflows can use "Jobs" defined in this Orb
# Jobs can use "Commands" also defined in this Orb
# Commands run on "Executors" defined below to guarantee consistent environment
# with all dependencies installed correctly.
#
# environments (containers) for running jobs and commands
#
executors:
default:
description: Single Docker container with Cypress dependencies
parameters:
node:
type: string
default: '10'
description: Version of Node 6/8/10 to use
docker:
- image: cypress/base:<< parameters.node >>
# executors based on available Cypress docker images
# see https://github.com/cypress-io/cypress-docker-images
# see https://hub.docker.com/r/cypress/base/tags
base-6:
description: Single Docker container with Node 6 and Cypress dependencies
docker:
- image: cypress/base:6
base-8:
description: Single Docker container with Node 8 and Cypress dependencies
docker:
- image: cypress/base:8
base-10:
description: Single Docker container with Node 10 and Cypress dependencies
docker:
- image: cypress/base:10
base-12-6-0:
description: Single Docker container with Node 12.6.0 and Cypress dependencies
docker:
- image: cypress/base:12.6.0
browsers-chrome69:
description: Docker container with Node 10, Cypress dependencies and Chrome 69
docker:
- image: cypress/browsers:chrome69
browsers-chrome73:
description: Docker container with Node 11.13.0, Cypress dependencies and Chrome 73
docker:
- image: cypress/browsers:node11.13.0-chrome73
browsers-chrome74:
description: Docker container with Node 10.1.2, Cypress dependencies and Chrome 74
docker:
- image: cypress/browsers:node10.2.1-chrome74
browsers-chrome75:
description: Docker container with Node 12.6.0, Cypress dependencies and Chrome 75
docker:
- image: cypress/browsers:node12.6.0-chrome75
browsers-chrome76:
description: Docker container with Node 10.16.0, Cypress dependencies and Chrome 69
docker:
- image: cypress/browsers:node10.16.0-chrome76
#
# reusable commands
#
commands:
#
# individual "building blocks" commands
#
setup:
parameters:
executor:
description: Executor to use
type: executor
default: base-10
build:
description: Optional build command(s)
type: steps
default: []
yarn:
description: Use yarn instead of npm
type: boolean
default: false
cache-key:
description: Npm cache key
type: string
default: 'cache-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}'
working_directory:
description: Directory containing package.json
type: string
default: ''
steps:
- restore_cache:
keys:
- << parameters.cache-key >>
# it would be nice to vary this command based on presence of "package-lock.json"
# and also allow using yarn or pnpm
- when:
condition: << parameters.yarn >>
steps:
- run:
name: 'Yarn install'
command: 'yarn install --frozen-lockfile'
working_directory: << parameters.working_directory >>
- unless:
condition: << parameters.yarn >>
steps:
- run:
name: 'Check if package-lock.json exists'
command: |
if [ ! -e ./package-lock.json ]; then
echo "The Cypress orb uses 'npm ci' to install 'node_modules', which requires a 'package-lock.json'."
echo "A 'package-lock.json' file was not found. Please run 'npm install' in your project,"
echo "and commit 'package-lock.json' to your repo."
exit 1
fi
working_directory: << parameters.working_directory >>
- run:
name: 'Npm CI'
command: 'npm ci'
working_directory: << parameters.working_directory >>
- run:
name: 'Verify Cypress'
command: npx cypress verify
working_directory: << parameters.working_directory >>
# save new cache folder if needed
- when:
condition: << parameters.yarn >>
steps:
- save_cache:
key: << parameters.cache-key >>
paths:
- ~/.cache
- unless:
condition: << parameters.yarn >>
steps:
- save_cache:
key: << parameters.cache-key >>
paths:
- ~/.npm
- ~/.cache
- steps: << parameters.build >>
write_workspace:
steps:
- persist_to_workspace:
root: ~/
paths:
- project
- .cache/Cypress
#
# public user commands
#
# Install command
install:
description: |
Install NPM dependencies using "npm ci" or "yarn install --frozen-lockfile" then optionally runs your build command
parameters:
build:
type: steps
default: []
description: Custom build commands to run after install
yarn:
description: Use yarn instead of npm
type: boolean
default: false
cache-key:
description: Npm cache key
type: string
default: 'cache-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}'
no-workspace:
description: |
Do not write workspace (for example if there are no jobs to follow)
type: boolean
default: false
working_directory:
description: Directory containing package.json
type: string
default: ''
steps:
- setup:
build: << parameters.build >>
yarn: << parameters.yarn >>
cache-key: << parameters.cache-key >>
working_directory: << parameters.working_directory >>
- unless:
condition: << parameters.no-workspace >>
steps:
- write_workspace
#
# jobs defined by the orb
#
jobs:
# a single e2e test run that
# - checks out code
# - installs NPM dependencies
# * (optional) run custom build command
# - executes Cypress end-to-end tests
# * (optional) starts server in the background
# * (optional) records tests results on Cypress Dashboard:
# - (optional) splits tests across N machines
# - (optional) names tests with a group name
# - (optional) use custom run tests command
run:
description:
A single complete job to run Cypress end-to-end tests in your project.
If recording on the Dashboard, set `CYPRESS_RECORD_KEY` environment variable
parameters:
executor:
type: executor
default: base-10
description: |
Cypress executor to use, see [executors.md](executors.md).
You can define your own executor, see examples.
record:
type: boolean
default: false
description: |
Record results on Cypress Dashboard, see https://on.cypress.io/dashboard-service.
This option is necessary to enable other related flags, like `parallel` and `group`.
# "parallel" parameter should be used with "parallelism" parameter
parallel:
type: boolean
default: false
description: |
Use test balancing using Cypress Dashboard,
see https://on.cypress.io/parallelization. Requires `record: true` and
only makes sense with CircleCI `parallelism` setting to spin several CI machines.
Related options "record" and "group".
parallelism:
type: integer
default: 1
description: |
Number of Circle machines to use for load balancing, min 1
(requires "parallel" parameter set to true, and requires `record: true`)
group:
type: string
default: ''
description: |
Test group name when recording on the dashboard. Requires `record: true`
build:
type: string
default: ''
description: |
Custom build command to run after install to build your application.
Related parameter "start"
start:
type: string
default: ''
description: |
Optional server start command to run in the background before running Cypress tests.
Related parameters "build" and "wait-on".
wait-on:
type: string
default: ''
description: |
Optional url check using `wait-on` utility. Useful to delay tests until server boots and responds.
Example:
wait-on: "http://localhost:4200" # wait for local port 4200 to respond to HEAD request
wait-on: "http-get://127.0.0.1:3000" # wait for port 3000 to respond to GET request
browser:
type: string
default: ''
description: |
Browser to use to run end-to-end tests. Typically "electron" (default) or "chrome".
See https://on.cypress.io/launching-browsers, requires using executor with the browser installed,
electron browser is already included with Cypress.
spec:
type: string
default: ''
description: |
Spec pattern to use to run only some test files, passed as `--spec ...` CLI argument.
command:
type: string
default: ''
description: |
Custom test command to run Cypress tests, which overrides all individual options.
store_artifacts:
type: boolean
default: false
description: |
Store Cypress-generated screenshots and videos as CircleCI test artifacts.
See https://circleci.com/docs/2.0/artifacts/
yarn:
description: Use yarn to install NPM modules instead of npm.
type: boolean
default: false
cache-key:
description: |
Custom CircleCI cache key for storing NPM modules and Cypress binary.
type: string
default: 'cache-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}'
no-workspace:
description: |
Do not write workspace (for example if there are no jobs to follow), which
saves time on each build.
type: boolean
default: false
working_directory:
description: |
Directory containing package.json. Use this parameter if you're using a monorepo and your
cypress tests aren't at the root of the repository (eg. `frontend`).
type: string
default: ''
timeout:
description: Optional timeout for running tests
type: string
default: 10m
executor: <<parameters.executor>>
parallelism: <<parameters.parallelism>>
steps:
- when:
condition: << parameters.parallel >>
# user wants to run in parallel mode
# thus we assume the dependencies were installed as separate job
# hmm, can we detect if this job requires cypress/install automatically?
steps:
- run: echo "Assuming dependencies were installed using cypress/install job"
- attach_workspace:
at: ~/
- unless:
condition: << parameters.parallel >>
steps:
- checkout
- when:
condition: << parameters.build >>
steps:
- install:
yarn: << parameters.yarn >>
cache-key: << parameters.cache-key >>
no-workspace: << parameters.no-workspace >>
build:
- run: << parameters.build >>
working_directory: << parameters.working_directory >>
- unless:
condition: <<parameters.build>>
steps:
- install:
cache-key: << parameters.cache-key >>
yarn: << parameters.yarn >>
no-workspace: << parameters.no-workspace >>
working_directory: << parameters.working_directory >>
- when:
condition: <<parameters.start>>
steps:
- run:
name: Start
command: <<parameters.start>>
background: true
working_directory: << parameters.working_directory >>
- when:
condition: <<parameters.wait-on>>
steps:
- run:
name: Wait-on <<parameters.wait-on>>
command: npx wait-on <<parameters.wait-on>>
- when:
condition: <<parameters.command>>
steps:
- run:
command: <<parameters.command>>
working_directory: << parameters.working_directory >>
- unless:
condition: <<parameters.command>>
steps:
- run:
name: Run Cypress tests
no_output_timeout: <<parameters.timeout>>
# GOOD EXAMPLE conditional text based on boolean parameter
# --record is needed to pass many other arguments, like "--group" and "--parallel"
command: |
npx cypress run \
<<# parameters.spec>> --spec '<<parameters.spec>>' <</ parameters.spec>> \
<<# parameters.browser>> --browser <<parameters.browser>> <</ parameters.browser>> \
<<# parameters.record >> --record \
<<# parameters.group>> --group '<<parameters.group>>' <</ parameters.group>> \
<<# parameters.parallel>> --parallel <</ parameters.parallel>> \
<</ parameters.record>>
working_directory: << parameters.working_directory >>
- when:
condition: << parameters.store_artifacts >>
# store videos and screenshots (if any) as Circle artifacts
# https://circleci.com/docs/2.0/artifacts/
steps:
- store_artifacts:
path: cypress/videos
- store_artifacts:
path: cypress/screenshots
# Install Job that can be performed before running jobs
# often used to have a single installation step, and then
# multiple run jobs can share the same pre-installed workspace.
install:
parameters:
executor:
type: executor
default: base-10
description: Cypress or custom executor name to use to run the install.
build:
type: string
default: ''
description: |
Custom build command to run after install to build the web application or web server.
cache-key:
description: Npm cache key
type: string
default: 'cache-{{ arch }}-{{ .Branch }}-{{ checksum "package.json" }}'
yarn:
description: Use yarn to install NPM modules instead of npm.
type: boolean
default: false
working_directory:
description: |
Directory containing package.json. Use this parameter if you're using a monorepo and your
cypress tests aren't at the root of the repository (eg. `frontend`). Additionally,
monorepo users will want to provide a `cache-key` parameter to key the cache with an
appropriate checksum. (i.e. `cache-key: 'cache-{{ arch }}-{{ .Branch }}-{{ checksum "frontend/package.json" }}'`)
type: string
default: ''
description: |
Checks out code, installs dependencies, attaches code to the workspace for the future jobs
to use (usually `cypress/run` follows the install step).
executor: <<parameters.executor>>
steps:
- checkout
- when:
condition: << parameters.build >>
steps:
- install:
yarn: << parameters.yarn >>
build:
- run:
name: 'Build'
command: << parameters.build >>
working_directory: << parameters.working_directory >>
cache-key: << parameters.cache-key >>
- unless:
condition: << parameters.build >>
steps:
- install:
yarn: << parameters.yarn >>
working_directory: << parameters.working_directory >>
cache-key: << parameters.cache-key >>
#
# User examples showing how to use the above Cypress Orb
#
examples:
simple:
description: |
Runs all Cypress tests without recording results on the Dashboard.
Installs dependencies with "npm ci", caches NPM modules and Cypress binary.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run
yarn:
description: |
Installs NPM dependencies using "yarn install --frozen-lockfile" command,
then runs Cypress tests. Caches NPM modules and Cypress binary.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
yarn: true
custom-directory:
description: |
Runs all commands in a custom directory, this is useful when using a monorepo where
the `package.json` file isn't at the root of the repository
(eg. in the `frontend/subfolder`).
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
yarn: true
working_directory: frontend
custom-cache-key:
description: |
Apply custom key for npm install (or yarn install) cache.
Useful to tweak caching settings to your liking. Related options "yarn".
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
yarn: true
cache-key: yarn-packages-{{ arch }}-{{ checksum "yarn.lock" }}
custom-cache-and-directory:
description: |
Monorepo users may want to provide a `cache-key` parameter to key the cache
with an appropriate checksum.
(i.e. `cache-key: 'cache-{{ arch }}-{{ .Branch }}-{{ checksum "frontend/package.json" }}'`)
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/install:
cache-key: cache-{{ arch }}-{{ .Branch }}-{{ checksum "frontend/package.json" }}
- cypress/run:
yarn: true
cache-key: cache-{{ arch }}-{{ .Branch }}-{{ checksum "frontend/package.json" }}
working_directory: frontend
using-node6:
description: |
Runs all Cypress tests on Node 6 image by specifying `executor` name.
There are several executors included with this orb, and you can use
your own executor, see "custom-executor" example.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
executor: cypress/base-6
recording:
description: |
Runs all Cypress tests and records them on the
[Cypress Dashboard](https://on.cypress.io/dashboard-service).
Requires `CYPRESS_RECORD_KEY` environment variable to be set.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
record: true
artifacts:
description: |
Stores test screenshots and videos as CircleCI artifacts using "store_artifacts" job option.
Note, this setting assumes the default Cypress folders for screenshots and videos.
If you store screenshots and videos in custom folders, see "any-artifacts" example how
to store arbitrary folders.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
store_artifacts: true
any-artifacts:
description: |
Stores additional folders like "mochawesome-report" or code coverage folder
as a CircleCI artifact. Related option "artifacts".
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
post-steps:
- store_artifacts:
path: mochawesome-report
chrome:
description: |
Runs tests using Chrome browser in a custom executor - a Docker image
that includes Chrome browser. See [`--browser`](https://on.cypress.io/launching-browsers)
Cypress run option documentation.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
executor: cypress/browsers-chrome69
browser: chrome
start-server:
description: |
Often we need to start a local webserver before running end-to-end tests.
This option runs the given command to starts the server in the background
and then runs all Cypress tests. Related option "wait-on".
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
start: 'npm start'
wait-for-server-to-respond:
description: |
Starts server, waits for it to respond and then runs all Cypress tests.
Uses `npx wait-on ...` command under the hood, see [wait-on](https://github.com/jeffbski/wait-on#readme).
Note, if you are using Webpack server, it might not respond to the default HTTP OPTIONS request.
In that case use `wait-on` to send `HTTP GET` request by using url `wait-on: 'http-get://localhost:....'`.
You can also pass `wait-on` config, see [issue #90](https://github.com/cypress-io/circleci-orb/issues/90).
Related option "start"
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
start: 'npm start'
wait-on: 'http://localhost:4200'
parallel-on-2-machines:
description: |
Runs all Cypress tests by load balancing them on two machines. Note that
first a single job installs NPM dependencies, then 2 jobs run the tests
in parallel using Cypress Dashboard [parallelization](https://on.cypress.io/parallelization).
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/install
- cypress/run:
requires:
- cypress/install
record: true
parallel: true
parallelism: 2
group: '2 machines'
install-private-npm-modules:
description: |
In this example, we write the NPM auth token before running "npm install" command.
This allows us to install private NPM modules for example.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/install:
pre-steps:
- run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- cypress/run:
requires:
- cypress/install
build-app:
description: |
Install dependencies and run a custom build command on one machine that builds the
web application. Then runs Cypress tests on 3 machines and balances them using
[Dashboard parallelization](https://on.cypress.io/parallelization).
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/install:
build: 'npm run build' # custom build command
- cypress/run:
requires:
- cypress/install
record: true
parallel: true
parallelism: 3
group: '3x'
groups:
description: |
Runs all tests on 4 machines using Electron browser (default).
Also runs some tests using "spec" parameter on Chrome browser.
Records both groups on Cypress dashboard. Notice "name" under each "cypress/run" job
which will be shown in the Circle workflow UI to tell jobs apart.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/install
- cypress/run:
name: '4 machines'
requires:
- cypress/install
record: true
parallel: true
parallelism: 4
group: '4 machines'
- cypress/run:
name: 'Chrome'
requires:
- cypress/install
executor: cypress/browsers-chrome69
record: true
parallel: true
parallelism: 2
group: 'smoke tests'
browser: 'chrome'
spec: 'cypress/integration/smoke/*'
release:
description: |
If you want to run an entire job after running Cypress tests, you can
reuse the workspace from the `cypress/run` job. For example,
to run a semantic release script you could follow this example.
Note - for simpler steps you can use "post-steps" parameter, see "store-test-reports" example.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
jobs:
release:
executor: cypress/base-10
steps:
# the workspace saved by cypress/install
- attach_workspace:
at: ~/
- run: npm run semantic-release
workflows:
build:
jobs:
- cypress/install
- cypress/run:
requires:
- cypress/install
- release:
requires:
- cypress/run
linux-and-mac:
description: |
Runs tests on Linux and on Mac via two jobs. Note how the user defines and uses own executor "mac"
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
executors:
mac:
macos:
xcode: '10.1.0'
workflows:
build:
jobs:
- cypress/run:
name: Linux test
- cypress/run:
name: Mac test
executor: mac
custom-executor:
description: |
Use any executor to run the job defined by the orb.
Assumes the executor has all OS dependencies necessary to run Cypress.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
executors:
with-chrome:
docker:
- image: cypress/browsers:chrome69
workflows:
build:
jobs:
- cypress/run:
executor: with-chrome
store-test-reports:
description: |
Stores test results using post-steps parameter, see https://on.cypress.io/reporters,
assumes that reports are saved in folder "cypress/results". Also see "artifacts" parameter.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
post-steps:
- store_test_results:
path: cypress/results
env-vars:
description: |
Set additional environment variables when running Cypress tests by
adding them to the executor.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
executors:
base10-foo-bar:
docker:
- image: cypress/base:10
environment:
FOO: 'foo'
BAR: 'bar'
workflows:
build:
jobs:
- cypress/run:
executor: base10-foo-bar
custom-command:
description: Use your own arbitrary command to launch Cypress tests.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
command: npx cypress run --record
no-workspace:
description: |
Faster "cypress/run" job that does not attach workspace,
because there are no jobs that follow, so no need to save files.
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
no-workspace: true
private-npm-module:
description: |
This example shows how to install private NPM modules using NPM_TOKEN environment
variable using "pre-steps" parameter. Then it starts the server, waits for it to respond
and runs Cypress tests. Then it publishes a new version of the current module
using semantic-release script (using the same NPM_TOKEN variable to publish).
usage:
version: 2.1
orbs:
cypress: cypress-io/cypress@1
workflows:
build:
jobs:
- cypress/run:
pre-steps:
- run: 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
no-workspace: true
start: npm start
wait-on: 'http://localhost:3003'
post-steps:
- run: npm run semantic-release
##
## Development (internal)
##
## process this workflow using above jobs and commands like inline orb
## Useful for local developing, especially by showing the effective config
## using: npm run effective:config
# workflows:
# build:
# jobs:
# - run:
# no-workspace: true