Skip to content

emit screenshot-on-failure in v8#7

Open
Bhargavi-BS wants to merge 2 commits into
v8from
fix/SDK-6277-wdio-screenshot-on-failure
Open

emit screenshot-on-failure in v8#7
Bhargavi-BS wants to merge 2 commits into
v8from
fix/SDK-6277-wdio-screenshot-on-failure

Conversation

@Bhargavi-BS

Copy link
Copy Markdown
Owner

…binary flow (SDK-6277)

In the v8 CLI/binary flow (BrowserstackCLI.isRunning()===true) the browser command/result listeners that capture a screenshot WebDriver command result were registered only in the !isRunning() branch, so a user's saveScreenshot()/ takeScreenshot() on failure was captured on the device but never forwarded to Test Observability (no TEST_SCREENSHOT event). v7 has no binary, so the listeners register and screenshots upload — hence works v7, broken v8.

Fix:

  • service.ts: register the command/result listeners in the CLI branch too.
  • insights-handler.ts: in CLI mode forward the screenshot to the binary over gRPC as a TEST_SCREENSHOT log via trackEvent(LOG) (the worker's direct-HTTP upload is not authorized in the v8 central-auth flow); skip the direct per-command HTTP log in CLI mode.
  • wdioMochaTestFramework.ts: honor the incoming logEntry.kind (default TEST_LOG) so the screenshot keeps kind TEST_SCREENSHOT.

Verified end-to-end against a v8 repro: cloud accepted the screenshot upload (server={"success":true}).

Proposed changes

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

  • This change is solely for v9 and doesn't need to be back-ported
  • Back-ported PR at #XXXXX

Further comments

Reviewers: @webdriverio/project-committers

…binary flow (SDK-6277)

In the v8 CLI/binary flow (BrowserstackCLI.isRunning()===true) the browser
command/result listeners that capture a screenshot WebDriver command result
were registered only in the !isRunning() branch, so a user's saveScreenshot()/
takeScreenshot() on failure was captured on the device but never forwarded to
Test Observability (no TEST_SCREENSHOT event). v7 has no binary, so the
listeners register and screenshots upload — hence works v7, broken v8.

Fix:
- service.ts: register the command/result listeners in the CLI branch too.
- insights-handler.ts: in CLI mode forward the screenshot to the binary over
  gRPC as a TEST_SCREENSHOT log via trackEvent(LOG) (the worker's direct-HTTP
  upload is not authorized in the v8 central-auth flow); skip the direct
  per-command HTTP log in CLI mode.
- wdioMochaTestFramework.ts: honor the incoming logEntry.kind (default TEST_LOG)
  so the screenshot keeps kind TEST_SCREENSHOT.

Verified end-to-end against a v8 repro: cloud accepted the screenshot upload
(server={"success":true}).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@xxshubhamxx xxshubhamxx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run a quick sanity test on TRA and confirm that screenshots are being uploaded and received correctly from our side.

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.

3 participants