Skip to content

Commit 8c8edc5

Browse files
author
Thomas Cesare-Herriau
committed
Updated Readme and script for SauceLabs testing
Change-Id: I19b12a4aa5da38c9d8a12438b167ea40c4967f46
1 parent 8fab29f commit 8c8edc5

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,32 @@ Then, all unit tests can be run at: http://localhost:4000/buildtools/all_tests.h
662662
You can also run tests individually by accessing each HTML file under
663663
`generated/tests`, for example: http://localhost:4000/generated/tests/javascript/widgets/authui_test.html
664664

665+
### Run tests using SauceLabs
666+
667+
*You need a [SauceLabs](https://saucelabs.com/) account to run tests on
668+
SauceLabs.*
669+
670+
Go to your SauceLab account, under "My Account", and copy paste the access key.
671+
Now export the following variables, *in two Terminal windows*:
672+
673+
```bash
674+
export SAUCE_USERNAME=<your username>
675+
export SAUCE_ACCESS_KEY=<the copy pasted access key>
676+
```
677+
678+
Then, in one Terminal window, start SauceConnect:
679+
680+
```bash
681+
./buildtools/sauce_connect.sh
682+
```
683+
684+
Take note of the "Tunnel Identifier" value logged in the terminal,at the top. In
685+
the other terminal that has the exported variables, run the tests:
686+
687+
```bash
688+
npm test -- --saucelabs --tunnelIdentifier=<the tunnel identifier>
689+
```
690+
665691
## Known issues
666692

667693
### Firebase Auth does not work in Safari private browsing

buildtools/sauce_connect.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ trap removeFiles EXIT
4848

4949
# This will be used by Protractor to connect to SauceConnect.
5050
TUNNEL_IDENTIFIER="tunnelId-$RANDOM"
51-
echo "Tunnel Identifier: $TUNNEL_IDENTIFIER"
51+
echo ""
52+
echo "========================================================================="
53+
echo " Tunnel Identifier to pass to Protractor:"
54+
echo " $TUNNEL_IDENTIFIER"
55+
echo "========================================================================="
56+
echo ""
57+
echo ""
5258

5359
echo "Starting Sauce Connect..."
5460

protractor.conf.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* $ ./buildtools/sauce_connect.sh
3333
* Take note of the "Tunnel Identifier" value logged in the terminal.
3434
* Run the tests:
35-
* $ npm run -- --saucelabs --tunnelIdentifier=<the tunnel identifier>
35+
* $ npm test -- --saucelabs --tunnelIdentifier=<the tunnel identifier>
3636
* This will start the HTTP Server locally, and connect through SauceConnect
3737
* to SauceLabs remote browsers instances.
3838
*
@@ -83,6 +83,10 @@ if (options.saucelabs) {
8383
// SauceLabs configuration.
8484
config.sauceUser = process.env.SAUCE_USERNAME;
8585
config.sauceKey = process.env.SAUCE_ACCESS_KEY;
86+
if (!config.sauceKey || !config.sauceUser) {
87+
throw 'The SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables have '+
88+
' to be set.';
89+
}
8690
// Avoid going over the SauceLabs concurrency limit (5).
8791
config.maxSessions = 5;
8892
// List of browsers configurations tested.

0 commit comments

Comments
 (0)