From 917a3828d874a8b215c9294c317701050710e1b7 Mon Sep 17 00:00:00 2001 From: Aakash Hotchandani Date: Fri, 17 Jul 2026 11:36:08 +0530 Subject: [PATCH] fix(util): recognize *.bsstag.com hosts as BrowserStack (internal staging) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getCloudProvider() and isBrowserstackInfra() only matched *.browserstack.com, so a session run against an internal staging hub (e.g. hub-.bsstag.com, used by the SDK's BROWSERSTACK_STAGING_ENV config-server override) was treated as a non-BrowserStack grid — which disables the accessibility scan, session status/naming, and app-automate handling. Recognize .bsstag.com hosts too, in both host checks. Mirrors browserstack-javaagent PR #2010's isBrowserstackHubUrl fix. Validated: full green wdio App-Automate run against a staging env with the App A11y hook-scan executing and results polled from the staging app-accessibility host. Co-Authored-By: Claude Opus 4.8 (1M context) --- packages/browserstack-service/src/util.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/browserstack-service/src/util.ts b/packages/browserstack-service/src/util.ts index 136eebd..733df38 100644 --- a/packages/browserstack-service/src/util.ts +++ b/packages/browserstack-service/src/util.ts @@ -1064,11 +1064,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' @@ -1177,7 +1177,7 @@ export function isBrowserstackInfra(config: BrowserstackConfig & Options.Testrun // In case hostname is not present anywhere in the config, it returns true by default as hostname is not a mandatory parameter in the config const isBrowserstack = (str: string ): boolean => { - return str === 'browserstack.com' || str.endsWith('.browserstack.com') + return str === 'browserstack.com' || str.endsWith('.browserstack.com') || str.endsWith('.bsstag.com') } if ((config.hostname) && !isBrowserstack(config.hostname)) {