Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
browser-tools: circleci/browser-tools@1.5.1
Use browser-tools
elements in your existing workflows and jobs.
Install all available browsers and browser drivers. Includes Chrome, FireFox, ChromeDriver and GeckoDriver. Use the node variant
1
2
3
4
5
6
7
8
9
10
version: '2.1'
orbs:
browser-tools: circleci/browser-tools@x.y
jobs:
test:
docker:
- image: cimg/node:20.4.0-browsers
steps:
- browser-tools/install-browser-tools
workflows: null
Install Google's Chrome browser and ChromeDriver in the node variant image
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
version: '2.1'
orbs:
browser-tools: circleci/browser-tools@x.y
jobs:
test:
docker:
- image: cimg/node:20.4.0-browsers
steps:
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run:
command: |
google-chrome --version
chromedriver --version
name: Check install
workflows: null
Install specific versions of firefox and chrome in the base variant image.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
version: '2.1'
orbs:
browser-tools: circleci/browser-tools@x.y
jobs:
test:
executor: browser-tools/default
steps:
- browser-tools/install-browser-tools:
chrome-version: 85.0.4183.102
firefox-version: 80.0.1
- run:
command: |
google-chrome --version
firefox --version
geckodriver --version
chromedriver --version
java -jar /usr/local/bin/selenium.jar --version
name: Check install
workflows: null
Install various browsers and browser-testing tools into any Debian/Ubuntu-based Docker image. Intended to ease browser testing on CircleCI. Requirements: bash, curl, apt-get, gpg, sha256sum, sed, tar, unzip, grep
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
chrome-version | Version of Chrome to install, defaults to the latest stable release. To install an older release, specify a full chrome version number, e.g., 85.0.4183.83 Only supported on centos and debian
| No | latest | string |
chromedriver-install-dir | Directory in which to install Chromedriver
| No | /usr/local/bin | string |
firefox-install-dir | Directory in which to install Firefox
| No | /usr/local/bin | string |
firefox-version | Version of Firefox to install, defaults to the latest stable release. To install an older release, specify a full semantic version number, e.g., 66.0.3, 53.0, etc.
| No | latest | string |
geckodriver-install-dir | Directory in which to install Geckodriver
| No | /usr/local/bin | string |
geckodriver-version | Version of Geckodriver to install, defaults to latest release. To install an older release, specify a full semantic version tag, e.g., `v0.23.0`. For a list of releases, and a Firefox/Geckodriver version compatibility table, see the following links: https://github.com/mozilla/geckodriver/releases https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
| No | latest | string |
install-chrome | Install Google Chrome? Note: only the latest stable release can be installed, as Google does not maintain a public archive of previous releases.
| No | true | boolean |
install-chromedriver | Install Chromedriver? Note: requires Google Chrome. A Chromedriver version will be dynamically selected based on the installed version of Chrome; for details, see the following information: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection
| No | true | boolean |
install-firefox | Install Firefox? | No | true | boolean |
install-geckodriver | Install Geckodriver? | No | true | boolean |
replace-existing-chrome | If there is an existing installation of Google Chrome, replace it with the latest stable release
| No | false | boolean |
Install Google's Chrome browser, for use in browser testing. Note: only the latest stable release can be installed, as Google does not maintain a public archive of previous releases. Supports Debian/Ubuntu Linux, Alpine Linux (via Chromium), and macOS environments.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
cache_key | Cache key to save chrome.
Defaults to v1.
| No | v1 | string |
channel | The release channel of Google Chrome to use. Defaults to 'stable'.
| No | stable | enum |
chrome-version | Version of Chrome to install, defaults to the latest stable release. To install an older release, specify a full chrome version number, e.g., 85.0.4183.83 Only supported on centos and debian If replace-existing is false, this version is ignored.
| No | latest | string |
replace-existing | If there is an existing installation of Google Chrome, replace it with the latest stable release?
| No | false | boolean |
use_cache | Install chrome using a cached version.
Using this option will increase costs and does not improve times considerable, use only if having problems with download.
Defaults to false.
| No | false | boolean |
Install Google's ChromeDriver WebDriver proxy, for use in browser testing with Chrome. A ChromeDriver version will be dynamically selected based on the installed version of Chrome; for details, see https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection Requirements: sed, curl, unzip
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
install-dir | Directory in which to install ChromeDriver (directory selection not supported on Alpine Linux)
| No | /usr/local/bin | string |
Install Mozilla's Firefox browser, for use in browser testing. Requires apt-get, gpg, curl, sha256sum, tar, jq
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
cache_key | Cache key to save chrome.
Defaults to v1.
| No | v1 | string |
install-dir | Directory in which to install Firefox
| No | /usr/local/bin | string |
use_cache | Install firefox using a cached version of the installer.
Using this option will increase costs and does not improve times considerable, use only if having problems with download.
Defaults to false.
| No | false | boolean |
version | Version of Firefox to install, defaults to the latest stable release. To install an older release, specify a full semantic version number, ESR or otherwise, e.g., 66.0.3, 52.0.1esr, 53.0, etc.
| No | latest | string |
Install Mozilla's Geckodriver WebDriver proxy, for use in browser testing with Firefox. Requirements: curl, tar
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
install-dir | Directory in which to install Geckodriver
| No | /usr/local/bin | string |
version | Version of Geckodriver to install, defaults to latest release. To install an older release, specify a full semantic version tag, e.g., `v0.23.0`. For a list of releases, and a Firefox/Geckodriver version compatibility table, see the following links: https://github.com/mozilla/geckodriver/releases https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
| No | latest | string |
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
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
Install a variety of browsers and tools for browser testing. Includes Chrome, FireFox, ChromeDriver and GeckoDriver.
display:
source_url: https://github.com/CircleCI-Public/browser-tools-orb
commands:
install-browser-tools:
description: |
Install various browsers and browser-testing tools into any Debian/Ubuntu-based Docker image. Intended to ease browser testing on CircleCI. Requirements: bash, curl, apt-get, gpg, sha256sum, sed, tar, unzip, grep
parameters:
chrome-version:
default: latest
description: |
Version of Chrome to install, defaults to the latest stable release. To install an older release, specify a full chrome version number, e.g., 85.0.4183.83 Only supported on centos and debian
type: string
chromedriver-install-dir:
default: /usr/local/bin
description: |
Directory in which to install Chromedriver
type: string
firefox-install-dir:
default: /usr/local/bin
description: |
Directory in which to install Firefox
type: string
firefox-version:
default: latest
description: |
Version of Firefox to install, defaults to the latest stable release. To install an older release, specify a full semantic version number, e.g., 66.0.3, 53.0, etc.
type: string
geckodriver-install-dir:
default: /usr/local/bin
description: |
Directory in which to install Geckodriver
type: string
geckodriver-version:
default: latest
description: |
Version of Geckodriver to install, defaults to latest release. To install an older release, specify a full semantic version tag, e.g., `v0.23.0`. For a list of releases, and a Firefox/Geckodriver version compatibility table, see the following links: https://github.com/mozilla/geckodriver/releases https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
type: string
install-chrome:
default: true
description: |
Install Google Chrome? Note: only the latest stable release can be installed, as Google does not maintain a public archive of previous releases.
type: boolean
install-chromedriver:
default: true
description: |
Install Chromedriver? Note: requires Google Chrome. A Chromedriver version will be dynamically selected based on the installed version of Chrome; for details, see the following information: https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection
type: boolean
install-firefox:
default: true
description: Install Firefox?
type: boolean
install-geckodriver:
default: true
description: Install Geckodriver?
type: boolean
replace-existing-chrome:
default: false
description: |
If there is an existing installation of Google Chrome, replace it with the latest stable release
type: boolean
steps:
- when:
condition: <<parameters.install-firefox>>
steps:
- install-firefox:
install-dir: <<parameters.firefox-install-dir>>
version: <<parameters.firefox-version>>
- when:
condition: <<parameters.install-geckodriver>>
steps:
- install-geckodriver:
install-dir: <<parameters.geckodriver-install-dir>>
version: <<parameters.geckodriver-version>>
- when:
condition: <<parameters.install-chrome>>
steps:
- install-chrome:
chrome-version: <<parameters.chrome-version>>
replace-existing: <<parameters.replace-existing-chrome>>
- when:
condition: <<parameters.install-chromedriver>>
steps:
- install-chromedriver:
install-dir: <<parameters.chromedriver-install-dir>>
install-chrome:
description: |
Install Google's Chrome browser, for use in browser testing. Note: only the latest stable release can be installed, as Google does not maintain a public archive of previous releases. Supports Debian/Ubuntu Linux, Alpine Linux (via Chromium), and macOS environments.
parameters:
cache_key:
default: v1
description: |
Cache key to save chrome.
Defaults to v1.
type: string
channel:
default: stable
description: |
The release channel of Google Chrome to use. Defaults to 'stable'.
enum:
- stable
- beta
type: enum
chrome-version:
default: latest
description: |
Version of Chrome to install, defaults to the latest stable release. To install an older release, specify a full chrome version number, e.g., 85.0.4183.83 Only supported on centos and debian If replace-existing is false, this version is ignored.
type: string
replace-existing:
default: false
description: |
If there is an existing installation of Google Chrome, replace it with the latest stable release?
type: boolean
use_cache:
default: false
description: |
Install chrome using a cached version.
Using this option will increase costs and does not improve times considerable, use only if having problems with download.
Defaults to false.
type: boolean
steps:
- when:
condition: <<parameters.use_cache>>
steps:
- restore_cache:
keys:
- chrome-<<parameters.cache_key>>-<<parameters.chrome-version>>-{{ arch }}
- run:
command: |
#!/bin/bash
set -x
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
if [ -f "/tmp/chrome.tar.gz" ]; then
if uname -a | grep Darwin >/dev/null 2>&1; then
$SUDO tar -xzf /tmp/chrome.tar.gz -C /tmp
elif command -v apt-get >/dev/null 2>&1; then
$SUDO mkdir -p /opt/google/chrome
$SUDO tar -xzf /tmp/chrome.tar.gz -C /opt/google/chrome
$SUDO rm -rf /tmp/chrome.tar.gz
$SUDO ln -s /opt/google/chrome/google-chrome "/usr/bin/google-chrome-$ORB_PARAM_CHANNEL"
$SUDO ln -s "/usr/bin/google-chrome-$ORB_PARAM_CHANNEL" "/etc/alternatives/google-chrome"
$SUDO ln -s "/etc/alternatives/google-chrome" "/usr/bin/google-chrome"
else
echo "This system doesn't support cache for chrome"
$SUDO rm -rf /tmp/chrome.tar.gz
fi
fi
set +x
environment:
ORB_PARAM_CHANNEL: << parameters.channel >>
name: Process cache
- run:
command: |
#!/bin/bash
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
# process ORB_PARAM_CHROME_VERSION
PROCESSED_CHROME_VERSION=$(circleci env subst "$ORB_PARAM_CHROME_VERSION")
save_cache() {
echo "Saving cache"
if uname -a | grep Darwin >/dev/null 2>&1; then
$SUDO tar -czf /tmp/chrome.tar.gz -C "$CHROME_TEMP_DIR" googlechrome.pkg
elif command -v apt-get >/dev/null 2>&1; then
$SUDO tar -czf /tmp/chrome.tar.gz -C /opt/google/chrome .
else
echo "This system doesn't support cache for chrome"
fi
}
# installation check
if uname -a | grep Darwin >/dev/null 2>&1; then
if ls /Applications/*Google\ Chrome* >/dev/null 2>&1; then
if [[ "$PROCESSED_CHROME_VERSION" == "latest" ]]; then
LATEST_VERSION="$(curl -s 'https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Mac' | jq -r ' .[0] | .version ')"
target_version="$LATEST_VERSION"
else
target_version="$PROCESSED_CHROME_VERSION"
fi
installed_version="$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version)"
if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ] && [ "$installed_version" != "$target_version" ]; then
echo "$installed_version is currently installed; replacing it"
HOMEBREW_NO_AUTO_UPDATE=1 brew uninstall google-chrome >/dev/null 2>&1 || true
$SUDO rm -rf /Applications/Google\ Chrome.app >/dev/null 2>&1 || true
else
echo "$installed_version is already installed"
exit 0
fi
else
echo "Google Chrome is not currently installed; installing it"
fi
elif grep Alpine /etc/issue >/dev/null 2>&1; then
if command -v chromium-browser >/dev/null 2>&1; then
if [[ "$PROCESSED_CHROME_VERSION" == "latest" ]]; then
LATEST_VERSION="$(curl -s 'https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Linux' | jq -r ' .[0] | .version ')"
target_version="$LATEST_VERSION"
else
target_version="$PROCESSED_CHROME_VERSION"
fi
installed_version="$(chromium-browser --version)"
if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ] && [ "$installed_version" != "$target_version" ]; then
echo "$installed_version is currently installed; replacing it"
$SUDO apk del --force-broken-world chromium >/dev/null 2>&1 || true
$SUDO rm -f "$(command -v chromium-browser)" >/dev/null 2>&1 || true
else
echo "$installed_version is already installed to $(command -v chromium-browser)"
exit 0
fi
else
echo "Google Chrome (via Chromium) is not currently installed; installing it"
fi
elif command -v yum >/dev/null 2>&1; then
if command -v google-chrome >/dev/null 2>&1; then
if [[ "$PROCESSED_CHROME_VERSION" == "latest" ]]; then
LATEST_VERSION="$(curl -s 'https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Linux' | jq -r ' .[0] | .version ')"
target_version="$LATEST_VERSION"
else
target_version="$PROCESSED_CHROME_VERSION"
fi
installed_version="$(google-chrome --version)"
if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ] && [ "$installed_version" != "$target_version" ]; then
echo "$installed_version is currently installed; replacing it"
$SUDO yum remove -y google-chrome-stable >/dev/null 2>&1 || true
$SUDO rm -f "$(command -v google-chrome)" >/dev/null 2>&1 || true
else
echo "$installed_version is already installed to $(command -v google-chrome)"
exit 0
fi
else
echo "Google Chrome is not currently installed; installing it"
fi
else
if command -v google-chrome >/dev/null 2>&1; then
if [ "$ORB_PARAM_REPLACE_EXISTING" == "1" ]; then
echo "$(google-chrome --version)is currently installed; replacing it"
$SUDO apt-get -y --purge remove google-chrome-stable >/dev/null 2>&1 || true
$SUDO rm -f "$(command -v google-chrome)" >/dev/null 2>&1 || true
else
echo "$(google-chrome --version)is already installed to $(command -v google-chrome)"
exit 0
fi
else
echo "Google Chrome is not currently installed; installing it"
fi
fi
# install chrome
if uname -a | grep Darwin >/dev/null 2>&1; then
echo "Preparing Chrome installation for MacOS-based systems"
# Universal MacOS .pkg with license pre-accepted: https://support.google.com/chrome/a/answer/9915669?hl=en
CHROME_TEMP_DIR="$(mktemp -d)"
if [ "$ORB_PARAM_SAVE_CACHE" = 1 ] && [ -f "/tmp/googlechrome.pkg" ]; then
echo "Cache found."
cp /tmp/googlechrome.pkg "$CHROME_TEMP_DIR"
else
CHROME_MAC_URL="https://dl.google.com/chrome/mac/${ORB_PARAM_CHANNEL}/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg"
curl -L -o "$CHROME_TEMP_DIR/googlechrome.pkg" "$CHROME_MAC_URL"
fi
sudo /usr/sbin/installer -pkg "$CHROME_TEMP_DIR/googlechrome.pkg" -target /
if [ "$ORB_PARAM_SAVE_CACHE" = 1 ]; then
save_cache
fi
sudo rm -rf "$CHROME_TEMP_DIR"
echo '#!/usr/bin/env bash' >> google-chrome-$ORB_PARAM_CHANNEL
if [[ $ORB_PARAM_CHANNEL == "beta" ]]; then
xattr -rc "/Applications/Google Chrome Beta.app"
echo '/Applications/Google\ Chrome\ Beta.app/Contents/MacOS/Google\ Chrome\ Beta "$@"' >> google-chrome-$ORB_PARAM_CHANNEL
else
xattr -rc "/Applications/Google Chrome.app"
echo '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome "$@"' >> google-chrome-$ORB_PARAM_CHANNEL
fi
sudo mv google-chrome-$ORB_PARAM_CHANNEL /usr/local/bin/
sudo chmod +x /usr/local/bin/google-chrome-$ORB_PARAM_CHANNEL
# test/verify installation
if google-chrome-$ORB_PARAM_CHANNEL --version >/dev/null 2>&1; then
echo "$(google-chrome-$ORB_PARAM_CHANNEL --version)has been installed in the /Applications directory"
echo "A shortcut has also been created at $(command -v google-chrome)"
exit 0
else
echo "The latest release of Google Chrome (${ORB_PARAM_CHANNEL}) failed to install."
exit 1
fi
elif command -v yum >/dev/null 2>&1; then
echo "Preparing Chrome installation for RedHat-based systems"
# download chrome
if [[ "$PROCESSED_CHROME_VERSION" == "latest" ]]; then
CHROME_URL="https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm"
else
CHROME_URL="https://dl.google.com/linux/chrome/rpm/stable/x86_64/google-chrome-${ORB_PARAM_CHANNEL}-$PROCESSED_CHROME_VERSION-1.x86_64.rpm"
fi
curl --silent --show-error --location --fail --retry 3 \
--output google-chrome.rpm \
"$CHROME_URL"
curl --silent --show-error --location --fail --retry 3 \
--output liberation-fonts.rpm \
http://mirror.centos.org/centos/7/os/x86_64/Packages/liberation-fonts-1.07.2-16.el7.noarch.rpm
$SUDO yum localinstall -y liberation-fonts.rpm \
>/dev/null 2>&1
$SUDO yum localinstall -y google-chrome.rpm \
>/dev/null 2>&1
if [ "$ORB_PARAM_SAVE_CACHE" = 1 ]; then
save_cache
fi
rm -rf google-chrome.rpm liberation-fonts.rpm
else
# download chrome
echo "Preparing Chrome installation for Debian-based systems"
if [[ "$PROCESSED_CHROME_VERSION" == "latest" ]]; then
ENV_IS_ARM=$(! dpkg --print-architecture | grep -q arm; echo $?)
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | $SUDO apt-key add -
if [ "$ENV_IS_ARM" == "arm" ]; then
echo "Installing Chrome for ARM64"
$SUDO sh -c 'echo "deb [arch=arm64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
else
echo "Installing Chrome for AMD64"
$SUDO sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
fi
$SUDO apt-get update
DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y google-chrome-${ORB_PARAM_CHANNEL}
else
# Google does not keep older releases in their PPA, but they can be installed manually. HTTPS should be enough to secure the download.
$SUDO apt-get update
wget --no-verbose -O /tmp/chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${ORB_PARAM_CHROME_VERSION}-1_amd64.deb" \
&& $SUDO apt-get install -y apt-utils && $SUDO apt-get install -y /tmp/chrome.deb \
&& rm /tmp/chrome.deb
fi
if [ "$ORB_PARAM_SAVE_CACHE" = 1 ]; then
save_cache
fi
fi
TESTING_CHROME_VERSION=${PROCESSED_CHROME_VERSION::-2}
# test/verify installation
if [[ "$PROCESSED_CHROME_VERSION" != "latest" ]]; then
if google-chrome-$ORB_PARAM_CHANNEL --version | grep "$PROCESSED_CHROME_VERSION" >/dev/null 2>&1; then
:
elif google-chrome-$ORB_PARAM_CHANNEL --version | grep "$TESTING_CHROME_VERSION" >/dev/null 2>&1; then
:
else
echo "Google Chrome v${PROCESSED_CHROME_VERSION} (${ORB_PARAM_CHANNEL}) failed to install."
exit 1
fi
else
if google-chrome-$ORB_PARAM_CHANNEL --version >/dev/null 2>&1; then
:
else
echo "The latest release of Google Chrome (${ORB_PARAM_CHANNEL}) failed to install."
exit 1
fi
echo "$(google-chrome-$ORB_PARAM_CHANNEL --version) has been installed to $(command -v google-chrome-$ORB_PARAM_CHANNEL)"
echo "Chrome: $PROCESSED_CHROME_VERSION" >>"${HOME}/.browser-versions"
fi
environment:
ORB_PARAM_CHANNEL: << parameters.channel >>
ORB_PARAM_CHROME_VERSION: <<parameters.chrome-version>>
ORB_PARAM_REPLACE_EXISTING: <<parameters.replace-existing>>
ORB_PARAM_SAVE_CACHE: <<parameters.use_cache>>
name: Install Google Chrome
- when:
condition: <<parameters.use_cache>>
steps:
- save_cache:
key: chrome-<<parameters.cache_key>>-<<parameters.chrome-version>>-{{ arch }}
paths:
- /tmp/chrome.tar.gz
install-chromedriver:
description: |
Install Google's ChromeDriver WebDriver proxy, for use in browser testing with Chrome. A ChromeDriver version will be dynamically selected based on the installed version of Chrome; for details, see https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection Requirements: sed, curl, unzip
parameters:
install-dir:
default: /usr/local/bin
description: |
Directory in which to install ChromeDriver (directory selection not supported on Alpine Linux)
type: string
steps:
- run:
command: "#!/bin/bash\nif [[ $EUID == 0 ]]; then export SUDO=\"\"; else export SUDO=\"sudo\"; fi\n# determine_chrome_version\nif uname -a | grep Darwin >/dev/null 2>&1; then\n echo \"System detected as MacOS\"\n\n if [ -f \"/usr/local/bin/google-chrome-stable\" ]; then\n CHROME_VERSION=\"$(/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version)\"\n else\n CHROME_VERSION=\"$(/Applications/Google\\ Chrome\\ Beta.app/Contents/MacOS/Google\\ Chrome\\ Beta --version)\"\n fi\n\n if uname -a | grep arm64 >/dev/null 2>&1; then\n PLATFORM=mac-arm64\n else\n PLATFORM=mac-x64\n fi\n\n\nelif grep Alpine /etc/issue >/dev/null 2>&1; then\n apk update >/dev/null 2>&1 &&\n apk add --no-cache chromium-chromedriver >/dev/null\n\n # verify version\n echo \"$(chromedriver --version) has been installed to $(command -v chromedriver)\"\n\n exit 0\nelse\n CHROME_VERSION=\"$(google-chrome --version)\"\n PLATFORM=linux64\nfi\n\nCHROME_VERSION_STRING=\"$(echo \"$CHROME_VERSION\" | sed 's/.*Google Chrome //' | sed 's/.*Chromium //')\"\n# shellcheck disable=SC2001 \nCHROME_VERSION_MAJOR=\"$(echo \"$CHROME_VERSION_STRING\" | sed \"s/\\..*//\" )\"\necho \"Chrome version major is $CHROME_VERSION_MAJOR\"\n\n# print Chrome version\necho \"Installed version of Google Chrome is $CHROME_VERSION_STRING\"\n\n# determine chromedriver release\nCHROMEDRIVER_RELEASE=\"${CHROME_VERSION_STRING%%.*}\"\n\nCHROME_RELEASE=\"${CHROMEDRIVER_RELEASE}\"\n\nif [[ $CHROME_RELEASE -lt 70 ]]; then\n # https://sites.google.com/a/chromium.org/chromedriver/downloads\n # https://chromedriver.storage.googleapis.com/2.40/notes.txt\n\n case $CHROME_RELEASE in\n 69)\n CHROMEDRIVER_VERSION=\"2.44\"\n ;;\n 68)\n CHROMEDRIVER_VERSION=\"2.42\"\n ;;\n 67)\n CHROMEDRIVER_VERSION=\"2.41\"\n ;;\n 66)\n CHROMEDRIVER_VERSION=\"2.40\"\n ;;\n 65)\n CHROMEDRIVER_VERSION=\"2.38\"\n ;;\n 64)\n CHROMEDRIVER_VERSION=\"2.37\"\n ;;\n 63)\n CHROMEDRIVER_VERSION=\"2.36\"\n ;;\n 62)\n CHROMEDRIVER_VERSION=\"2.35\"\n ;;\n 61)\n CHROMEDRIVER_VERSION=\"2.34\"\n ;;\n 60)\n CHROMEDRIVER_VERSION=\"2.33\"\n ;;\n 59)\n CHROMEDRIVER_VERSION=\"2.32\"\n ;;\n 58)\n CHROMEDRIVER_VERSION=\"2.31\"\n ;;\n 57)\n CHROMEDRIVER_VERSION=\"2.29\"\n ;;\n 56)\n CHROMEDRIVER_VERSION=\"2.29\"\n ;;\n 55)\n CHROMEDRIVER_VERSION=\"2.28\"\n ;;\n 54)\n CHROMEDRIVER_VERSION=\"2.27\"\n ;;\n 53)\n CHROMEDRIVER_VERSION=\"2.26\"\n ;;\n 52)\n CHROMEDRIVER_VERSION=\"2.24\"\n ;;\n 51)\n CHROMEDRIVER_VERSION=\"2.23\"\n ;;\n 50)\n CHROMEDRIVER_VERSION=\"2.22\"\n ;;\n 49)\n CHROMEDRIVER_VERSION=\"2.22\"\n ;;\n 48)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 47)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 46)\n CHROMEDRIVER_VERSION=\"2.21\"\n ;;\n 45)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n 44)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n 43)\n CHROMEDRIVER_VERSION=\"2.20\"\n ;;\n *)\n echo \"Sorry, Google Chrome/Chromium version 43 or newer is required to use ChromeDriver\"\n exit 1\n ;;\n esac\nelif [[ $CHROME_RELEASE -lt 115 ]]; then\n CHROMEDRIVER_VERSION=$(curl --silent --show-error --location --fail --retry 3 \\\n \"https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROMEDRIVER_RELEASE\")\nelse\n # shellcheck disable=SC2001\n CHROMEDRIVER_VERSION=$(echo $CHROME_VERSION | sed 's/[^0-9.]//g')\nfi\n\n# installation check\nif command -v chromedriver >/dev/null 2>&1; then\n if chromedriver --version | grep \"$CHROMEDRIVER_VERSION\" >/dev/null 2>&1; then\n echo \"ChromeDriver $CHROMEDRIVER_VERSION is already installed\"\n exit 0\n else\n echo \"A different version of ChromeDriver is installed ($(chromedriver --version)); removing it\"\n $SUDO rm -f \"$(command -v chromedriver)\"\n fi\nfi\n\n# download chromedriver\nif [[ $CHROME_RELEASE -lt 115 ]]; then\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_$PLATFORM.zip\"\nelse \n MATCHING_CHROMEDRIVER_DOWNLOAD_URL=$(curl --silent https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json | jq --raw-output --arg chromeDriverVersion $CHROMEDRIVER_VERSION --arg platform $PLATFORM '.versions[] | select(.version==\"\\($chromeDriverVersion)\") | .downloads.chromedriver[] | select(.platform==\"\\($platform)\") | .url')\n if [ -z \"${MATCHING_CHROMEDRIVER_DOWNLOAD_URL}\" ]; then\n echo \"Matching Chrome Driver Version URL is empty, falling back to first matching major version.\"\n CHROMEDRIVER_VERSION=$( curl https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone.json | jq \".milestones.\\\"$CHROME_VERSION_MAJOR\\\".version\" | sed 's/\\\"//g')\n CHROMEDRIVER_DOWNLOAD_URL=$(curl https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json | jq --raw-output --arg chromeVersion $CHROME_VERSION_MAJOR --arg platform $PLATFORM '.milestones.\"\\($chromeVersion)\".downloads.chromedriver[] | select(.platform==\"\\($platform)\") | .url')\n echo \"New ChromeDriver version to be installed: $CHROMEDRIVER_VERSION\"\n else\n CHROMEDRIVER_DOWNLOAD_URL=$MATCHING_CHROMEDRIVER_DOWNLOAD_URL\n fi\n echo \"$CHROMEDRIVER_VERSION will be installed\"\n\n curl --silent --show-error --location --fail --retry 3 \\\n --output chromedriver_$PLATFORM.zip \\\n \"$CHROMEDRIVER_DOWNLOAD_URL\"\nfi\n\n# setup chromedriver installation\nif command -v yum >/dev/null 2>&1; then\n yum install -y unzip >/dev/null 2>&1\nfi\n\nunzip \"chromedriver_$PLATFORM.zip\" >/dev/null 2>&1\nrm -rf \"chromedriver_$PLATFORM.zip\"\n\nif [[ $CHROME_RELEASE -gt 114 ]]; then\n mv \"chromedriver-$PLATFORM\" chromedriver\n $SUDO mv chromedriver/chromedriver \"$ORB_PARAM_DRIVER_INSTALL_DIR\"\n rm -rf \"chromedriver\"\nelse\n $SUDO mv chromedriver \"$ORB_PARAM_DRIVER_INSTALL_DIR\"\nfi\n\n\n$SUDO chmod +x \"$ORB_PARAM_DRIVER_INSTALL_DIR/chromedriver\" \n\n\n# test/verify version\n if chromedriver --version | grep \"$CHROMEDRIVER_VERSION\" >/dev/null 2>&1; then\n echo \"$(chromedriver --version) has been installed to $(command -v chromedriver)\"\n readonly base_dir=\"${CIRCLE_WORKING_DIRECTORY/\\~/$HOME}\"\n rm -f \"${base_dir}/LICENSE.chromedriver\"\n else\n echo \"Something went wrong; ChromeDriver could not be installed\"\n exit 1\n fi\n"
environment:
ORB_PARAM_DRIVER_INSTALL_DIR: <<parameters.install-dir>>
name: Install ChromeDriver
install-firefox:
description: |
Install Mozilla's Firefox browser, for use in browser testing. Requires apt-get, gpg, curl, sha256sum, tar, jq
parameters:
cache_key:
default: v1
description: |
Cache key to save chrome.
Defaults to v1.
type: string
install-dir:
default: /usr/local/bin
description: |
Directory in which to install Firefox
type: string
use_cache:
default: false
description: |
Install firefox using a cached version of the installer.
Using this option will increase costs and does not improve times considerable, use only if having problems with download.
Defaults to false.
type: boolean
version:
default: latest
description: |
Version of Firefox to install, defaults to the latest stable release. To install an older release, specify a full semantic version number, ESR or otherwise, e.g., 66.0.3, 52.0.1esr, 53.0, etc.
type: string
steps:
- when:
condition: <<parameters.use_cache>>
steps:
- restore_cache:
keys:
- firefox-<<parameters.cache_key>>-<<parameters.version>>-{{ arch }}
- run:
command: |
#!/bin/bash
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
# FUNCTIONS
grab_firefox_version() {
if [[ "$ORB_PARAM_FIREFOX_VERSION" == "latest" ]]; then
# extract latest version from mozilla product details API
FIREFOX_VERSION_STRING=$(curl \
https://product-details.mozilla.org/1.0/firefox_versions.json |
jq '.LATEST_FIREFOX_VERSION')
# strip leading/trailing "
temp="${FIREFOX_VERSION_STRING%\"}"
FIREFOX_VERSION="${temp#\"}"
echo "Latest stable version of Firefox is $FIREFOX_VERSION"
else
FIREFOX_VERSION="$ORB_PARAM_FIREFOX_VERSION"
echo "Selected version of Firefox is $FIREFOX_VERSION"
fi
# create Firefox download URL base
FIREFOX_URL_BASE="https://archive.mozilla.org/pub/firefox/releases/$FIREFOX_VERSION"
}
installation_check() {
if command -v firefox >/dev/null 2>&1; then
if firefox --version | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then
echo "firefox $FIREFOX_VERSION is already installed"
exit 0
else
echo "A different version of Firefox is installed ($(firefox --version)); removing it"
$SUDO rm -f "$(command -v firefox)"
fi
fi
}
# mac: setup version, install packages, then continue
if uname -a | grep Darwin >/dev/null 2>&1; then
echo "System detected as MacOS"
grab_firefox_version
installation_check
HOMEBREW_NO_AUTO_UPDATE=1 brew install gnupg coreutils >/dev/null 2>&1
# deb/ubuntu/other linux: setup version, install packages, then continue
else
echo "System detected as Linux"
grab_firefox_version
installation_check
if command -v yum >/dev/null 2>&1; then
$SUDO yum install -y \
alsa-lib \
bzip2 \
dbus-glib-devel \
gtk2-devel \
gtk3-devel \
libXt-devel \
perl \
which \
>/dev/null 2>&1
else
$SUDO apt-get update >/dev/null 2>&1 &&
$SUDO apt-get install -y \
libasound-dev \
libxt6 \
libgtk-3-dev \
libdbus-glib-1-2 \
>/dev/null 2>&1
fi
fi
# import public key
curl --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/KEY" | gpg --import >/dev/null 2>&1
# download shasums
curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA256SUMS.asc" || curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA512SUMS.asc"
curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA256SUMS" || curl -O --silent --show-error --location --fail --retry 3 "$FIREFOX_URL_BASE/SHA512SUMS"
# verify shasums
gpg --verify SHA256SUMS.asc SHA256SUMS || gpg --verify SHA512SUMS.asc SHA512SUMS
rm -f SHA256SUMS.asc || rm -f SHA512SUMS.asc
FIREFOX_MAJOR_VERSION=$(echo "$FIREFOX_VERSION" | awk -F. '{print $1}')
# setup firefox download
if uname -a | grep Darwin >/dev/null 2>&1; then
FIREFOX_FILE="Firefox%20$FIREFOX_VERSION"
PLATFORM=mac
FILE_EXT=dmg
else
FIREFOX_FILE="firefox-$FIREFOX_VERSION"
PLATFORM=linux-x86_64
if [ "$FIREFOX_MAJOR_VERSION" -ge 135 ]; then
FILE_EXT=tar.xz
else
FILE_EXT=tar.bz2
fi
fi
FIREFOX_FILE_LOCATION="$PLATFORM/en-US/$FIREFOX_FILE"
FIREFOX_FILE_NAME="$PLATFORM-en-US-$FIREFOX_FILE"
if [ "$ORB_PARAM_SAVE_CACHE" = 1 ] && [ -f "/tmp/firefox" ]; then
echo "Cache found."
mv /tmp/firefox "$FIREFOX_FILE_NAME.$FILE_EXT"
else
# download firefox
echo "Downloading firefox"
curl --silent --show-error --location --fail --retry 3 \
--output "$FIREFOX_FILE_NAME.$FILE_EXT" \
"$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT"
fi
if [ "$ORB_PARAM_SAVE_CACHE" = 1 ]; then
cp "$FIREFOX_FILE_NAME.$FILE_EXT" /tmp/firefox
fi
if uname -a | grep Darwin >/dev/null 2>&1; then
echo "No PGP data for macOS Firefox releases; skipping PGP verification"
perl -i -pe "s&mac/en-US/Firefox $FIREFOX_VERSION&mac-en-US-Firefox%20$FIREFOX_VERSION&g" SHA256SUMS
perl -i -pe "s&mac/en-US/Firefox $FIREFOX_VERSION&mac-en-US-Firefox%20$FIREFOX_VERSION&g" SHA512SUMS
else
# only do this step if .asc file exists for this version
if [[ $(curl --silent --location --fail --retry 3 \
"$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT.asc") ]]; then
curl --silent --show-error --location --fail --retry 3 \
--output "$FIREFOX_FILE_NAME.$FILE_EXT.asc" \
"$FIREFOX_URL_BASE/$FIREFOX_FILE_LOCATION.$FILE_EXT.asc"
# verify download archive
gpg --verify "$FIREFOX_FILE_NAME.$FILE_EXT.asc" "$FIREFOX_FILE_NAME.$FILE_EXT"
rm -f "$FIREFOX_FILE_NAME.$FILE_EXT.asc"
fi
perl -i -pe "s%linux-x86_64/en-US/firefox%linux-x86_64-en-US-firefox%g" SHA256SUMS
perl -i -pe "s%linux-x86_64/en-US/firefox%linux-x86_64-en-US-firefox%g" SHA512SUMS
fi
grep "$FIREFOX_FILE_NAME.$FILE_EXT" SHA256SUMS | sha256sum -c - ||
grep "$FIREFOX_FILE_NAME.$FILE_EXT" SHA512SUMS | sha512sum -c -
rm -f SHA256SUMS || rm -f SHA512SUMS
# setup firefox installation
if uname -a | grep Darwin >/dev/null 2>&1; then
hdiutil attach "$FIREFOX_FILE_NAME.$FILE_EXT" >/dev/null 2>&1
$SUDO cp -R /Volumes/Firefox/Firefox.app /Applications
hdiutil eject /Volumes/Firefox >/dev/null 2>&1
$SUDO rm -f "$FIREFOX_FILE_NAME.$FILE_EXT"
echo -e "#\!/bin/bash\n" >firefox
perl -i -pe "s|#\\\|#|g" firefox
echo -e "/Applications/Firefox.app/Contents/MacOS/firefox \"\$@\"" >>firefox
$SUDO mv firefox "$ORB_PARAM_FIREFOX_INSTALL_DIR"
$SUDO chmod +x "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox"
# test/verify version
if firefox --version | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then
echo "$(firefox --version) has been installed in the /Applications directory"
echo "A shortcut has also been created at $(command -v firefox)"
else
echo "Something went wrong; the specified version of Firefox could not be installed"
exit 1
fi
else
if [ "$FIREFOX_MAJOR_VERSION" -ge 135 ]; then
$SUDO tar -xJf "$FIREFOX_FILE_NAME.$FILE_EXT"
else
$SUDO tar -xjf "$FIREFOX_FILE_NAME.$FILE_EXT"
fi
$SUDO rm -f "$FIREFOX_FILE_NAME.$FILE_EXT"
$SUDO mv firefox "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION"
$SUDO chmod +x "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION/firefox"
$SUDO ln -s "$ORB_PARAM_FIREFOX_INSTALL_DIR/firefox-$FIREFOX_VERSION/firefox" /usr/local/bin/firefox
# test/verify version
if echo "$(firefox --version)esr" | grep "$FIREFOX_VERSION" >/dev/null 2>&1; then
echo "$(firefox --version) has been installed to $(command -v firefox)"
else
echo "Something went wrong; the specified version of Firefox could not be installed"
exit 1
fi
fi
environment:
ORB_PARAM_FIREFOX_INSTALL_DIR: <<parameters.install-dir>>
ORB_PARAM_FIREFOX_VERSION: <<parameters.version>>
ORB_PARAM_SAVE_CACHE: <<parameters.use_cache>>
name: Install Firefox
- when:
condition: <<parameters.use_cache>>
steps:
- save_cache:
key: firefox-<<parameters.cache_key>>-<<parameters.version>>-{{ arch }}
paths:
- /tmp/firefox
install-geckodriver:
description: |
Install Mozilla's Geckodriver WebDriver proxy, for use in browser testing with Firefox. Requirements: curl, tar
parameters:
install-dir:
default: /usr/local/bin
description: |
Directory in which to install Geckodriver
type: string
version:
default: latest
description: |
Version of Geckodriver to install, defaults to latest release. To install an older release, specify a full semantic version tag, e.g., `v0.23.0`. For a list of releases, and a Firefox/Geckodriver version compatibility table, see the following links: https://github.com/mozilla/geckodriver/releases https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html
type: string
steps:
- run:
command: |
#!/bin/bash
if [[ $EUID == 0 ]]; then export SUDO=""; else export SUDO="sudo"; fi
# FUNCTIONS
grab_geckodriver_version() {
if [[ "$ORB_PARAM_GECKO_VERSION" == "latest" ]]; then
# extract latest version from github releases API
GECKODRIVER_VERSION_STRING=$(curl -Ls -o /dev/null -w "%{url_effective}\n" "https://github.com/mozilla/geckodriver/releases/latest" | sed 's:.*/::')
# strip leading/trailing "
temp="${GECKODRIVER_VERSION_STRING%\"}"
GECKODRIVER_VERSION="${temp#\"}"
else
GECKODRIVER_VERSION="$ORB_PARAM_GECKO_VERSION"
fi
echo "Selected version of Geckodriver is: $GECKODRIVER_VERSION"
}
installation_check() {
if command -v geckodriver >>/dev/null 2>&1; then
if geckodriver --version | grep "$GECKODRIVER_VERSION" >>/dev/null 2>&1; then
echo "Geckodriver $GECKODRIVER_VERSION is already installed"
exit 0
else
echo "A different version of Geckodriver is installed ($(geckodriver --version)); removing it"
$SUDO rm -rf "$(command -v geckodriver)"
fi
else
echo "Geckodriver is not currently installed; installing it"
fi
}
grab_geckodriver_version
installation_check
if uname -a | grep Darwin >>/dev/null 2>&1; then
PLATFORM=macos-aarch64
else
PLATFORM=linux64
fi
# get download URL
GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz"
# download geckodriver
$SUDO curl --silent --show-error --location --fail --retry 3 --output "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz" "$GECKODRIVER_URL"
# setup geckodriver installation
$SUDO tar xf "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz"
$SUDO rm -rf "geckodriver-$GECKODRIVER_VERSION-$PLATFORM.tar.gz"
$SUDO mv geckodriver "$ORB_PARAM_GECKO_INSTALL_DIR"
$SUDO chmod +x "$ORB_PARAM_GECKO_INSTALL_DIR/geckodriver"
# verify version
echo "Geckodriver has been installed to $(command -v geckodriver)"
geckodriver --version
# test/verify version
GECKODRIVER_VERSION_NUM="$(echo "$GECKODRIVER_VERSION" | sed -E 's/v//')"
if geckodriver --version | grep "$GECKODRIVER_VERSION_NUM" >/dev/null 2>&1; then
echo "$(geckodriver --version) has been installed to $(command -v geckodriver)"
else
echo "Something went wrong; the specified version of Geckodriver could not be installed"
exit 1
fi
environment:
ORB_PARAM_GECKO_INSTALL_DIR: <<parameters.install-dir>>
ORB_PARAM_GECKO_VERSION: <<parameters.version>>
name: Install Geckodriver
examples:
install_browsers:
description: |
Install all available browsers and browser drivers. Includes Chrome, FireFox, ChromeDriver and GeckoDriver. Use the node variant
usage:
version: "2.1"
orbs:
browser-tools: circleci/browser-tools@x.y
jobs:
test:
docker:
- image: cimg/node:20.4.0-browsers
steps:
- browser-tools/install-browser-tools
workflows: null
install_chrome:
description: |
Install Google's Chrome browser and ChromeDriver in the node variant image
usage:
version: "2.1"
orbs:
browser-tools: circleci/browser-tools@x.y
jobs:
test:
docker:
- image: cimg/node:20.4.0-browsers
steps:
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- run:
command: |
google-chrome --version
chromedriver --version
name: Check install
workflows: null
install_versioned_browsers:
description: |
Install specific versions of firefox and chrome in the base variant image.
usage:
version: "2.1"
orbs:
browser-tools: circleci/browser-tools@x.y
jobs:
test:
executor: browser-tools/default
steps:
- browser-tools/install-browser-tools:
chrome-version: 85.0.4183.102
firefox-version: 80.0.1
- run:
command: |
google-chrome --version
firefox --version
geckodriver --version
chromedriver --version
java -jar /usr/local/bin/selenium.jar --version
name: Check install
workflows: null