Title: SDK-8048: support BROWSERSTACK_ENV=preprod|staging for internal testing by AakashHotchandani · Pull Request #1217 · browserstack/browserstack-cypress-cli · GitHub
Open Graph Title: SDK-8048: support BROWSERSTACK_ENV=preprod|staging for internal testing by AakashHotchandani · Pull Request #1217 · browserstack/browserstack-cypress-cli
X Title: SDK-8048: support BROWSERSTACK_ENV=preprod|staging for internal testing by AakashHotchandani · Pull Request #1217 · browserstack/browserstack-cypress-cli
Description: What is this about? The cli hardcodes production hosts. Testing a cli change on preprod today means hand-editing bin/helpers/config.json plus the accessibility and observability constants.js files (the #1001 pattern), packing a tarball and shipping it through npm_dependencies. This came up while verifying #1206 (Cypress 16) on preprod for SDK-8048. browserstack-binary (core/utils/environment-url.js) and browserstack-node-agent (src/bin/utils/constants.js, test-observability/constants.js) already switch hosts on BROWSERSTACK_ENV. This PR gives the cli the same switch: BROWSERSTACK_ENV=preprod npx browserstack-cypress run ... Unset, or any other value: production hosts, unchanged. Related Jira task/s SDK-8048 Dependent PRs / release order Dependent PRs: None. CLI-only; builds on #1214 (collector override + forwarding to the remote reporter), already on master. No cross-repo deploy order applies. Automation cases to add None. Internal-only switch, off by default; unit-tested below. Code changes to check Spread operator is not used. Syntax supported by older Node: no ?. / ??. The change bin/helpers/environmentUrl.js (new): getEnvironmentUrl(url) swaps the whole host from a preprod or staging map and keeps the path, so app-automate.browserstack.com and eds.browserstack.com:443 are left alone. Accepts preprod/pre-prod and staging/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 (the BSTACK_CYPRESS_NODE_ENV dev path is untouched), maps uploadUrl, rails_host, dashboardUrl, turboScaleUrl, turboScaleAPIUrl before the derived URLs are built. bin/accessibility-automation/constants.js: API_URL goes through the map. bin/testObservability/helper/constants.js: apiUrl() falls back to the mapped collector. An explicit BROWSERSTACK_TEST_OBSERVABILITY_API_URL still wins, and setSystemEnvs still forwards the result to the remote reporter (#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 production automation.browserstack.com link. Verification Resolved hosts from the packed tarball: unset BROWSERSTACK_ENV=preprod rails api.browserstack.com api-preprod.bsstag.com upload api-cloud.browserstack.com/... api-cloud-preprod.bsstag.com/... dashboard automate.browserstack.com/... automate-preprod.bsstag.com/... accessibility accessibility.browserstack.com/api accessibility-preprod.bsstag.com/api collector (cli + remote reporter) collector-observability.browserstack.com collector-observability-preprod.bsstag.com Preprod E2E: branch tarball, config.json untouched, only BROWSERSTACK_ENV=preprod set. Cypress 15.21.1, OS X Ventura, Chrome 148, headed, testObservability: true, cli shipped via npm_dependencies + cache_dependencies: true: Run Upload Build Test Reporting Accessibility a11y off ✅ api-cloud-preprod ✅ ee251f15 ✅ build created; link printed on automation-preprod.bsstag.com n/a a11y on ✅ ✅ a4fc1331 ✅ same reached accessibility-preprod.bsstag.com; it refused the test account's plan ("You cannot run automation builds on the current plan"), an account entitlement, not routing Not 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, untouched origin/master 745 passing / 16 failing, the same 16 tests on both, so none are new. 🤖 Generated with Claude Code Summary by CodeRabbit Improvements Automation and observability services now use the appropriate hosts in supported preproduction and staging environments, while production defaults remain unchanged. Custom observability API URLs continue to take precedence over environment-based defaults.
Open Graph Description: What is this about? The cli hardcodes production hosts. Testing a cli change on preprod today means hand-editing bin/helpers/config.json plus the accessibility and observability constants.js files ...
X Description: What is this about? The cli hardcodes production hosts. Testing a cli change on preprod today means hand-editing bin/helpers/config.json plus the accessibility and observability constants.js files ...
Opengraph URL: https://github.com/browserstack/browserstack-cypress-cli/pull/1217
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:e36e0c31-bbc2-aaab-53e0-086326791733 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DA30:1F63A9:1AE27E:254774:6B044884 |
| html-safe-nonce | 984ec1b37b5ecc2c94f4f0a3191f883f576a11e2380951c030812e0017927e53 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQTMwOjFGNjNBOToxQUUyN0U6MjU0Nzc0OjZCMDQ0ODg0IiwidmlzaXRvcl9pZCI6IjQ4NjkwNzcwOTY2NzAxODU2MDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 381248d1f8587f976ea4bf92143917d575ab65d00556f047fde3a1f2c8e48703 |
| hovercard-subject-tag | pull_request:5272974289 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/browserstack/browserstack-cypress-cli/pull/1217/files |
| twitter:image | https://avatars.githubusercontent.com/u/187596484?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/187596484?s=400&v=4 |
| og:image:alt | What is this about? The cli hardcodes production hosts. Testing a cli change on preprod today means hand-editing bin/helpers/config.json plus the accessibility and observability constants.js files ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | d4495c3631faba668036f176d1f5946901c5172efd73a6edb984029e7d4f8e46 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/browserstack/browserstack-cypress-cli git https://github.com/browserstack/browserstack-cypress-cli.git |
| octolytics-dimension-user_id | 1119453 |
| octolytics-dimension-user_login | browserstack |
| octolytics-dimension-repository_id | 242935045 |
| octolytics-dimension-repository_nwo | browserstack/browserstack-cypress-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 242935045 |
| octolytics-dimension-repository_network_root_nwo | browserstack/browserstack-cypress-cli |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9ac4337fb7c6a5846cdfdb1a04f154d3c33ebc77 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width