Skip to content

Commit 7d2c1db

Browse files
authored
Merge pull request #23 from browserstack/merge_sdk_to_main
Merge sdk to main
2 parents f7671eb + 09c8ec7 commit 7d2c1db

15 files changed

+6053
-388
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
node_modules
22
playwright-report
3-
local.log
4-
local.log
3+
test-results
4+
log/
55
package-lock.json
66
local.log

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @browserstack/afd-dev
1+
* @browserstack/automate-public-repos

README.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
11
# node-js-playwright-browserstack
2-
3-
[Playwright](https://playwright.dev/docs/intro) Integration with BrowserStack.
2+
This repo contains samples for running [Playwright](https://playwright.dev/docs/intro) tests on BrowserStack using the browserstack-node-sdk.
43

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

76
## Setup
87

9-
* Clone the repo and run `cd node-js-playwright-browserstack`
10-
* Set `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` as environment variables with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings)
11-
* Run `npm i`
8+
* Clone the repo `git clone -b sdk https://github.com/browserstack/node-js-playwright-browserstack.git` and run `cd node-js-playwright-browserstack`.
9+
* Set `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` as environment variables with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings) or update the same in `browserstack.yml` file.
10+
* Run `npm i` to install the dependencies.
1211

1312
## Running your tests
1413

15-
- To run a sample test, run `npm run sample-test`
16-
17-
## Running your tests on mobile
18-
19-
- To run a sample test, run `npm run mobile-test`
20-
21-
## Run tests on locally hosted websites
22-
* Run `npm run sample-local-test`
23-
24-
Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)
14+
- To run the sample tests in parallel across the platforms specified in the `browserstack.yml`, run `npm run sample-test`.
15+
- To run the sample local tests in parallel across the platforms specified in the `browserstack.yml`, run `npm run sample-local-test`.
2516

2617
## Notes
2718
* You can view your test results on the [BrowserStack Automate dashboard](https://www.browserstack.com/automate)
19+
* Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github)

browserstack.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# =============================
2+
# Set BrowserStack Credentials
3+
# =============================
4+
# Add your BrowserStack userName and accessKey here or set BROWSERSTACK_USERNAME and
5+
# BROWSERSTACK_ACCESS_KEY as env variables
6+
userName: YOUR_USERNAME
7+
accessKey: YOUR_ACCESS_KEY
8+
9+
# ======================
10+
# BrowserStack Reporting
11+
# ======================
12+
# The following capabilities are used to set up reporting on BrowserStack:
13+
# Set 'projectName' to the name of your project. Example, Marketing Website
14+
projectName: BrowserStack Samples
15+
# Set `buildName` as the name of the job / testsuite being run
16+
buildName: browserstack build
17+
# `buildIdentifier` is a unique id to differentiate every execution that gets appended to
18+
# buildName. Choose your buildIdentifier format from the available expressions:
19+
# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution
20+
# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30
21+
# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests
22+
buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression}
23+
24+
# =======================================
25+
# Platforms (Browsers / Devices to test)
26+
# =======================================
27+
# Platforms object contains all the browser / device combinations you want to test on.
28+
# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate)
29+
platforms:
30+
- os: Windows
31+
osVersion: 11
32+
browserName: chrome
33+
browserVersion: latest
34+
- os: OS X
35+
osVersion: Ventura
36+
browserName: playwright-webkit
37+
browserVersion: latest
38+
- os: Windows
39+
osVersion: 11
40+
browserName: playwright-firefox
41+
browserVersion: latest
42+
43+
# =======================
44+
# Parallels per Platform
45+
# =======================
46+
# The number of parallel threads to be used for each platform set.
47+
# BrowserStack's SDK runner will select the best strategy based on the configured value
48+
#
49+
# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack
50+
#
51+
# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack
52+
parallelsPerPlatform: 1
53+
54+
# ==========================================
55+
# BrowserStack Local
56+
# (For localhost, staging/private websites)
57+
# ==========================================
58+
# Set browserStackLocal to true if your website under test is not accessible publicly over the internet
59+
# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction
60+
browserstackLocal: true # <boolean> (Default false)
61+
# browserStackLocalOptions:
62+
# Options to be passed to BrowserStack local in-case of advanced configurations
63+
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
64+
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
65+
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
66+
67+
framework: playwright
68+
source: node-js-playwright-sample-sdk:v1
69+
70+
# ===================
71+
# Debugging features
72+
# ===================
73+
debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran
74+
networkLogs: false # <boolean> Set to true to enable HAR logs capturing
75+
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors)
76+
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors)
77+
# CUSTOM_TAG_<INT>: # <string> (Default: parent folder name of the test file) Custom tag for your test suite
78+
79+
# Test Observability is an intelligent test reporting & debugging product. It collects data using the SDK. Read more about what data is collected at https://www.browserstack.com/docs/test-observability/references/terms-and-conditions
80+
# Visit observability.browserstack.com to see your test reports and insights. To disable test observability, specify `testObservability: false` in the key below.
81+
testObservability: true

global-setup.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

global-teardown.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)