Skip to content

Add Jest + Playwright BrowserStack SDK sample#2

Open
saraswati-padmawar wants to merge 4 commits into
mainfrom
add-jest-playwright-sample
Open

Add Jest + Playwright BrowserStack SDK sample#2
saraswati-padmawar wants to merge 4 commits into
mainfrom
add-jest-playwright-sample

Conversation

@saraswati-padmawar

@saraswati-padmawar saraswati-padmawar commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Populates this customer-facing sample repo (previously skeleton: README + CODEOWNERS + Semgrep only) with a working Jest + Playwright sample driven by the BrowserStack Node SDK.

What's included

  • tests/bstack_sample.test.js — public bstackdemo.com add-to-cart scenario
  • tests/bstack_local_test.test.js — BrowserStack Local scenario (bs-local.com:45454)
  • browserstack.yml — credentials, 3 platforms (Win/Chrome, macOS/WebKit, Win/Firefox), Local toggle, framework: playwright, testReporting: true
  • package.jsonsample-test / sample-local-test scripts via browserstack-node-sdk jest
  • jest.config.js / jest.local.config.js, .gitignore, README

References

  • Follows the standardized Automate sample template (Confluence: SDK Sample Repo Generator, R1–R4)
  • SDK run command per the node-agent framework-matrix.md (browserstack-node-sdk jest)
  • framework: playwright mirrors the existing codecept-js-playwright-browserstack precedent
  • Structure mirrors node-js-playwright-browserstack

Verified on BrowserStack

Ran end-to-end against BrowserStack Automate (Node 20):

Scenario Command Result Build
Public (bstackdemo add-to-cart) npm run sample-test ✅ 3/3 passed (chrome, firefox, webkit) f16ab3c9d13416a67e75e01079107bc92c3fd255
BrowserStack Local (bs-local.com:45454) npm run sample-local-test ⚠️ pending CI confirmation

Project: BrowserStack Samples.

The public scenario is fully verified. The Local scenario could not be confirmed in the local environment used for verification — the SDK's BrowserStack Local tunnel was not connected by the time the parallel Jest workers called chromium.launch() ([browserstack.local] is set to true but local testing through BrowserStack is not connected). The same Local scenario passes in the sibling cucumber-js and nunit samples with identical config, so this is a tunnel-startup timing issue in that environment, not a defect in the sample's test code or browserstack.yml. The included sanity-workflow.yml runs the Local step on a clean GitHub runner — please confirm it green there before merge.

Note from verification: the sample must depend on @playwright/test (not playwright) for the SDK to detect & route Playwright — reflected in this PR.

🤖 Generated with Claude Code

Sample test (bstackdemo add-to-cart) + local test (BrowserStack Local via
bs-local.com:45454), browserstack.yml, 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>
@saraswati-padmawar saraswati-padmawar requested a review from a team as a code owner June 30, 2026 08:16
saraswati-padmawar and others added 3 commits June 30, 2026 14:04
The Node SDK's jest flow gates Playwright support on resolving @playwright/test
from node_modules (src/bin/jest/command.js: getPackageVersion('@playwright/test')).
With only 'playwright' installed, detection never fired, the SDK skipped its
BrowserType.launch patch, and chromium.launch() ran locally instead of routing to
BrowserStack. Switch the dependency and imports to @playwright/test.

Verified: chromium.launch() now routes to wss://cdp.browserstack.com/playwright.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirrors browserstack/node-js-playwright-browserstack. Runs the public bstackdemo
sample test + BrowserStack Local test 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>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant