Skip to content

feat: live Test Reporting ingestion in TestReportingClient; report CI results to TRA - #34

Merged
shirish87 merged 8 commits into
mainfrom
claude/project-thread-vtv03a
Oct 4, 2026
Merged

shirish87 merged 8 commits into
mainfrom
claude/project-thread-vtv03a

Conversation

@shirish87

@shirish87 shirish87 commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Requested by Shirish · project thread

Before: TestReportingClient's ingestion methods (startBuild, startTestRun, finishTestRun, hooks, addBuildLogs, finishBuild) did not work against the live service, and CI test results lived only in GitHub Actions logs.

After: those methods work live with their existing signatures, and this repo's CI streams its own test results to BrowserStack Test Reporting & Analytics (dogfooding). Each CI job shows up as a build named CI #<run> (<branch>) [<os>], with each test reported as it runs, including failure messages, stack traces, console output, unhandled errors, and CI, PR and commit info.

Why: the documented ext/v1 ingestion endpoints reject basic auth on the collector. The working protocol is the one BrowserStack's SDKs (e.g. WebdriverIO) use: POST /api/v2/builds returns a build id and a JWT, events go to /api/v1/batch, and PUT /api/v1/builds/{id}/stop ends the build.

How:

  • TestReportingClient overrides the ingestion methods (same signatures) using that protocol. It adds an ingestBaseUrl option and two calls taken from WebdriverIO: linkTestRunSession (CBTSessionCreated) and addTestScreenshots.
  • scripts/ci-report/tra-reporter.mjs is a vitest reporter built on those methods. It is best-effort: errors are logged and swallowed, and it is disabled when credentials are absent (fork PRs), so BrowserStack being unreachable cannot fail CI.
  • main.yml runs it in the Linux SDK job and the macOS/Windows CLI jobs via --reporter=./scripts/ci-report/tra-reporter.mjs with TRA_LABEL. publish-docs dependencies and cli-e2e tests are untouched.
  • Versions bumped 7.1.1 to 7.2.0.

Tests: unit tests for the ingestion methods and the reporter, plus a live end-to-end test (skipped without credentials) that reports a passed and a failed test and reads the counts back. The old mocked ext/v1 start/finish tests were replaced.

Not done: Test Management reporting.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WUdwzfDSUhTEqqEWDhi6tB

@shirish87 shirish87 self-assigned this Oct 4, 2026
claude added 2 commits October 4, 2026 20:17
Replaces the JUnit upload. Reports CI/PR/commit info and per-test errors and
stack traces. Note: builds/start currently returns 400 against the live API.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUdwzfDSUhTEqqEWDhi6tB
…ort logs and errors from CI

Ingestion endpoints (start/finish build, test and hook runs, build logs) live on
collector-observability.browserstack.com, not api-automation. Adds an sdkIngest
base URL (ingestBaseUrl option) and has the CI reporter send console output,
failure stack traces and unhandled errors as build logs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUdwzfDSUhTEqqEWDhi6tB
@shirish87
shirish87 deployed to BrowserStackEnv October 4, 2026 20:27 — with GitHub Actions Active
@shirish87
shirish87 deployed to BrowserStackEnv October 4, 2026 20:29 — with GitHub Actions Active
claude added 2 commits October 4, 2026 20:34
The documented ext/v1 ingestion endpoints reject basic auth on the collector.
Use the flow the BrowserStack SDKs use: POST /api/v2/builds (basic auth) returns
a build id and JWT, events go to /api/v1/batch with the JWT, then the build is
stopped. Reverts the earlier sdkIngest base URL change. Adds unit tests and a
live end-to-end test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUdwzfDSUhTEqqEWDhi6tB
The package builds declarations without Node types; use core's auth helpers
(btoa-based) instead of process.env and Buffer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUdwzfDSUhTEqqEWDhi6tB
claude added 2 commits October 4, 2026 20:46
…on link and screenshots

TestReportingClient's startBuild/startTestRun/finishTestRun/hook/addBuildLogs/finishBuild
now use the collector protocol the BrowserStack SDKs use (build start returns a JWT,
events go to /api/v1/batch, build stop), keeping their signatures. Adds
linkTestRunSession (CBTSessionCreated) and addTestScreenshots, as WebdriverIO sends them.
Drops the separate ingest client.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUdwzfDSUhTEqqEWDhi6tB
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUdwzfDSUhTEqqEWDhi6tB
@shirish87 shirish87 changed the title ci: report test results to BrowserStack TRA via our own SDK feat: live Test Reporting ingestion in TestReportingClient; report CI results to TRA Oct 4, 2026
@shirish87
shirish87 marked this pull request as ready for review October 4, 2026 20:48
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUdwzfDSUhTEqqEWDhi6tB
@shirish87
shirish87 merged commit b4a002c into main Oct 4, 2026
4 checks passed
@shirish87
shirish87 deployed to BrowserStackEnv October 4, 2026 20:58 — with GitHub Actions Active
@shirish87
shirish87 deployed to BrowserStackEnv October 4, 2026 21:02 — with GitHub Actions Active
@shirish87
shirish87 deployed to BrowserStackEnv October 4, 2026 21:02 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
BrowserStackEnv — b669ed63 Deployed Oct 4, 2026 by shirish87 via Test CLI (macos-latest) #199
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.

2 participants