Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/browserstack-service/src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class BStackCleanup {
await finalizeOrphanedRuns()
const result = await stopBuildUpstream()
if ((process.env[BROWSERSTACK_OBSERVABILITY]) && process.env[BROWSERSTACK_TESTHUB_UUID]) {
BStackLogger.info(`\nVisit https://automation.browserstack.com/builds/${process.env[BROWSERSTACK_TESTHUB_UUID]} to view build report, insights, and many more debugging information all at one place!\n`)
BStackLogger.info(`\nVisit https://automation-rengg-lts.bsstag.com/builds/${process.env[BROWSERSTACK_TESTHUB_UUID]} to view build report, insights, and many more debugging information all at one place!\n`)
}
const status = (result && result.status) || 'failed'
const message = (result && result.message)
Expand Down
66 changes: 46 additions & 20 deletions packages/browserstack-service/src/cli/apiUtils.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,51 @@
export default class APIUtils {
static FUNNEL_INSTRUMENTATION_URL = 'https://api.browserstack.com/sdk/v1/event'
static BROWSERSTACK_AUTOMATE_API_URL = 'https://api.browserstack.com'
static BROWSERSTACK_AA_API_URL = 'https://api.browserstack.com'
static BROWSERSTACK_PERCY_API_URL = 'https://api.browserstack.com'
static BROWSERSTACK_AUTOMATE_API_CLOUD_URL = 'https://api-cloud.browserstack.com'
static BROWSERSTACK_AA_API_CLOUD_URL = 'https://api-cloud.browserstack.com'
static APP_ALLY_ENDPOINT = 'https://app-accessibility.browserstack.com/automate'
static DATA_ENDPOINT = 'https://collector-observability.browserstack.com'
static UPLOAD_LOGS_ADDRESS = 'https://upload-observability.browserstack.com'
static EDS_URL = 'https://eds.browserstack.com'
static FUNNEL_INSTRUMENTATION_URL = 'https://apirengg-lts.bsstag.com/sdk/v1/event'
static BROWSERSTACK_AUTOMATE_API_URL = 'https://apirengg-lts.bsstag.com'
static BROWSERSTACK_AA_API_URL = 'https://apirengg-lts.bsstag.com'
static BROWSERSTACK_PERCY_API_URL = 'https://apirengg-lts.bsstag.com'
static BROWSERSTACK_AUTOMATE_API_CLOUD_URL = 'https://api-cloud-rengg-lts.bsstag.com'
static BROWSERSTACK_AA_API_CLOUD_URL = 'https://api-cloud-rengg-lts.bsstag.com'
static APP_ALLY_ENDPOINT = 'https://app-accessibility-rengg-lts.bsstag.com/automate'
static DATA_ENDPOINT = 'https://collector-testhub-rengg-lts-external.bsstag.com'
static UPLOAD_LOGS_ADDRESS = 'https://upload-observability-rengg-lts-ssi.bsstag.com'
static EDS_URL = 'https://edsstaging.bsstag.com'

static updateURLSForGRR(apis: GRRUrls) {
this.FUNNEL_INSTRUMENTATION_URL = `${apis.automate.api}/sdk/v1/event`
this.BROWSERSTACK_AUTOMATE_API_URL = apis.automate.api
this.BROWSERSTACK_AA_API_URL = apis.appAutomate.api
this.BROWSERSTACK_PERCY_API_URL = apis.percy.api
this.BROWSERSTACK_AUTOMATE_API_CLOUD_URL = apis.automate.upload
this.BROWSERSTACK_AA_API_CLOUD_URL = apis.appAutomate.upload
this.APP_ALLY_ENDPOINT = `${apis.appAccessibility.api}/automate`
this.DATA_ENDPOINT = apis.observability.api
this.UPLOAD_LOGS_ADDRESS = apis.observability.upload
this.EDS_URL = apis.edsInstrumentation.api
// Per-field null-guard: the reg CLI binary (browserstack/browserstack-binary
// LTS-daily-reg-binary)'s StartBinSession response doesn't include the
// full apis schema this method expects. Without guards it throws
// "Cannot read properties of undefined (reading 'automate' | 'appAutomate'
// | 'percy' | 'appAccessibility' | 'observability' | 'edsInstrumentation')"
// and bootstrap fails, no build is created, no BTCER row lands.
// Fall back to the baked-in reg URLs (top of file) for any missing subtree.
// Prod's CLI binary returns the full schema — every guard falls through.
if (apis?.automate?.api) {
this.FUNNEL_INSTRUMENTATION_URL = `${apis.automate.api}/sdk/v1/event`
this.BROWSERSTACK_AUTOMATE_API_URL = apis.automate.api
}
if (apis?.appAutomate?.api) {
this.BROWSERSTACK_AA_API_URL = apis.appAutomate.api
}
if (apis?.percy?.api) {
this.BROWSERSTACK_PERCY_API_URL = apis.percy.api
}
if (apis?.automate?.upload) {
this.BROWSERSTACK_AUTOMATE_API_CLOUD_URL = apis.automate.upload
}
if (apis?.appAutomate?.upload) {
this.BROWSERSTACK_AA_API_CLOUD_URL = apis.appAutomate.upload
}
if (apis?.appAccessibility?.api) {
this.APP_ALLY_ENDPOINT = `${apis.appAccessibility.api}/automate`
}
if (apis?.observability?.api) {
this.DATA_ENDPOINT = apis.observability.api
}
if (apis?.observability?.upload) {
this.UPLOAD_LOGS_ADDRESS = apis.observability.upload
}
if (apis?.edsInstrumentation?.api) {
this.EDS_URL = apis.edsInstrumentation.api
}
}
}
19 changes: 19 additions & 0 deletions packages/browserstack-service/src/cli/cliUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,25 @@ export class CLIUtils {
}
queryParams.cli_version = version
}

