Skip to content

fix(cli): end a test after its TEST/POST observers so a11y scan/save stay inside it - #384

Closed
kamal-kaur04 wants to merge 3 commits into
mainfrom
fix/a11y-save-inside-test-window-v10
Closed

kamal-kaur04 wants to merge 3 commits into
mainfrom
fix/a11y-save-inside-test-window-v10

Conversation

@kamal-kaur04

Copy link
Copy Markdown
Collaborator

What is this about?

Port of #358 (v9, released in 9.44.2) to main, the 10.x line. It replaces #357, which was closed when the fix shipped on v9 first.

On the CLI (binary) flow, a test's test_ended_at was stamped in trackEvent(TEST, POST) before the TEST/POST observers ran. The accessibility module's pre-save scan and save run in those observers, so they landed after the test's reported finish time.

On the non-CLI path the order was the other way round: the accessibility handler's afterScenario/afterTest (scan + save) ran first, and the test finished after it. Anything that attributes accessibility scans to a test by its started/finished window drops them on the CLI flow. That is most visible when accessibility is scoped to tagged tests via includeTagsInTestingScope.

Change (same as #358)

  • Cucumber: test_ended_at is restamped after the TEST/POST observers. TestHubModule holds the TestRunFinished send while the framework runs the observers, and the framework releases it from a finally block, still within the same afterScenario. If the release is ever skipped, the existing next-test / worker-end flush sends the held finish.
  • Mocha: the TestRunFinished send is already deferred past afterEach and read at send time, so test_ended_at is just restamped after the observers.
  • The original stamp before the observers is kept as a fallback. The hold signal travels in the observer args, not in the instance data, so the event payload sent to the binary is unchanged. BEFORE_ALL cascade-skip rows are unaffected.

Both v9 commits (097625a, and the test follow-up 75499f5) cherry-picked onto current main without conflicts. Nothing in them depends on the WebdriverIO version.

Verification

Related Jira task/s

  • N/A (tracked internally)

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)

  • Fixed accessibility results being attributed outside the test that produced them when using tag-scoped accessibility testing on the BrowserStack CLI flow.

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

Checklist

  • Ready to review
  • Has it been tested locally?

PR Validations

Run Tests: Comment RUN_TESTS to trigger sanity tests.

🤖 Generated with Claude Code

kamal-kaur04 and others added 2 commits November 25, 2026 19:48
On the CLI flow, test_ended_at was stamped before the TEST/POST observers ran,
so the accessibility pre-save scan and save landed after the test's finish
time. Restamp ended_at once the observers have run; for cucumber, hold the
TestRunFinished send until then and release it from a finally block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 7dd78e4)
(cherry picked from commit 097625a)
Count the send right after releaseHeldFinish and before the worker-end flush,
and make the observers' elapsed time explicit in the mocha ended_at test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 75499f5)
@coderabbitai

coderabbitai Bot commented Nov 25, 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

  • Source mode: Auto (fallback from Default branch)
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML (base), Organization UI (inherited), Workspace UI (inherited); Enforced overrides: Organization
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 64d7f450-adc4-4a8d-819d-9ec703cd69a6

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

@kamal-kaur04

Copy link
Copy Markdown
Collaborator Author

Combined into #388 with the other 10.x CLI follow-ups, so they review and release together. The commits are unchanged (cherry-picked onto current main).

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