{"id":51528760,"url":"https://github.com/browserstack/behave-playwright-browserstack","last_synced_at":"2026-07-09T00:31:50.951Z","repository":{"id":355794750,"uuid":"1228565401","full_name":"browserstack/behave-playwright-browserstack","owner":"browserstack","description":"Sample repo for customers","archived":false,"fork":false,"pushed_at":"2026-06-19T13:11:30.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-28T23:02:23.748Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/browserstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-04T06:35:42.000Z","updated_at":"2026-06-19T13:12:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/browserstack/behave-playwright-browserstack","commit_stats":null,"previous_names":["browserstack/behave-playwright-browserstack"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/browserstack/behave-playwright-browserstack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fbehave-playwright-browserstack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fbehave-playwright-browserstack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fbehave-playwright-browserstack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fbehave-playwright-browserstack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browserstack","download_url":"https://codeload.github.com/browserstack/behave-playwright-browserstack/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browserstack%2Fbehave-playwright-browserstack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35282897,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-09T00:31:49.847Z","updated_at":"2026-07-09T00:31:50.939Z","avatar_url":"https://github.com/browserstack.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"behave-playwright-browserstack (BrowserStack SDK + Playwright)\n===============================================================\n\nThis repo shows how to run [behave](https://behave.readthedocs.io/) tests on BrowserStack using the [BrowserStack Python SDK](https://pypi.org/project/browserstack-sdk/) and [Playwright Python](https://playwright.dev/python/). The SDK handles capability injection, BrowserStack routing for Playwright launches, parallelization, and BrowserStack Local for you — you describe platforms once in `browserstack.yml` and run the test command unchanged.\n\n## Setup\n* Clone this repo\n* Install dependencies (creates the BrowserStack SDK CLI on `PATH` and downloads Playwright Chromium)\n  ```sh\n  pip install -r requirements.txt\n  playwright install chromium\n  ```\n* Set `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` as environment variables, or replace `userName` and `accessKey` directly in `browserstack.yml` with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings). Env vars take precedence.\n\n### Running your tests\nThere are two sample scenarios in `features/`:\n\n* **`features/sample.feature`** — drives `https://www.bstackdemo.com` (a public site) and adds a product to the cart.\n* **`features/local.feature`** — drives `http://bs-local.com:45454/` through the BrowserStack Local tunnel; verifies the page title contains \"BrowserStack Local\".\n\n`browserstack.yml` enables `browserstackLocal: true`, so the SDK starts and stops the BrowserStack Local tunnel for you on every run — no manual binary lifecycle.\n\n#### Sample test (public site)\nRuns in parallel across the 3 Playwright browser engines (chromium / firefox / webkit) declared in `browserstack.yml`:\n\n```sh\nbrowserstack-sdk behave features/sample.feature\n```\n\n#### Local test (private / localhost host)\nStart a local HTTP server first — `features/local-html/` contains a tiny page titled \"BrowserStack Local Test Page\":\n\n```sh\npython3 -m http.server 45454 --directory features/local-html\n```\n\nThen in a separate terminal:\n\n```sh\nbrowserstack-sdk behave features/local.feature\n```\n\n`bs-local.com` is a hostname BrowserStack Local resolves to your machine inside the remote browser — for your own app, point your scenarios at `http://bs-local.com:\u003cport\u003e/` instead of a public URL.\n\nUnderstand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github).\n\nAlternatively the variables can be set in the environment using env or your CI framework (like GitHub Actions or Jenkins). See `.github/workflows/build.yml` for a GitHub Actions example — it runs on `workflow_dispatch` (manual trigger) with a commit SHA input and posts a status check back to that commit.\n\n### How the SDK changes things\n- **One `browserstack.yml`** declares platforms; the SDK picks them up automatically.\n- **The SDK runs platforms in parallel for you** — no hand-rolled parallel runner; the SDK forks one behave run per `(platform × parallelsPerPlatform)` cell.\n- **The SDK monkeypatches Playwright's browser launches** — the test code calls `chromium.launch()` and the SDK transparently routes the launch to the per-platform browser configured in `browserstack.yml` (chromium, firefox, or webkit). No `chromium.connect(wss_url)` plumbing is needed in customer code.\n- **The CLI is `browserstack-sdk behave …`** — wraps `behave` and injects the SDK at runtime.\n\n### Repo layout\n```\n.\n├── browserstack.yml           # SDK config: credentials, 3 parallel platforms, Local toggle, reporting\n├── requirements.txt\n└── features/\n    ├── sample.feature         # bstackdemo add-to-cart scenario\n    ├── local.feature          # BrowserStack Local tunnel scenario\n    ├── local-html/\n    │   └── index.html         # static page served on :45454 for local.feature\n    ├── environment.py         # behave hooks: launch browser, hand to context.page\n    └── steps/\n        ├── sample_steps.py\n        └── local_steps.py\n```\n\n### Further Reading\n- [behave](https://behave.readthedocs.io/)\n- [Playwright Python](https://playwright.dev/python/)\n- [BrowserStack documentation for Playwright](https://www.browserstack.com/docs/automate/playwright)\n- [BrowserStack Python SDK on PyPI](https://pypi.org/project/browserstack-sdk/)\n\nHappy Testing!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserstack%2Fbehave-playwright-browserstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowserstack%2Fbehave-playwright-browserstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowserstack%2Fbehave-playwright-browserstack/lists"}