From 97d153f48dec04f58209a2972c95c9982ce67dee Mon Sep 17 00:00:00 2001 From: Mihir Rawool Date: Fri, 6 Nov 2026 06:43:15 +0530 Subject: [PATCH 1/3] LTS-5452: README step to set credentials as env vars Export BROWSERSTACK_USERNAME / BROWSERSTACK_ACCESS_KEY in the shell and never commit them; the CLI reads them from the environment. Co-Authored-By: Claude Opus 5.5 --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8046a1f..5ef40d9 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,28 @@ This repo contains samples for running [Nightwatch](https://nightwatchjs.org/) t ## Setup * Clone the repo `git clone https://github.com/browserstack/browserstack-nightwatch-load-testing-sample.git`. -* Set `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` as environment variables with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings) +* Set your credentials as environment variables, as described in [Set your credentials](#set-your-credentials). * Run `npm i` to install the dependencies. * Open the browserstack-load.yml file and update it with the relevant load test configurations. +## Set your credentials + +The BrowserStack CLI reads your credentials from environment variables. Copy your username and access key from [Account Settings](https://www.browserstack.com/accounts/settings) and export them in the shell you run the test from: + +```sh +# macOS / Linux +export BROWSERSTACK_USERNAME="" +export BROWSERSTACK_ACCESS_KEY="" +``` + +```powershell +# Windows (PowerShell) +$env:BROWSERSTACK_USERNAME = "" +$env:BROWSERSTACK_ACCESS_KEY = "" +``` + +**Never commit your credentials.** Keep your access key out of `browserstack-load.yml` and every other file you push. If a key is ever exposed, regenerate it from Account Settings. + ## Running your tests - Download the BrowserStack CLI binary for your operating system and place it in the root of this project: From b66ec5d06d833d83edc079e24153d7f70635a59c Mon Sep 17 00:00:00 2001 From: Mihir Rawool Date: Fri, 6 Nov 2026 07:33:22 +0530 Subject: [PATCH 2/3] LTS-5452: one-line key prompt Prompt and export on one line, so pasting the block can't feed the export line to read. Co-Authored-By: Claude Opus 5.5 --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index d109f60..2570173 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,7 @@ The BrowserStack CLI reads your credentials from environment variables. Copy you # macOS / Linux (bash or zsh) export BROWSERSTACK_USERNAME="" # Type the key at the prompt: it is not echoed, and it stays out of your shell history -printf 'BrowserStack access key: '; read -rs BROWSERSTACK_ACCESS_KEY; echo -export BROWSERSTACK_ACCESS_KEY +printf 'BrowserStack access key: '; read -rs BROWSERSTACK_ACCESS_KEY; echo; export BROWSERSTACK_ACCESS_KEY ``` ```powershell From 44f93737761de7dd23936d30f62f0e5c15007416 Mon Sep 17 00:00:00 2001 From: Mihir Rawool Date: Fri, 6 Nov 2026 07:47:52 +0530 Subject: [PATCH 3/3] LTS-5452: shell labels in prose zsh (macOS default) has interactive_comments off, so pasted '#' lines printed errors. Co-Authored-By: Claude Opus 5.5 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 48e971d..68f62b9 100644 --- a/README.md +++ b/README.md @@ -15,17 +15,17 @@ This repo contains samples for running [Nightwatch](https://nightwatchjs.org/) t The BrowserStack CLI reads your credentials from environment variables. Copy your username and access key from [Account Settings](https://www.browserstack.com/accounts/settings) and export them in the shell you run the test from: +On macOS or Linux (bash or zsh), run the lines below. The second one prompts for the key without echoing it, so the key stays out of your shell history: + ```sh -# macOS / Linux (bash or zsh) export BROWSERSTACK_USERNAME="" -# Type the key at the prompt: it is not echoed, and it stays out of your shell history printf 'BrowserStack access key: '; read -rs BROWSERSTACK_ACCESS_KEY; echo; export BROWSERSTACK_ACCESS_KEY ``` +On Windows, run these in PowerShell. The second line prompts for the key in the same way: + ```powershell -# Windows (PowerShell) $env:BROWSERSTACK_USERNAME = "" -# Type the key at the prompt: it is not echoed, and it stays out of your PowerShell history $env:BROWSERSTACK_ACCESS_KEY = [System.Net.NetworkCredential]::new('', (Read-Host -AsSecureString 'BrowserStack access key')).Password ```