Skip to content

Merge fix/sdk-7270-mid-test-reload-session-name - #164

Merged
bsautomation merged 2 commits into
sdk_v9_pre_prodfrom
fix/sdk-7270-mid-test-reload-session-name
Aug 25, 2026
Merged

Merge fix/sdk-7270-mid-test-reload-session-name#164
bsautomation merged 2 commits into
sdk_v9_pre_prodfrom
fix/sdk-7270-mid-test-reload-session-name

Conversation

@bsautomation

Copy link
Copy Markdown

Merge into sdk_v9_pre_prod :by automationbs

harshit-browserstack and others added 2 commits August 24, 2026 17:20
Follow-up to #148. @wdio/mocha-framework binds beforeTest to the test function
itself (wrapGlobalTestMethod), so onBeforeTest is the single per-test naming
opportunity and it has already passed by the time the test body calls
browser.reloadSession(). The replacement session is never registered in
sessionMap, so flushSessionName() returns early on !sessionData and the
onAfterExecute sweep -- which iterates the same map -- misses it too.
service.onReload learns the new session id but only renames the outgoing one,
leaving the live session on its creation-time sessionName capability.

onAfterTest now re-resolves the live session id and adopts it into sessionMap
before flushing the name, while that session is still open. The naming block is
gated on skipSessionName rather than skipSessionStatus and sits above the status
gate: gating a name repair behind a status flag would skip it for
setSessionStatus:false users, and adopting unconditionally would pull
setSessionName:false users into sessionMap and start issuing them a status PUT
per session where they previously had none.

Adoption also records the test result, so the post-reload session's status is
marked at teardown instead of being dropped by the old `if (sessionData)` guard.
Steady state costs nothing extra -- appliedName de-dupes the flush when the
session did not change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@bsautomation
bsautomation requested a review from a team as a code owner August 25, 2026 13:19
@bsautomation
bsautomation requested review from dandonarahul2002 and rounak610 and removed request for a team August 25, 2026 13:19
@bsautomation
bsautomation merged commit 4a4d66b into sdk_v9_pre_prod Aug 25, 2026
18 of 21 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