Skip to content

SDK-7772 WDIO Jasmine v9 platformisation - #244

Open
AdityaHirapara wants to merge 27 commits into
mainfrom
SDK-7772/wdio-jasmine-platformisation
Open

AdityaHirapara wants to merge 27 commits into
mainfrom
SDK-7772/wdio-jasmine-platformisation

Conversation

@AdityaHirapara

@AdityaHirapara AdityaHirapara commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

What is this about?

Moves WebdriverIO + Jasmine (v9) from the legacy in-SDK flow onto the CLI/binary flow, at functional parity with legacy jasmine. Products: Test Observability, web Accessibility, Automate / App Automate session marking, and Percy. Legacy stays as the runtime fallback (binary unavailable, multiremote). Paired binary PR: browserstack/browserstack-binary#1837, which must be released first.

Jasmine on the CLI flow

  • jasmine is added to CLISupportedFrameworks, with a new WdioJasmineTestFramework.
  • Jasmine has two event sources, as legacy did. The WDIO reporter (not awaited) is the only site that sees pending, fit-excluded and beforeAll-failed specs, plus beforeAll/afterAll with their suite. The awaited service hooks are the only points with a live driver at each spec's start and end.
    • Both sources call trackEvent (the reporter with source: 'reporter').
    • Reporter events: the instance and uuid are minted synchronously, then sent to TestHub through an ordered queue.
    • Service events wait for the queued reporter events, reuse the same instance (matched by fullName), and reach Accessibility, Automate and Percy through the dispatcher with skipTestHub. TestHubModule ignores those events.
    • The reporter's isSynchronised drains the queue before the worker exits.
  • Automate: the session name is the describe chain, and sessionNameFormat, sessionNameOmitTestTitle and sessionNamePrependTopLevelSuiteTitle behave as on legacy. The session verdict is legacy service.after()'s rule, computed in AutomateModule from the inputs service.after(result) already tracks, and only the live session is marked (a reloaded one keeps its onReload mark).
  • Accessibility: the per-test gate uses the spec description. There is no pre-test scan window for jasmine, and hooks never gate, as on legacy.
  • Percy: testcase-mode snapshot names come from the spec title, as on legacy.

Shared CLI changes (all WDIO frameworks)

  • Command capture moved to TestHubModule. The WebDriver command/result listeners are registered once per browser at driver creation, instead of in service.before() and insights-handler. Each framework class decides which test or hook a log belongs to. The legacy path is untouched.
    • HTTP command logs are now reported on the CLI flow for mocha and cucumber too (previously only screenshots were). Mocha hook command logs go to their hook run, as on legacy.
  • Per-test Test: … annotation now comes from AutomateModule for mocha and jasmine, never cucumber. This restores mocha's annotation, which the CLI flow had dropped.
  • Test Plan ID: a CLI-arg --browserstack.testManagementOptions.testPlanId <id> is now sent as the id. Previously the binary received true from the space-separated form. Config and env variants are unchanged.
  • sessionNamePrependTopLevelSuiteTitle / sessionNameOmitTestTitle are kept out of capabilities.

Verification

  • Unit: 60 files / 1473 tests.
  • Jasmine vs legacy 9.39.0, local, on BrowserStack:
    • CP-1 Test Observability: test tree, hooks, results, 238/238 HTTP logs on the right specs.
    • CP-2 session marking: default, ignoreHooksStatus, setSessionStatus:false / setSessionName:false, reload, beforeAll failure.
    • Accessibility modes; Percy auto/click/testcase/manual; App Automate.
    • Fallback, multiremote and release-mode (obfuscated) binary.
  • BStackAutomation wdio_jasmine v9: wrapper_default, test_plan_id, nppp, session_marking_failed, percy_a11y_default, android/ios default.
  • Mocha and cucumber no-regression runs, plus their HTTP-log parity against pre-CLI legacy (mocha 9.20.1, cucumber 9.36.2).

Known issues (existing before this PR; tickets to follow)

  • A per-capability bstack:options.buildTag is dropped by the binary on the CLI flow, for every WDIO framework.
  • BrowserStack Local started through a proxy can hang on the CLI flow (no timeout on Local start in the binary).
  • Cucumber command logs inside Before/After hooks attach to the hook run; legacy attached them to the scenario.

