Repository navigation
SDK-8048: support BROWSERSTACK_ENV=preprod|staging for internal testing - #1217
AakashHotchandani wants to merge 1 commit into
Conversation
The cli hardcodes production hosts, so testing a cli change on preprod means hand-editing config.json and the accessibility/observability constants (the PR #1001 pattern). browserstack-binary and browserstack-node-agent already switch on BROWSERSTACK_ENV; do the same here. - bin/helpers/environmentUrl.js: exact-host map for preprod and staging, mirroring browserstack-binary core/utils/environment-url.js, plus the web accessibility host (accessibility-preprod.bsstag.com). - Applied to the automate hosts (config.js, production config only), the accessibility API, the observability collector default (an explicit BROWSERSTACK_TEST_OBSERVABILITY_API_URL still wins and is forwarded to the remote reporter as before) and the printed Test Reporting build link. - Unset or any other value: production hosts, unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
What is this about?
The cli hardcodes production hosts. Testing a cli change on preprod today means hand-editing
bin/helpers/config.jsonplus the accessibility and observabilityconstants.jsfiles (the #1001 pattern), packing a tarball and shipping it throughnpm_dependencies. This came up while verifying #1206 (Cypress 16) on preprod for SDK-8048.browserstack-binary(core/utils/environment-url.js) andbrowserstack-node-agent(src/bin/utils/constants.js,test-observability/constants.js) already switch hosts onBROWSERSTACK_ENV. This PR gives the cli the same switch:Unset, or any other value: production hosts, unchanged.
Related Jira task/s
Dependent PRs / release order
Automation cases to add
Code changes to check
?./??.The change
bin/helpers/environmentUrl.js(new):getEnvironmentUrl(url)swaps the whole host from a preprod or staging map and keeps the path, soapp-automate.browserstack.comandeds.browserstack.com:443are left alone. Acceptspreprod/pre-prodandstaging/stag, case-insensitive. The preprod map mirrors the binary, plus the web accessibility host (accessibility-preprod.bsstag.com), which the binary has no explicit entry for.bin/helpers/config.js: in the production config only (theBSTACK_CYPRESS_NODE_ENVdev path is untouched), mapsuploadUrl,rails_host,dashboardUrl,turboScaleUrl,turboScaleAPIUrlbefore the derived URLs are built.bin/accessibility-automation/constants.js:API_URLgoes through the map.bin/testObservability/helper/constants.js:apiUrl()falls back to the mapped collector. An explicitBROWSERSTACK_TEST_OBSERVABILITY_API_URLstill wins, andsetSystemEnvsstill forwards the result to the remote reporter (A11 y 13909 forward observability api url #1214), so the machine posts to the same collector.bin/testObservability/helper/helper.js: the printed Test Reporting build link uses the mapped host. On preprod it used to print the productionautomation.browserstack.comlink.Verification
Resolved hosts from the packed tarball:
BROWSERSTACK_ENV=preprodapi.browserstack.comapi-preprod.bsstag.comapi-cloud.browserstack.com/...api-cloud-preprod.bsstag.com/...automate.browserstack.com/...automate-preprod.bsstag.com/...accessibility.browserstack.com/apiaccessibility-preprod.bsstag.com/apicollector-observability.browserstack.comcollector-observability-preprod.bsstag.comPreprod E2E: branch tarball,
config.jsonuntouched, onlyBROWSERSTACK_ENV=preprodset. Cypress 15.21.1, OS X Ventura, Chrome 148, headed,testObservability: true, cli shipped vianpm_dependencies+cache_dependencies: true:ee251f15automation-preprod.bsstag.coma4fc1331accessibility-preprod.bsstag.com; it refused the test account's plan ("You cannot run automation builds on the current plan"), an account entitlement, not routingNot covered: staging (
devtestops) hosts are mapped from the binary's list and were not run end to end; Windows terminals.Unit tests: 6 new (
test/unit/bin/helpers/environmentUrl.js). Full suite: branch 751 passing / 16 failing, untouchedorigin/master745 passing / 16 failing, the same 16 tests on both, so none are new.🤖 Generated with Claude Code
Summary by CodeRabbit