Skip to content

Commit

Permalink
Fix support for BrowserStack TurboScale in Nightwatch.
Browse files Browse the repository at this point in the history
  • Loading branch information
garg3133 committed Dec 20, 2024
1 parent 715a751 commit 2760a1d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/transport/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ module.exports = class TransportFactory {
}
}

static usingBrowserstackTurboScale(settings) {
return settings.webdriver.host && (settings.webdriver.host.endsWith('.browserstack-ats.com') || settings.webdriver.host.startsWith('browserstack-turboscale-grid'));
}

static usingBrowserstack(settings) {
return settings.webdriver.host && (settings.webdriver.host.endsWith('.browserstack.com') || settings.webdriver.host.endsWith('.browserstack-ats.com') || settings.webdriver.host.startsWith('browserstack-turboscale-grid'));
return settings.webdriver.host && (settings.webdriver.host.endsWith('.browserstack.com') || TransportFactory.usingBrowserstackTurboScale(settings));
}

static getBrowserName(nightwatchInstance) {
Expand Down Expand Up @@ -124,6 +128,12 @@ module.exports = class TransportFactory {
return new AppAutomate(nightwatchInstance, browserName);
}

if (TransportFactory.usingBrowserstackTurboScale(nightwatchInstance.settings)) {
const AutomateTurboScale = require('./selenium-webdriver/browserstack/automateTurboScale.js');

return new AutomateTurboScale(nightwatchInstance, browserName);
}

const Automate = require('./selenium-webdriver/browserstack/automate.js');

return new Automate(nightwatchInstance, browserName);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const Automate = require('./automate.js');

class AutomateTurboScale extends Automate {
get productNamespace() {
return 'automate-turboscale/v1';
}
}

module.exports = AutomateTurboScale;

0 comments on commit 2760a1d

Please sign in to comment.