Repository navigation
LTS-5502: pin Semgrep by digest on main, and put the Nightwatch sample on main #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f6dc2d9
LTS-5502: pin the Semgrep image by digest on main
MihirR-BS 9d4f671
LTS-5502: put the Nightwatch sample on main, like the other load-test…
MihirR-BS 97d153f
LTS-5452: README step to set credentials as env vars
MihirR-BS 3352617
LTS-5502: address review on the Nightwatch sample
MihirR-BS c251f09
Merge LTS-5502 review fixes; README key prompt keeps it out of history
MihirR-BS bc21106
LTS-5502: name a Node/npm pair that supports min-release-age
MihirR-BS 308b582
Merge LTS-5502 Node/npm prerequisite fix
MihirR-BS b3ce529
LTS-5502: README Node floor matches engines.node
MihirR-BS fee1482
Merge LTS-5502 Node floor wording
MihirR-BS b66ec5d
LTS-5452: one-line key prompt
MihirR-BS fa5ec3b
LTS-5502: name browserstack-cli.exe for Windows in the README
MihirR-BS 732651c
Merge LTS-5502 README .exe note
MihirR-BS 44f9373
LTS-5452: shell labels in prose
MihirR-BS c67d7d5
LTS-5502: chmod +x the CLI after unzip
MihirR-BS a2af209
Merge LTS-5502 chmod note
MihirR-BS f96653a
Merge pull request #4 from browserstack/LTS-5452-readme-credentials
SaranshBS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| node_modules | ||
| log | ||
| .DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Supply-chain hardening directives (SC-12282), same set as the Playwright and | ||
| # WebdriverIO load-testing samples (LTS-3294 / LTS-3295). | ||
| # See: https://browserstack.atlassian.net/wiki/spaces/ENG/pages/6091571922/Supply+Chain+Security+Enhancements+Tech+Spec | ||
| # | ||
| # access=restricted is intentionally OMITTED — this is a public, customer-facing | ||
| # sample repository, not a published private package. | ||
| # | ||
| # ignore-scripts=true is safe: this sample has no install scripts of its own, and the | ||
| # tests run remotely on BrowserStack, so no local browser-driver postinstall is needed. | ||
| # | ||
| # engine-strict=true enforces the `engines.node` floors of this package (>=20) and of | ||
| # its dependencies (serialize-javascript needs >=20), so an older Node fails at install. | ||
|
|
||
| strict-ssl=true | ||
| save-exact=true | ||
| audit-level=high | ||
| legacy-peer-deps=false | ||
| ignore-scripts=true | ||
| engine-strict=true | ||
| min-release-age=7 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,49 @@ | ||
| # browserstack-nightwatch-load-testing-sample | ||
| A sample repository demonstrating load testing with the Nightwatch framework | ||
| This repo contains samples for running [Nightwatch](https://nightwatchjs.org/) tests on BrowserStack Load Testing using the BrowserStack CLI. | ||
|
|
||
|  | ||
|
|
||
| ## Setup | ||
|
|
||
| * Clone the repo `git clone https://github.com/browserstack/browserstack-nightwatch-load-testing-sample.git`. | ||
| * Set your credentials as environment variables, as described in [Set your credentials](#set-your-credentials). | ||
| * Use Node.js 20 or later. For the seven-day release-age policy in `.npmrc`, also use npm 11.10 or later (`npm install -g npm@11.10.0`, which needs Node.js 20.17+ or 22.9+); older npm ignores that policy. | ||
| * 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: | ||
|
|
||
| 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 | ||
| export BROWSERSTACK_USERNAME="<your-username>" | ||
| 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 | ||
| $env:BROWSERSTACK_USERNAME = "<your-username>" | ||
| $env:BROWSERSTACK_ACCESS_KEY = [System.Net.NetworkCredential]::new('', (Read-Host -AsSecureString 'BrowserStack access key')).Password | ||
| ``` | ||
|
|
||
| These variables last only for the current terminal session. If the CLI reports an authentication error, check that both are set in the terminal you run it from. | ||
|
|
||
| **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 for your operating system. The download is a zip: extract it and place the `browserstack-cli` binary (`browserstack-cli.exe` on Windows) in the root of this project. On macOS or Linux, also run `chmod +x browserstack-cli`, since some unzip tools drop the executable bit. | ||
| - [macOS x86](https://load-api.browserstack.com/api/v1/binary?os=macos&arch=x64) | ||
| - [macOS ARM](https://load-api.browserstack.com/api/v1/binary?os=macos&arch=arm64) | ||
| - [Windows x86](https://load-api.browserstack.com/api/v1/binary?os=win&arch=x64) | ||
| - [Linux x86](https://load-api.browserstack.com/api/v1/binary?os=linux&arch=x64) | ||
| - [Linux ARM](https://load-api.browserstack.com/api/v1/binary?os=linux&arch=arm64) | ||
| - Start your test: | ||
| - macOS / Linux: `./browserstack-cli load run` | ||
| - Windows (PowerShell): `.\browserstack-cli.exe load run` | ||
|
|
||
| ## Notes | ||
| * You can view your test results on the [BrowserStack Load Testing dashboard](https://load.browserstack.com) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| projectName: Default Project Name | ||
| testName: nightwatch_test | ||
| testType: Nightwatch | ||
| vus: 1 | ||
| duration: 5m | ||
| regions: | ||
| - loadzone: us-east-1 | ||
| percent: 100 | ||
| files: | ||
| dependencies: | ||
| - package.json | ||
| testConfigs: | ||
| - nightwatch.conf.js | ||
| captureErrorResponses: false | ||
| headless: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| // Refer to the online docs for more details: | ||
| // https://nightwatchjs.org/gettingstarted/configuration/ | ||
| // | ||
|
|
||
| // _ _ _ _ _ _ _ | ||
| // | \ | |(_) | | | | | | | | | ||
| // | \| | _ __ _ | |__ | |_ __ __ __ _ | |_ ___ | |__ | ||
| // | . ` || | / _` || '_ \ | __|\ \ /\ / / / _` || __| / __|| '_ \ | ||
| // | |\ || || (_| || | | || |_ \ V V / | (_| || |_ | (__ | | | | | ||
| // \_| \_/|_| \__, ||_| |_| \__| \_/\_/ \__,_| \__| \___||_| |_| | ||
| // __/ | | ||
| // |___/ | ||
|
|
||
| module.exports = { | ||
| // An array of folders (excluding subfolders) where your tests are located; | ||
| // if this is not specified, the test source must be passed as the second argument to the test runner. | ||
| src_folders: ['tests'], | ||
|
|
||
| // See https://nightwatchjs.org/guide/concepts/page-object-model.html | ||
| // page_objects_path: ['nightwatch/page-objects'], | ||
|
|
||
| // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-commands.html | ||
| // custom_commands_path: ['nightwatch/custom-commands'], | ||
|
|
||
| // See https://nightwatchjs.org/guide/extending-nightwatch/adding-custom-assertions.html | ||
| // custom_assertions_path: ['nightwatch/custom-assertions'], | ||
|
|
||
| // See https://nightwatchjs.org/guide/extending-nightwatch/adding-plugins.html | ||
| plugins: [], | ||
|
|
||
| // See https://nightwatchjs.org/guide/concepts/test-globals.html | ||
| globals_path: '', | ||
|
|
||
| webdriver: {}, | ||
|
|
||
| test_workers: { | ||
| enabled: true | ||
| }, | ||
|
|
||
| test_settings: { | ||
| default: { | ||
| disable_error_log: false, | ||
| launch_url: 'http://localhost', | ||
|
|
||
| screenshots: { | ||
| enabled: false, | ||
| path: 'screens', | ||
| on_failure: true | ||
| }, | ||
|
|
||
| desiredCapabilities: { | ||
| browserName: 'chrome' | ||
| }, | ||
|
|
||
| webdriver: { | ||
| start_process: true, | ||
| server_path: '' | ||
| }, | ||
|
|
||
| }, | ||
|
|
||
| chrome: { | ||
| desiredCapabilities: { | ||
| browserName: 'chrome', | ||
| 'goog:chromeOptions': { | ||
| // More info on Chromedriver: https://sites.google.com/a/chromium.org/chromedriver/ | ||
| args: [ | ||
| //'--no-sandbox', | ||
| //'--ignore-certificate-errors', | ||
| //'--allow-insecure-localhost', | ||
| //'--headless=new' | ||
| ] | ||
| } | ||
| }, | ||
|
|
||
| webdriver: { | ||
| start_process: true, | ||
| server_path: '', | ||
| cli_args: [ | ||
| // --verbose | ||
| ] | ||
| } | ||
| }, | ||
|
|
||
| }, | ||
|
|
||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.