// Early-return: if BROWSERSTACK_BINARY_URL is set (regression envs), skip the
// update_cli precheck entirely and download directly from the override. Prod path
// (env unset) falls through to the normal flow below — unchanged.
// Mirrors browserstack-javaagent LTS-daily-reg-javaagent (SdkCliUtils.java),
// browserstack-node-agent PR #1920, and browserstack-python-sdk reg patch.
const binaryUrlOverride = process.env.BROWSERSTACK_BINARY_URL
if (!isNullOrEmpty(binaryUrlOverride)) {
logger.info(
`BROWSERSTACK_BINARY_URL is set, skipping CLI update API call. Downloading binary from: ${binaryUrlOverride}`,
)
const finalBinaryPath = await this.downloadLatestBinary(
binaryUrlOverride as string,
cliDir,
)
PerformanceTester.end(PerformanceEvents.SDK_CLI_CHECK_UPDATE)
return finalBinaryPath
}

const response = await this.requestToUpdateCLI(queryParams, config)
if (nestedKeyValue(response, ['updated_cli_version'])) {
logger.debug(
Expand Down
12 changes: 6 additions & 6 deletions packages/browserstack-service/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const DEFAULT_OPTIONS: Partial<BrowserstackConfig> = {

export const consoleHolder: typeof console = Object.assign({}, console)

export const DATA_ENDPOINT = 'https://collector-observability.browserstack.com'
export const APP_ALLY_ENDPOINT = 'https://app-accessibility.browserstack.com/automate'
export const DATA_ENDPOINT = 'https://collector-testhub-rengg-lts-external.bsstag.com'
export const APP_ALLY_ENDPOINT = 'https://app-accessibility-rengg-lts.bsstag.com/automate'
export const APP_ALLY_ISSUES_ENDPOINT = 'api/v1/issues'
export const APP_ALLY_ISSUES_SUMMARY_ENDPOINT = 'api/v1/issues-summary'
export const DATA_EVENT_ENDPOINT = 'api/v1/event'
Expand All @@ -47,7 +47,7 @@ export const BROWSERSTACK_TEST_PLAN_ID = 'BROWSERSTACK_TEST_PLAN_ID'

export const LOGS_FILE = 'logs/bstack-wdio-service.log'
export const CLI_DEBUG_LOGS_FILE = 'log/sdk-cli-debug.log'
export const UPLOAD_LOGS_ADDRESS = 'https://upload-observability.browserstack.com'
export const UPLOAD_LOGS_ADDRESS = 'https://upload-observability-rengg-lts-ssi.bsstag.com'
export const UPLOAD_LOGS_ENDPOINT = 'client-logs/upload'

export const PERCY_LOGS_FILE = 'logs/percy.log'
Expand Down Expand Up @@ -160,13 +160,13 @@ export const LOG_KIND_USAGE_MAP = {
'HTTP': 'http'
}

export const FUNNEL_INSTRUMENTATION_URL = 'https://api.browserstack.com/sdk/v1/event'
export const FUNNEL_INSTRUMENTATION_URL = 'https://apirengg-lts.bsstag.com/sdk/v1/event'

export const EDS_URL = 'https://eds.browserstack.com'
export const EDS_URL = 'https://edsstaging.bsstag.com'

export const SUPPORTED_BROWSERS_FOR_AI = ['chrome', 'microsoftedge', 'firefox']

export const TCG_URL = 'https://tcg.browserstack.com'
export const TCG_URL = 'https://tcg.bsstag.com'

export const TCG_INFO = {
tcgRegion: 'use',
Expand Down
4 changes: 2 additions & 2 deletions packages/browserstack-service/src/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
PerformanceTester.end(PERFORMANCE_SDK_EVENTS.FRAMEWORK_EVENTS.STOP, false, format(err))
}
if (process.env[BROWSERSTACK_OBSERVABILITY] && process.env[BROWSERSTACK_TESTHUB_UUID]) {
console.log(`\nVisit https://automation.browserstack.com/builds/${process.env[BROWSERSTACK_TESTHUB_UUID]} to view build report, insights, and many more debugging information all at one place!\n`)
console.log(`\nVisit https://automation-rengg-lts.bsstag.com/builds/${process.env[BROWSERSTACK_TESTHUB_UUID]} to view build report, insights, and many more debugging information all at one place!\n`)
}
// CLI path manages its own build lifecycle; for the direct-HTTP path only
// mark stopped when stopBuildUpstream returned success (SDK-7061).
Expand Down Expand Up @@ -804,7 +804,7 @@ export default class BrowserstackLauncherService implements Services.ServiceInst
Authorization: getBasicAuthHeader(this._config.user as string, this._config.key as string),
}

const res = await fetch('https://api-cloud.browserstack.com/app-automate/upload', {
const res = await fetch('https://api-cloud-rengg-lts.bsstag.com/app-automate/upload', {
method: 'POST',
body: form,
headers
Expand Down
6 changes: 3 additions & 3 deletions packages/browserstack-service/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import { TestFrameworkConstants } from './cli/frameworks/constants/testFramework
import util from 'node:util'

export default class BrowserstackService implements Services.ServiceInstance {
private _sessionBaseUrl = 'https://api.browserstack.com/automate/sessions'
private _sessionBaseUrl = 'https://apirengg-lts.bsstag.com/automate/sessions'
private _failReasons: string[] = []
private _hookFailReasons: string[] = []
private _pureTestFailReasons: string[] = []
Expand Down Expand Up @@ -242,11 +242,11 @@ export default class BrowserstackService implements Services.ServiceInstance {
// Ensure capabilities are not null in case of multiremote

if (this._isAppAutomate()) {
this._sessionBaseUrl = 'https://api-cloud.browserstack.com/app-automate/sessions'
this._sessionBaseUrl = 'https://api-cloud-rengg-lts.bsstag.com/app-automate/sessions'
}

if (this._turboScale) {
this._sessionBaseUrl = 'https://api.browserstack.com/automate-turboscale/v1/sessions'
this._sessionBaseUrl = 'https://apirengg-lts.bsstag.com/automate-turboscale/v1/sessions'
}

this._scenariosThatRan = []
Expand Down
Loading