Related Jira task/s

Release (mandatory for every PR — required for the ready-for-review label)

Version bump: (required — tick exactly one)

  • minor (backwards-compatible feature)
  • patch (bug fix or other small change)

Release notes type: (optional)

  • New Feature
  • Bug Fix
  • Other Improvement

Release notes (customer-facing): (optional but encouraged)

  • WebdriverIO with Jasmine (v9) now runs on the BrowserStack CLI: Test Observability, Accessibility, Automate/App Automate session status and naming, and Percy.
  • HTTP command logs now appear in Test Observability for WebdriverIO Mocha and Cucumber, and Mocha sessions show a per-test annotation again.
  • Fixed --browserstack.testManagementOptions.testPlanId <id> passed on the command line not reaching Test Management.

Release notes (internal): (required — engineer-facing; what actually changed / why)

  • Added WdioJasmineTestFramework and enabled jasmine in CLISupportedFrameworks. The reporter feeds TestHub through an ordered queue; awaited service hooks feed the Accessibility, Automate and Percy modules with skipTestHub.
  • Moved the jasmine session verdict into AutomateModule; service.after() passes legacy verdict inputs for jasmine only.
  • Moved WebDriver command/result capture from service.ts / insights-handler.ts into TestHubModule, with framework-class attribution. Enabled HTTP command logs for mocha and cucumber.
  • Moved the per-test annotation into AutomateModule (mocha + jasmine); skip reports are not annotated.
  • stripTestPlanIdArg removes the CLI-arg test plan id before forwarding argv to the binary. getBinConfig resolves it through getTestPlanId.
  • Requires the binary release from browserstack-binary#1837 (WebdriverIO-jasmine module and TestHub allow-list).

Checklist

  • Ready to review
  • Has it been tested locally?

PR Validations

Run Tests: Comment RUN_TESTS to trigger sanity tests.

🤖 Generated with Claude Code

AdityaHirapara and others added 11 commits September 26, 2026 08:41
…772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… CLI feed (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nly (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gs on CLI (SDK-7772)

- service hooks classify jasmine hooks by the WDIO hookName instead of the
  mocha title; the mocha skip cascade stays mocha-only
- beforeTest annotates each jasmine spec with `Test: <fullName>` on the CLI flow
- jasmine registers the command listener on the CLI flow; browserCommand sends
  HTTP command logs over gRPC (LogEntry kind HTTP) to the spec it names, and
  jasmine screenshots name their spec the same way
- the jasmine class sends a session event for every beforeAll/afterAll start so
  hook runs carry their platform and Automate session, as on the legacy flow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SDK-7772)

- WdioJasmineTestFramework keeps the legacy service.after() inputs: specs ran,
  the runner's failed-spec count, and the test and hook failure reasons of the
  live session in the order they happened
- AutomateModule marks a jasmine worker's live session with that verdict, in
  the legacy body shape {status, name, reason}; a session no spec registered is
  still marked and a reloaded session keeps the mark onReload sent
- ignoreHooksStatus is read from the worker's service options, because the
  binary config echo carries testObservabilityOptions empty
- other frameworks keep the existing per-test aggregation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…apabilities (port of 3cdbfec, SDK-7772)

Port of 3cdbfec from SDK-7606/wdio-cucumber-platformisation-v8.
sessionNamePrependTopLevelSuiteTitle and sessionNameOmitTestTitle reach the
outgoing capabilities on the CLI flow and the hub rejects the session
("additional properties [...] outside of the schema"). Both are read from
testContextOptions, so stripping them from the capabilities does not disable
either option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…K-7772)

The binary config echo cannot carry the sessionNameFormat function, so it
arrives empty and the session keeps its default name. For jasmine the
AutomateModule now takes the function from the worker's service options,
called as legacy did (no test title). Other frameworks are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- no scan window before the first jasmine spec, as the classic handler
  (PRE_TEST_SCAN_FRAMEWORKS excludes jasmine); mocha/cucumber keep it
