Skip to content

feat(helpers): acting CDP helpers, HelperCapabilities type, ARIA snapshots for CDP and Puppeteer - #5749

Merged
DavertMik merged 3 commits into
4.xfrom
feat/acting-helper-capabilities
Oct 11, 2026
Merged

DavertMik merged 3 commits into
4.xfrom
feat/acting-helper-capabilities

Conversation

@DavertMik

@DavertMik DavertMik commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

aiTrace crashed the whole run under Obscura and Lightpanda. This PR makes the CDP helpers first-class acting helpers, adds a typed capabilities contract for all acting helpers, and brings ARIA snapshots to Lightpanda, Obscura and Puppeteer so aiTrace, pageInfo and Decision can use them.

Fixes

  • Obscura and Lightpanda added to Container.STANDARD_ACTING_HELPERS. aiTrace, pageInfo, Decision, screenshot, pause, heal, expose and autoDelay now find them.
  • aiTrace called a nonexistent output.warn, so Could not load plugin aiTrace aborted container creation. It now prints the message instead.
  • CDPBrowser.saveScreenshot / saveElementScreenshot joined output_dir with absolute paths, so aiTrace step screenshots on Obscura were silently lost. They now resolve paths via screenshotOutputFolder, like Playwright.

CodeceptJS.HelperCapabilities

A new type in typings/index.d.ts that helper authors can implement:

interface HelperCapabilities {
  screenshot: boolean | null   // null = detected at runtime
  video: boolean | null
  trace: boolean
  aria: boolean
  layout?: 'real' | 'none' | null
  xpath?: 'native' | 'polyfill' | null
  innerText?: 'native' | 'computed' | null
}
Helper screenshot video trace aria
Playwright true true true true
Puppeteer true false true true (false on Firefox)
WebDriver / Appium true false false false
CDPBrowser (Obscura, Lightpanda, Kitesurf) detected detected false true

The screenshot plugin, captureSnapshot (aiTrace, pageInfo) and Decision skip screenshots and ARIA when a helper declares them false. Lightpanda no longer produces dangling screenshot links in traces.

ARIA snapshots

  • CDPBrowser.grabAriaSnapshot(locator = '//body') uses Accessibility.getFullAXTree (supported by Lightpanda and Obscura). It scopes to an element via DOM.describeNode → backendDOMNodeId.
  • Puppeteer.grabAriaSnapshot(locator = '//body') uses page.accessibility.snapshot({ root }).
  • lib/aria.js renders the engine's tree as a nested - role "name" list. Generic wrappers are dropped, and text that repeats its parent's name is skipped. The output is not normalized to Playwright's format, but it stays parseable by compactAriaSnapshot and diffAriaSnapshots.

Testing

  • test/unit/aria_test.js: CDP and Puppeteer trees, scoping, and compact/diff round-trip.
  • test/helper/webapi.js: #grabAriaSnapshot for every helper that supports it.
  • typings/tests/helper.types.ts: valid and invalid HelperCapabilities objects; npm run def and npm run dtslint pass.
  • Ran the checkout example on Lightpanda, Obscura and Puppeteer. grabAriaSnapshot() works on all three, and aiTrace writes an ARIA file per step on Lightpanda.

Not in this PR

  • video and trace are declared but not read yet; the screencast plugin still duck-types startScreencast.
  • Kitesurf is not in STANDARD_ACTING_HELPERS.
  • Obscura does not compute names from <label for>, so checkboxes and radios come out unnamed there.

🤖 Generated with Claude Code

DavertMik and others added 3 commits October 12, 2026 00:04
… for CDP and Puppeteer

- Add Obscura and Lightpanda to Container.STANDARD_ACTING_HELPERS so aiTrace,
  pageInfo, Decision, screenshot, pause and heal find them
- Fix aiTrace crashing container creation via missing output.warn
- Add CodeceptJS.HelperCapabilities type (screenshot, video, trace, aria +
  CDP-detected layout/xpath/innerText); Playwright, Puppeteer, WebDriver and
  CDPBrowser declare this.capabilities
- Add grabAriaSnapshot to CDPBrowser (Accessibility.getFullAXTree) and
  Puppeteer (page.accessibility.snapshot), rendered in Playwright's ARIA
  snapshot format by lib/aria.js
- Skip screenshots / ARIA in screenshot plugin, aiTrace and Decision when the
  helper declares the capability false
- CDPBrowser screenshots resolve paths via screenshotOutputFolder so absolute
  paths from aiTrace work

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ex in CDP snapshot

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Playwright

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DavertMik
DavertMik merged commit 326b27c into 4.x Oct 11, 2026
15 checks passed
@DavertMik
DavertMik deleted the feat/acting-helper-capabilities branch October 11, 2026 21:38
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