Add BrowserStack SDK + Playwright behave sample#1
Open
Jimesh-browserstack wants to merge 1 commit intomainfrom
Open
Add BrowserStack SDK + Playwright behave sample#1Jimesh-browserstack wants to merge 1 commit intomainfrom
Jimesh-browserstack wants to merge 1 commit intomainfrom
Conversation
Provides customers with a working starting point for running behave tests on BrowserStack via Playwright Python and the BrowserStack Python SDK. Mirrors the shape of browserstack/cucumber-ruby-browserstack (browserstack-sdk-selenium-4 branch) but adapted for behave + Playwright: - One browserstack.yml at root declares 3 platforms covering all 3 Playwright browser engines (chromium / firefox / webkit). The SDK monkeypatches Playwright launches and routes to the per-platform browser, so customer code uses chromium.launch() unchanged across all three. - Alternate configs under config/ for single-platform and BrowserStack Local modes; Makefile swaps them in around the SDK call and restores the parallel default afterwards (even on failure). - Local mode self-tests: serves a small static page on :45454 from features/local-html/ and routes a localhost scenario through the BS Local tunnel that the SDK starts/stops automatically. - GitHub Actions workflow uses workflow_dispatch + commit_sha + check-status reporting, mirroring the cucumber-java-playwright-browserstack pattern. - Playwright pinned to ==1.49.0 because PW >=1.50 trips an SDK monkeypatch arg that no longer matches (`unexpected keyword argument 'artifactsDir'`). Verified end-to-end against BrowserStack: - make parallel: 3 sessions (chrome/pw-firefox/pw-webkit), all passed - make single: 1 chrome session, passed - make local: 1 session via Local tunnel against localhost:45454, passed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Customer-facing starting point for running behave tests on BrowserStack via Playwright Python and the BrowserStack Python SDK. Mirrors the shape of
browserstack/cucumber-ruby-browserstack(browserstack-sdk-selenium-4 branch) but adapted for behave + Playwright.What customers get
Three customer-facing entry points:
make parallel— runs across the three Playwright engine families (chromium / firefox / webkit) in parallel on BrowserStackmake single— one chromium platformmake local— one chromium platform + BrowserStack Local tunnel against a local HTTP server the Makefile spins up on:45454Design notes
features/environment.pycallschromium.launch()unconditionally; the SDK monkeypatches Playwright at runtime to route the launch to the per-platform browser configured inbrowserstack.yml. Nochromium.connect(wss_url)plumbing needed in customer code (this differs from the Java SDK behavior)../browserstack.yml, sosingleandlocalMake targets copy in alternates fromconfig/, run, and restore the parallel default afterwards (even on failure).make localserves a small static page onlocalhost:45454and routes a localhost-targeting scenario through the BS Local tunnel that the SDK starts/stops automatically.==1.49.0. PW>=1.50trips an SDK monkeypatch arg that no longer matches (unexpected keyword argument 'artifactsDir'). Comment inrequirements.txtexplains.cucumber-java-playwright-browserstackpattern:workflow_dispatchonly with acommit_shainput, posts check status back to that SHA. Nopush/pull_requesttriggers, so BrowserStack minutes aren't burned on every commit.Local verification (already complete)
Ran each Make target end-to-end against BrowserStack from a fresh clone with creds in env vars:
make parallelmake singlemake localCleanup checks on every run:
browserstack.ymlrestored to 3-platform default aftersingleandlocal, no leftover.bakfile, no orphanpython3 -m http.serveron:45454.CI verification (pending post-merge)
workflow_dispatchworkflows only become dispatchable from the Actions UI once they exist on the default branch — so CI can't be validated against this branch before merge. After merge, dispatch the workflow againstmainHEAD; if BrowserStack auth fails it means the org-level Actions secrets (BROWSERSTACK_USERNAME/BROWSERSTACK_ACCESS_KEY) aren't wired through to this repo and need to be added by an Actions admin (same setup ascucumber-java-playwright-browserstack).Test plan
make parallelruns all 3 platforms in parallel — see Build URL abovemake singleruns one chromium sessionmake localstarts BS Local tunnel, serves localhost page, scenario passesbrowserstack.ymlis restored aftersingle/local, no.bakleftoverpython3 -m http.serveron:45454aftermake localworkflow_dispatchruns green post-merge (pending — see "CI verification" above)🤖 Generated with Claude Code