Skip to content

feat(plugins): unify screenshot/pause/aiTrace/heal under shared on= parameter#5542

Merged
DavertMik merged 8 commits into4.xfrom
feat/unified-plugin-on-param
Apr 29, 2026
Merged

feat(plugins): unify screenshot/pause/aiTrace/heal under shared on= parameter#5542
DavertMik merged 8 commits into4.xfrom
feat/unified-plugin-on-param

Conversation

@DavertMik
Copy link
Copy Markdown
Contributor

Summary

  • Unifies four plugins (screenshot, pause, aiTrace, heal) under one on= trigger system: fail | test | step | file | url. CLI form is -p plugin:on=mode:key=value:key=value (or ; to inline-group sub-keys like path + line); config form is the equivalent object.
  • Adds a shared lib/utils/pluginParser.js (parsePluginArgs, resolveTrigger, matchStepFile, matchUrl, getBrowserHelper) — replaces duplicated parsing/matching code across the four plugins.
  • Renames screenshotOnFailscreenshot and consolidates pauseOn + pauseOnFailpause; old names remain as deprecated alias shims that warn and forward (positional CLI args translate to the new on=key:param=value syntax).

Behavior

Plugin Default on Modes accepted
screenshot fail fail, test, step, file (path[, line]), url (pattern)
pause fail fail, test, step, file (path[, line]), url (pattern)
aiTrace step fail, test, step, file (path[, line]), url (pattern)
heal fail fail (default), file (path[, line]), url (pattern)

heal:on=step and heal:on=test are rejected with a clear error.

CLI examples

npx codeceptjs run -p screenshot:on=step
npx codeceptjs run -p pause:on=file:path=tests/login_test.js;line=43
npx codeceptjs run -p aiTrace:on=fail
npx codeceptjs run -p heal:on=url:pattern=/users/*

Companion change

@codeceptjs/configure setCommonPlugins is updated to register the new plugin names with their on= defaults; old keys are removed there (the alias shims still load if a user references them directly).

Test plan

  • Parser unit smoke (CLI parsing, precedence, line coercion) — 11/11 pass
  • npx mocha test/unit --recursive — 611 passing, no plugin regressions
  • Existing screenshotOnFail and aiTrace unit tests pass through the alias / new code path unchanged
  • Acceptance config loads the new plugin (Plugins: screenshot, retryFailedStep, pause, heal)
  • Validation: -p screenshot:on=file (missing path=) prints the expected error
  • Deprecation aliases load and emit deprecation warnings
  • Full Playwright acceptance run against the test web server (not exercised here — server wasn't available locally)

🤖 Generated with Claude Code

DavertMik and others added 8 commits April 26, 2026 22:27
…arameter

Adds a shared lib/utils/pluginParser.js with key=value parsing (`:` and `;`
separators) and a `resolveTrigger` helper. Renames screenshotOnFail → screenshot
and consolidates pauseOn/pauseOnFail → pause; aiTrace and heal grow `on=` filters.
Old plugin names live on as deprecated alias shims that warn and forward.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…shot

- Remove lib/plugin/pauseOn.js (never shipped in a public release).
- Remove lib/plugin/stepByStepReport.js; slideshow generation moves into the
  screenshot plugin behind slides=true (e.g. -p screenshot:on=step;slides=true)
  with a modern, vanilla-CSS dark UI — no Bootstrap, no jQuery.
- Drop the redundant screenshot blocks from the acceptance test configs; the
  default in lib/config.js already enables screenshot with on=fail.
- Strip allure mentions from plugin code and plugin docs; refresh PR template,
  migration guide, debugging guide, plugins index, and commands docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
resolveTrigger now takes { name, validModes }, performs the unknown-mode
and missing-path/pattern checks itself, prints the error via output.error,
and returns null. Each plugin shrinks to one call + early-return; heal
passes its narrower mode list as { validModes: ['fail', 'file', 'url'] }.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@DavertMik DavertMik merged commit 87a25ad into 4.x Apr 29, 2026
10 checks passed
DavertMik added a commit that referenced this pull request Apr 29, 2026
* feat(plugins): add screencast plugin (replaces subtitles)

New `screencast` plugin built on Playwright 1.59's page.screencast API.
Records WebM video with optional burn-in action captions (showActions) and
optional standalone .srt subtitles. Wires into the unified `on=` parameter
introduced in #5542 with two valid modes: `on=fail` (default; deletes the
recording on pass) and `on=test` (always keeps).

- Replaces and removes the legacy `subtitles` plugin and its test
- Bumps `playwright` devDependency to 1.59.0 (required for page.screencast)
- Adds 8 unit tests covering modes, captions, subtitles, video=false fallback,
  missing-API guard, invalid-mode rejection
- Updates examples/codecept.config.js to swap subtitles for screencast
- Documents the plugin in docs/plugins.md and docs/playwright.md, including
  the empirically-verified "two videos" note when helper video:true and the
  plugin are enabled together

Verified against a real Playwright 1.59 run: produces output/screencast/*.webm
plus *.srt; coexists with helper recordVideo without conflict.

* Apply suggestion from @DavertMik

* Apply suggestion from @DavertMik

* fix(playwright): port React locator off removed _react= engine; drop Vue

Playwright 1.59 removed the experimental `_react=` and `_vue=` selector
engines, which broke `{ react: ... }` and `{ vue: ... }` locators with:

  locator.all: TypeError: Cannot read properties of undefined
    (reading 'queryAll')
    at InjectedScript._queryEngineAll

Reimplemented React locators on top of the `resq` library + `page.evaluateHandle`
(the same approach the Puppeteer helper already uses). Dropped Vue locator
support entirely — there is no in-deps equivalent to resq for Vue, and the
public surface was minimal.

- lib/helper/extras/PlaywrightReactVueLocator.js: rewrite findReact via resq;
  remove findVue
- lib/helper/Playwright.js: remove findVue import and Vue branches in
  findElements / findElement
- test/acceptance/react_test.js: remove the third scenario that used the
  raw `{ pw: '_react=...' }` form (no longer valid syntax)
- test/unit/locator_test.js: drop `pw: '_react=button'` and
  `pw: '_vue=button'` cases
- typings/index.d.ts: drop `{ vue: string }` from ILocator
- docs/locators.md: update note to remove `_react`/`_vue` mentions

Verified end-to-end against Playwright 1.59:
  React Selectors
    ✔ props @puppeteer @playwright (3.7s)
    ✔ component name @puppeteer @playwright (3.4s)

---------

Co-authored-by: DavertMik <davert@testomat.io>
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