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
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/Semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

container:
# A Docker image with Semgrep installed. Do not change this.
image: returntocorp/semgrep
image: returntocorp/semgrep:1.166.0@sha256:c180f0c93a17b420c0af5006214a29d3c747c5459c732b740191adf657dd0068

# Skip any PR created by dependabot to avoid permission issues:
if: (github.actor != 'dependabot[bot]')
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
# 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 using the browserstack-node-sdk.

![BrowserStack Logo](https://d98b8t1nnulk5.cloudfront.net/production/images/layout/logo-header.png?1469004780)

## 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)
* Run `npm i` to install the dependencies.
* Open the browserstack-load.yaml file and update it with the relevant load test configurations.

## Running your tests

- Download the BrowserStack CLI binary for your operating system and place it in the root of this project:
- [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)
- Run the given command to start your test: `./browserstack-cli load run`.

## Notes
* You can view your test results on the [BrowserStack Load Testing dashboard](https://load.browserstack.com)
15 changes: 15 additions & 0 deletions browserstack-load.yml
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
87 changes: 87 additions & 0 deletions nightwatch.conf.js
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
]
}
},

},

};
Loading
Loading