Add Cucumber-JS + Playwright BrowserStack SDK sample#3
Add Cucumber-JS + Playwright BrowserStack SDK sample#3saraswati-padmawar wants to merge 9 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
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.
The Local scenario navigates to bs-local.com:45454 and asserts the page title contains 'BrowserStack Local', but the README never told users to serve anything on that port -- so following it verbatim failed. Document serving a matching local page (and how to point at your own app), and describe the tunnel routing accurately.
Claude Code PR ReviewPR: #3 • Head: 37637b0 • Reviewers: stack:code-reviewer SummaryPopulates this previously-skeleton sample repo with a working Cucumber-JS + Playwright sample driven by the BrowserStack Node SDK (public bstackdemo add-to-cart + BrowserStack Local scenarios). Verified green on real BrowserStack sessions across 3 platforms. Review Table
Findings
Verdict: PASS — clean, template-conformant, and verified green on BrowserStack; only Low-severity polish remains and the one Medium is already resolved. Review run via the BrowserStack AI harness |
Semgrep's supply-chain rule (action not pinned to a full commit SHA) blocks on unpinned tag refs like actions/checkout@v4. Pin all actions to SHAs with a version comment, matching the repo's Semgrep.yml. Also modernizes v3->v4.
Reviewer specified the onboarding-funnel source tag as <repo>:main:v1.0 -- the middle segment is the branch the sample lives on (main), not the 'sample-sdk' label.
…ecklist
The canonical format (Confluence ENG/4080468210) is {f/w-name}:sample-{branch-name}:v{version}.
The sample lives on main, so the branch segment is sample-main (keeps the sample- prefix).
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)
The 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