Add Cucumber-JS + Playwright BrowserStack SDK sample#3
Open
saraswati-padmawar wants to merge 5 commits into
Open
Add Cucumber-JS + Playwright BrowserStack SDK sample#3saraswati-padmawar wants to merge 5 commits into
saraswati-padmawar wants to merge 5 commits into
Conversation
Sample feature (bstackdemo add-to-cart) + local feature (BrowserStack Local via bs-local.com:45454) with step definitions and Playwright hooks, browserstack.yml, cucumber.js profiles, package.json with browserstack-node-sdk run scripts, and README. Follows the standardized Automate sample template. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Node SDK's cucumber-js flow gates Playwright support on resolving
@playwright/test from node_modules (src/bin/cucumber-js/command.js:
getPackageVersion('@playwright/test')). With only 'playwright' installed,
detection never fired, the SDK skipped its BrowserType.launch patch, and
chromium.launch() would run locally instead of routing to BrowserStack.
Switch the dependency and import to @playwright/test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirrors browserstack/node-js-playwright-browserstack. Runs the public bstackdemo sample profile + BrowserStack Local profile against a python http.server harness, using org BROWSERSTACK_USERNAME/ACCESS_KEY secrets. Strips yml credential placeholders so the secrets take effect. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cucumber/cucumber@latest is v12, whose paths.js uses Node 22's fs/promises.glob. On Node 18/20 that throws 'promises_1.glob is not a function' during path resolution, so no scenario runs. v11 supports Node 18/20 (the sample's target range). Verified: 3/3 platforms pass real BrowserStack sessions on Node 20. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rohannagariya1
approved these changes
Jul 1, 2026
Rohannagariya1
left a comment
There was a problem hiding this comment.
LGTM ✅ — clean, well-documented sample and both scenarios verified end-to-end. Approving.
A couple of low-risk, optional notes (non-blocking):
@playwright/test/browserstack-node-sdkpinned tolatest+postinstall: npm update+package-lock.jsongitignored means installs aren't reproducible. This matches BrowserStack's existing sample convention, so fine to keep — just flagging.- Sanity workflow is
workflow_dispatch-only, so it won't gate the PR automatically; worth a manual trigger before merge.
Nice touch pinning @cucumber/cucumber to v11 with the Node-version rationale documented.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Populates this customer-facing sample repo (previously skeleton: README + CODEOWNERS + Semgrep only) with a working Cucumber-JS + Playwright sample driven by the BrowserStack Node SDK.
What's included
features/sample.feature+step_definitions/sample_steps.js— public bstackdemo.com add-to-cart scenariofeatures/local.feature+step_definitions/local_steps.js— BrowserStack Local scenario (bs-local.com:45454)features/support/hooks.js— launches Playwright per scenario (SDK routes the launch)cucumber.js—sampleandlocalprofilesbrowserstack.yml— credentials, 3 platforms, Local toggle,framework: playwright,testReporting: truepackage.json— scripts viabrowserstack-node-sdk cucumber-js --profile …,.gitignore, READMEReferences
framework-matrix.md(browserstack-node-sdk cucumber-js);@cucumber/cucumberhook pattern from node-agent examplesframework: playwrightmirrors the existingcodecept-js-playwright-browserstackprecedentVerified on BrowserStack ✅
Both scenarios ran end-to-end against BrowserStack Automate (Node 20), passing on all 3 configured platforms (OS X Ventura/playwright-webkit, Windows 11/chrome, Windows 11/playwright-firefox):
npm run sample-test497c7b68c924616a4f825cabe63dae140d141db6bs-local.com:45454)npm run sample-local-test3d8eb5f9164866878b39af7e638f24399dc1e4bdThe Local run confirms the SDK starts the tunnel and the cloud browser reaches a local-only page through
bs-local.com(the title assertion passed). Project: BrowserStack Samples.🤖 Generated with Claude Code