Skip to content

feat(browserstack-service): stamp hook_run_uuid on App A11y scans fired inside hooks [APPA11Y-5542]#48

Open
AakashHotchandani wants to merge 1 commit into
mainfrom
APPA11Y-5542-hook-scans-main
Open

feat(browserstack-service): stamp hook_run_uuid on App A11y scans fired inside hooks [APPA11Y-5542]#48
AakashHotchandani wants to merge 1 commit into
mainfrom
APPA11Y-5542-hook-scans-main

Conversation

@AakashHotchandani

Copy link
Copy Markdown
Collaborator

What

App A11y scans fired inside test hooks (before/after, beforeEach/afterEach) are dropped or misattributed today. This makes the SDK stamp the hook's run UUID (thHookRunUuid) on scans fired inside a supported hook.

How

  • util.ts_getParamsForAppAccessibility(commandName, testName, hookRunUuid?) adds thHookRunUuid (dropped by JSON.stringify when undefined, so in-test scans are byte-for-byte unchanged); performA11yScan(…, hookRunUuid?) threads it.
  • insights-handler.ts — expose getCurrentHook() so a11y reuses the same UUID reported to TestHub as HookRunStarted (= the hook's BTCER uuid).
  • accessibility-handler.tsbeforeHook/afterHook set _currentHookRunUuid for the hook window and, for mocha, enable the scan gate during hooks (per-test hooks honour include/exclude scope; suite hooks use autoScanning); commandWrapper passes the hook uuid into performA11yScan.
  • service.ts — wire accessibilityHandler.beforeHook/afterHook, passing the shared hook uuid.

Backend contract

SeleniumHub appAllyHandler (PR #14162, APPA11Y-5542-hook-run-uuid) destructures thHookRunUuid and relays it as hook_run_uuid; app-accessibility reconciles the scan onto the wrapping test via the BTCER self-join. Additive at every hop — no field ⇒ unchanged in-test behaviour.

Scope

Gated on frameworkSupportsHook (mocha before/after/beforeEach/afterEach; cucumber uuid-stamped, its scan gate stays owned by beforeScenario).

Tests

Added hook-scan unit tests (stamp/clear + unsupported-framework no-op). Note: local tsc couldn't fully run against a v8 node_modules on the v9 main base — CI validates on v9 deps.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

🤖 Generated with Claude Code

…ed inside hooks [APPA11Y-5542]

App A11y scans fired inside test hooks (before/after, beforeEach/afterEach) were
dropped or misattributed. The SDK now stamps the hook's run UUID (thHookRunUuid)
on scans fired inside a supported hook, so SeleniumHub (appAllyHandler, PR #14162)
relays it as hook_run_uuid and app-accessibility reconciles the scan onto the
wrapping test case. Additive: in-test scans are unchanged (field dropped when absent).

- util: _getParamsForAppAccessibility / performA11yScan thread optional hookRunUuid (thHookRunUuid)
- insights-handler: expose getCurrentHook() so a11y reuses the HookRunStarted uuid (= hook BTCER uuid)
- accessibility-handler: beforeHook/afterHook set _currentHookRunUuid + enable the scan gate during
  mocha hook windows (per-test hooks honour include/exclude scope; suite hooks use autoScanning)
- service: wire accessibilityHandler.beforeHook/afterHook, passing the shared hook uuid
- tests: cover hook-uuid stamp/clear + unsupported-framework no-op

Co-Authored-By: Claude Opus 4.8 (1M context) <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