From 56cb6d886613110b2a7ae13c4a255f87857d1e82 Mon Sep 17 00:00:00 2001 From: Reetesh Ranjan Date: Sat, 29 Apr 2017 16:18:20 +0530 Subject: [PATCH 1/2] Support for localIdentifier setting/capability As described in https://docs.travis-ci.com/user/browserstack/ and https://www.browserstack.com/automate/travisci, when using Selenium there is a identifier associated with each local connection created, and it is provided in the environment variable BROWSERSTACK_LOCAL_IDENTIFIER and must be included in the settings. The change in this commit takes the ruby selenium webdriver example described in above links, and provides the same steps for this testem browserstack integration. --- scripts/browserstack.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/browserstack.js b/scripts/browserstack.js index e3b3b84..47a9d7a 100755 --- a/scripts/browserstack.js +++ b/scripts/browserstack.js @@ -37,6 +37,10 @@ var settings = { build: 'testem-browserstack' }; +if (process.env.BROWSERSTACK_LOCAL_IDENTIFIER) { + settings['browserstack.localIdentifier'] = process.env.BROWSERSTACK_LOCAL_IDENTIFIER +} + for (var i in settings) { if (settings[i] === null || settings[i] === '' || settings[i] === 'nil') { delete settings[i]; From 0948a79d0e97fb4cfd0c1a1229d7fd6bdbacd97f Mon Sep 17 00:00:00 2001 From: Reetesh Ranjan Date: Sat, 29 Apr 2017 16:28:52 +0530 Subject: [PATCH 2/2] Avoid testem browser start timeout Testem has a default browser start timeout of 30 seconds, which hits few times while trying to run BrowserStack tests using testem. The default setting is being overridden with a timeout of 600 (10 minutes) which should avoid this in most cases. The error message that pops up when this timeout occurs is the following: "Browser failed to connect within 30s. testem.js not loaded?" --- testem.json | 1 + 1 file changed, 1 insertion(+) diff --git a/testem.json b/testem.json index fb5efd3..4650ede 100644 --- a/testem.json +++ b/testem.json @@ -4,6 +4,7 @@ "framework": "jasmine", "parallel": 4, + "browser_start_timeout" : 600, "on_start": { "command": "kill -9 $(ps -A | grep BrowserStackLocal | grep -v grep | cut -d ' ' -f2); ./scripts/browserstack-local.js &",