Add Jest sample for Selenium load testing#6
Conversation
Adds a jest/ folder mirroring the per-framework layout used by java/, junit-4/, junit-5/, and testng/. Tests use selenium-webdriver against the BrowserStack pod's hub at localhost:4444/wd/hub and target bstackdemo.com for add-to-cart and full checkout flows, parity with the WebdriverIO public sample. - jest/browserstack-load.yml — Selenium + framework: jest, vus: 1, duration: 1m, us-east-1, references jest.config.js - jest/package.json — jest + selenium-webdriver - jest/jest.config.js — node env, runInBand-friendly - jest/tests/add-to-cart.test.js — bstackdemo add-to-cart - jest/tests/checkout.test.js — bstackdemo full checkout flow - jest/README.md — 5-step setup (clone, npm install, CLI, run, dashboard) - .gitignore — Node artifacts (node_modules, lockfiles)
jhawarchirag
left a comment
There was a problem hiding this comment.
Reviewed against the four existing samples (java/, junit-4/, junit-5/, testng/) to keep this consistent with what customers already see in the repo. Three changes needed before merge — all are parity gaps with the sibling samples, not new conventions:
- Checkout test has no
expect()and a different final-step flow than siblings — see inline comment oncheckout.test.js. - Driver lifecycle is
beforeAll/afterAll; siblings re-create per test. - Implicit wait +
window().maximize()missing.
Non-blocking (pre-existing repo-wide, not introduced by this PR but worth a follow-up): brittle selectors (#\\33, react-select-2-option-0-0, deep float-cart chain), hardcoded sleep(500) after login, README OS↔arch swap in Linux binary links. These appear in every sample — best handled in a separate cleanup PR across all frameworks.
- Per-test driver lifecycle (beforeEach/afterEach) instead of beforeAll/afterAll - Add 10s implicit wait + window maximize after build - Assert on order confirmation message; drop trailing Continue/Orders xpath clicks Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirror the known-working load-testing-backend/sample/jest-selenium scripts: - add-to-cart: wait for elements to be visible before reading text (fixes the empty cart-title race the reviewer hit), use the short descendant selector, beforeAll/afterAll session. - checkout: wait for the cart overlay to open before closing, route the tail through Continue Shopping -> Orders, wrap interactions in located/visible/enabled waits. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Updated ( add-to-cart.test.js
checkout.test.js
Note: I haven't executed these locally (no Selenium hub on hand) — verified by matching the flow line-for-line against the known-working sample. Best to confirm with a CLI/pod run before merge. |
Adds a jest/ folder mirroring the per-framework layout used by java/, junit-4/, junit-5/, and testng/. Tests use selenium-webdriver against the BrowserStack pod's hub at localhost:4444/wd/hub and target bstackdemo.com for add-to-cart and full checkout flows, parity with the WebdriverIO public sample.