- the include/exclude filter and the test name read the jasmine spec
  description when the test has no title

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… CLI (SDK-7772)

PercySDK attaches testCase from TestReporter.currentTest.name, which legacy
sets while building the TestRunStarted event. The jasmine CLI branch of
onTestStart returns before that, so CLI snapshots carried no testCase. It now
sets the name next to the CLI uuid. Mocha is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nary (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o the binary (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AdityaHirapara
AdityaHirapara requested a review from a team as a code owner September 29, 2026 05:01
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 163682af-8a31-4a6a-adbb-f1fdae062f26

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

AdityaHirapara and others added 15 commits September 29, 2026 20:21
… (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and insights-handler suites (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s session verdict to AutomateModule (SDK-7772)

The reporter now feeds WdioJasmineTestFramework through trackEvent with
source 'reporter'; reporter events are applied before trackEvent awaits,
and TEST PRE hands the minted uuid back on args.testUuid. TestHubModule is
wired once in loadModules instead of on every reporter event.

service.after() passes legacy's session verdict inputs (runner result,
specsRan and the three reason lists) on EXECUTE POST for jasmine only;
AutomateModule computes the verdict from them, so the framework class no
longer keeps verdict state. The pending-event counter and isIdle() are
per instance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chained toISOString (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SDK-7772)

The per-test `Test: <fullName ?? title>` Automate annotation moves from the
jasmine-only arm of service.beforeTest into AutomateModule.onBeforeTest, so
mocha on the CLI flow annotates its tests again, as it did on the legacy
flow. Cucumber keeps its own Feature/Scenario/Step annotations. Skip
reports carry `skipReport: true` on TEST/PRE and are not annotated, since
beforeTest never ran for a skipped test. A failed annotate is logged and
does not break the hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…772)

TestHubModule registers the command/result listeners once per browser on
driver creation, gated as before on shouldProcessEventForTesthub, and pairs
results on the live session id. Screenshots go to every framework and HTTP
command logs only to frameworks that opt in through
capturesHttpCommandLogs(), which only jasmine does. Entries carry
`commandLog: true` and the framework attributes them:

- jasmine sends them to the last started spec, cleared by an
  `<unknown test>` so they drop until the next spec, as the runner's own
  current test does
- cucumber drops them until a scenario has started
- mocha keeps its LOG rail, so a screenshot in a hook now attaches to the
  hook run as it did on the legacy flow

The service no longer registers CLI listeners, browserCommand keeps only
the legacy path, and setTestData no longer seeds the test map that only
the removed CLI gate read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and mocha hooks (SDK-7772)

Jasmine command logs follow the spec the service's latest beforeTest or
beforeHook named, resolved by full name when the command fires, rather than
the last spec the reporter started: a trailing pending or excluded spec
never takes the session teardown's commands, and a name with no minted spec
(`<unknown test>`, or none before the first spec) drops them. The
reporter's `<unknown test>` marker goes away.

A mocha command log taken while a hook is open carries that hook's id and
state, so the binary keys it to the hook run. Console logs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd logs (SDK-7772)

The hooks-started state is a Map, so the record-style lookup never found the
open hook and every mocha command log stayed on the test. Command logs now
read the open hook from the Map directly; console logs keep their path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mocha and cucumber now opt in to HTTP command logs on the CLI flow, as their
legacy flows reported them. As on legacy, they are sent only when LogCreated
events are on for the run. A mocha command log follows the hook or test that
started last, even after it finished, so a command after a hook (such as
the session teardown after `after all`) stays on that hook run as it did on
the legacy flow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…id (SDK-7772)

Legacy's beforeTest annotated the session before it registered the test,
so the annotation's HTTP log never reached Test Observability. The TEST/PRE
observers are that start-up on the CLI flow, so mocha now drops command logs
until they finish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t ran (SDK-7772)

A skip report moves mocha's tracked instance to the skipped test, so the
session teardown's HTTP log landed on a skipped test. A command log outside
any hook now goes to the last test that ran, as legacy's current test did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ork reports them (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…7772)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p (SDK-7772)

Co-Authored-By: Claude Opus 5.5 <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