You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -27,6 +27,8 @@ Cucumber.js + Playwright integration with BrowserStack for E2E functional testin
27
27
1. Clone the repo and install dependencies:
28
28
29
29
```bash
30
+
git clone <repo-url>
31
+
cd cucumber-playwright-browserstack
30
32
npm install
31
33
```
32
34
@@ -41,9 +43,9 @@ Or update `userName` and `accessKey` in `browserstack.yml`.
41
43
42
44
## Running Tests
43
45
44
-
### Run sample tests on BrowserStack
46
+
### Run search tests on BrowserStack
45
47
46
-
Runs the search and product features against [bstackdemo.com](https://bstackdemo.com/)on the platforms defined in `browserstack.yml`:
48
+
Runs `search.feature`against [bstackdemo.com](https://bstackdemo.com/)across all platforms defined in `browserstack.yml`:
47
49
48
50
```bash
49
51
npm run sample-test
@@ -57,30 +59,49 @@ Verifies that the BrowserStack Local tunnel is working:
57
59
npm run sample-local-test
58
60
```
59
61
62
+
### Run all tests on BrowserStack
63
+
64
+
Runs every feature file (search, cart, local) across all platforms:
65
+
66
+
```bash
67
+
npm run sample-all-test
68
+
```
69
+
60
70
### Run tests locally (without BrowserStack)
61
71
62
-
If you want to run the Cucumber tests directly (connects to BrowserStack CDP by default — you can modify `world.js` to launch a local browser instead):
72
+
Runs the Cucumber tests directly using a local Playwright browser:
63
73
64
74
```bash
65
75
npm test
66
76
```
67
77
68
78
## How It Works
69
79
70
-
-**Cucumber.js** provides the BDD test structure with Gherkin feature files.
71
-
-**Playwright** handles all browser automation (navigation, clicks, assertions).
72
-
-**BrowserStack SDK** (`browserstack-node-sdk`) wraps the Cucumber runner to manage platform distribution, parallel execution, BrowserStack Local tunneling, and test reporting.
73
-
- The custom `World` class in `features/support/world.js` connects Playwright to BrowserStack via the CDP WebSocket endpoint (`wss://cdp.browserstack.com/playwright`).
80
+
-**Cucumber.js** provides the BDD layer with Gherkin feature files and step definitions.
81
+
-**Playwright** handles browser automation (navigation, clicks, assertions) via `chromium.launch()`.
82
+
-**BrowserStack SDK** (`browserstack-node-sdk`) wraps the Cucumber runner and intercepts Playwright's browser launch. It routes execution to BrowserStack, managing platform distribution, parallel execution, Local tunneling, and test reporting — all configured through `browserstack.yml`.
74
83
75
84
## Configuration
76
85
77
86
### Platforms
78
87
79
-
Edit `browserstack.yml` to change which browsers / OS combinations to test on. See the [full platform list](https://www.browserstack.com/list-of-browsers-and-platforms/automate).
88
+
Edit the `platforms` section in `browserstack.yml` to change which browsers and OS combinations to test on. The default configuration runs on:
89
+
90
+
| OS | Browser |
91
+
|-------------|---------------------|
92
+
| Windows 11 | Chrome (latest) |
93
+
| macOS Ventura | WebKit (latest) |
94
+
| Windows 11 | Firefox (latest) |
95
+
96
+
See the [full platform list](https://www.browserstack.com/list-of-browsers-and-platforms/automate).
97
+
98
+
### Parallelism
99
+
100
+
Adjust `parallelsPerPlatform` in `browserstack.yml` to control how many parallel sessions run per platform.
80
101
81
102
### Timeouts
82
103
83
-
The default Cucumber timeout is set to 60 secondsin `features/support/world.js`. Adjust via `setDefaultTimeout()`.
104
+
The default Cucumber step timeout is 60 seconds, set in `features/support/world.js` via `setDefaultTimeout()`.
0 commit comments