Skip to content

Commit aa834da

Browse files
committed
only use password when using custom remote
1 parent 24deb28 commit aa834da

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

test/UITest.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,17 @@ const REMOTE_URL = (async () => {
4545
console.log('Using browserstack remote');
4646
return 'http://hub-cloud.browserstack.com/wd/hub';
4747
})();
48-
const REMOTE_PW = (() => {
48+
const REMOTE_PW = (async () => {
4949
if (hasSetting('remote-pw')) {
5050
return getSetting('remote-pw');
5151
}
52-
if (process.env.REMOTE_PW) {
53-
console.log('Using custom remote PW');
54-
return process.env.REMOTE_PW;
55-
}
56-
return 'PW';
52+
if (process.env.REMOTE_PW &&
53+
process.env.REMOTE_URL &&
54+
await ping(process.env.REMOTE_URL)) {
55+
console.log('Using custom remote PW');
56+
return process.env.REMOTE_PW;
57+
}
58+
return undefined;
5759
})();
5860

5961
const SKIP_ENTRYPOINTS = hasSetting('skip-entrypoints');
@@ -419,7 +421,6 @@ before('Driver connect', async function() {
419421
await tryReadManifest('app/manifest.json') ||
420422
await tryReadManifest('app/manifest.chrome.json')
421423
).version} - ${await getGitHash()}`,
422-
pw: REMOTE_PW,
423424
name: (() => {
424425
if (process.env.TRAVIS) {
425426
// Travis
@@ -433,7 +434,9 @@ before('Driver connect', async function() {
433434
}`
434435
})(),
435436
'browserstack.local': !TEST_EXTENSION
436-
}}).merge(additionalCapabilities));
437+
}, ...(await REMOTE_PW) ? {
438+
pw: await REMOTE_PW,
439+
} : {}}).merge(additionalCapabilities));
437440
if (TEST_LOCAL) {
438441
driver = unBuilt.forBrowser('chrome').build();
439442
} else {

0 commit comments

Comments
 (0)