diff --git a/.changeset/sdk-6948-v8-bsstag-host-recognition.md b/.changeset/sdk-6948-v8-bsstag-host-recognition.md new file mode 100644 index 0000000..a3d41ce --- /dev/null +++ b/.changeset/sdk-6948-v8-bsstag-host-recognition.md @@ -0,0 +1,7 @@ +--- +"@wdio/browserstack-service": patch +--- + +fix(util): recognize `*.bsstag.com` hosts as BrowserStack (internal staging, SDK-6948) + +`getCloudProvider` and `isBrowserstackInfra` only matched `browserstack.com`, so a session pointed at an internal staging env (`*.bsstag.com`) was classified as non-BrowserStack — the service then skipped its instrumentation and GRR host rewriting, and the WebDriver hub stayed on production. Recognize `bsstag` / `.bsstag.com` in both guards. Ports the main/v9 fix (#56/#65) to the v8 line. diff --git a/packages/browserstack-service/src/util.ts b/packages/browserstack-service/src/util.ts index 11e1bdd..30a1c3f 100644 --- a/packages/browserstack-service/src/util.ts +++ b/packages/browserstack-service/src/util.ts @@ -1034,11 +1034,11 @@ export function getCloudProvider(browser: WebdriverIO.Browser | WebdriverIO.Mult // Loop through all instances for (const instanceName of browser.instances) { const instance = (browser as any)[instanceName] as WebdriverIO.Browser - if (instance.options && instance.options.hostname && instance.options.hostname.includes('browserstack')) { + if (instance.options && instance.options.hostname && (instance.options.hostname.includes('browserstack') || instance.options.hostname.includes('bsstag'))) { return 'browserstack' } } - } else if (browser.options && browser.options.hostname && browser.options.hostname.includes('browserstack')) { // Single browser instance + } else if (browser.options && browser.options.hostname && (browser.options.hostname.includes('browserstack') || browser.options.hostname.includes('bsstag'))) { // Single browser instance return 'browserstack' } return 'unknown_grid' @@ -1168,7 +1168,7 @@ export function isBrowserstackInfra(config: BrowserstackConfig & Options.Testrun // a utility function to check if the hostname is browserstack const isBrowserstack = (str: string ): boolean => { - return str.includes('browserstack.com') + return str.includes('browserstack.com') || str.includes('bsstag.com') } if ((config.hostname) && !isBrowserstack(config.hostname)) {