Skip to content

Failed tests lose all artifacts when retries are enabled #5689

Description

@gololdf1sh

Bug

With retry enabled every failed test ends up with empty test.artifacts — screenshot/video are lost, reporters get nothing to upload.
Console shows TypeError: originalTest.artifacts is not iterable for each retried test.

Root cause

  1. lib/listener/retryEnhancer.js copies artifacts with array spread [...originalTest.artifacts], but artifacts is an object map ({screenshot: path}). The spread throws, copyCodeceptJSProperties aborts mid-loop and the retried test never gets enhanceMochaTest() — so the retried attempt can't record artifacts either.
  2. screencast plugin's ensureArtifactsObject() replaces array-shaped artifacts with {}, dropping the screenshot key already written by the screenshot plugin.

Repro

4.0.8 and 4.1.0: Playwright helper + plugins screenshot and screencast (on=fail) + retry: 1. Any failing test → TypeError in console, no screenshot saved, empty artifacts in report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions