Skip to content

Test level custom metadata#76

Merged
Dalwin-Barnard merged 2 commits into
sdk_v9_pre_prodfrom
test_level_custom_metadata
Jul 22, 2026
Merged

Test level custom metadata#76
Dalwin-Barnard merged 2 commits into
sdk_v9_pre_prodfrom
test_level_custom_metadata

Conversation

@Dalwin-Barnard

Copy link
Copy Markdown

What is this about?

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)

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.

anish353 and others added 2 commits July 17, 2026 17:33
…(beforeEach/afterEach) for WDIO+Mocha

Adds correct beforeEach/afterEach hook-timing handling for the setCustomTags
feature already on main. WDIO's Mocha runner fires user hooks OUTSIDE the SDK's
per-test tracking span: beforeEach runs before beforeTest tracks the test
instance, and afterEach runs after afterTest finishes it — so tags set in those
hooks previously either landed on the wrong test or missed the payload.

- Buffer tags set before a per-test context exists (e.g. from beforeEach) and
  flush them into the test at test start (a new TEST/PRE observer in
  CustomTagsModule minting an onBeforeTest flush).
- The service layer records the open Mocha hook window (beforeHook/afterHook) so
  CustomTagsModule can route a setCustomTags call to the right test.
- Defer the TestRunFinished (TEST/POST) send past the after-each hook window so
  tags set in afterEach still make the payload; flushed at the next test's
  boundary, or from service.after() for the worker's last test.

Ports webdriverio PR anish353/webdriverio#3 into the migrated standalone repo,
reconciling against pre-existing drift in testHubModule.ts and service.ts.
Standalone on main, independent of the title-based-TC work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
classifyMochaHookTitle matched hook-window phrases with substring .includes()
and checked "before each" first, so a custom-named hook whose title merely
contained another window's phrase (e.g. afterEach('reset before each run') ->
'"after each" hook: reset before each run') was misclassified as before_each and
its tag buffered onto the NEXT test instead of the current one.

Derive the window from getHookType, which anchors on Mocha's generated
'"before each"'/'"after each"' prefix via startsWith. This removes the
duplicated matching logic and guarantees the window and the tracked hook-state
(both computed from the same hook title in service.beforeHook) can never diverge.

Addresses the MEDIUM finding from the PR #60 review. Live-verified: a named
afterEach with a cross-phrase title now routes to the current test
(merged, window=AFTER_EACH) with zero before_each buffering, and the existing
union across body+afterEach is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Dalwin-Barnard
Dalwin-Barnard requested a review from a team as a code owner July 22, 2026 15:57
@Dalwin-Barnard
Dalwin-Barnard requested review from harshit-browserstack and yashdsaraf and removed request for a team July 22, 2026 15:57
@Dalwin-Barnard
Dalwin-Barnard merged commit 3dd9a2a into sdk_v9_pre_prod Jul 22, 2026
14 of 17 checks passed
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