CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

The test object in event.test.finished event received by event listeners has empty artifacts property when artifact present

Open ajeetd opened this issue 3 years ago • 0 comments

event.test.finished event has empty artifacts property when artifacts are present

The built in CLI reporter correctly outputs the artifacts in the console but a plugin listening for events receives an empty artifacts object ({}) in the test object rather than expected set of artifacts. This is observed for event.test.finished but also other events such as event.test.failed.

You can reproduce this behavior by running any test, making it fail and taking a screenshot on failure. The CLI reporter reports the artifact but events emitted do not.

  • CodeceptJS version: 3.3.4
  • NodeJS Version: 16.13.0
  • Operating System: macOS
  • Using Playwright

My expectation was the artifacts you should be present in the test object in the event emitted. Is this a bug or is my understanding of retrieving artifacts for a specific test from a plugin incorrect?

Output from

event.dispatcher.on(event.test.finished, (test) => {
        console.log("Test end")
        console.log(test)    
})

Output includes the test Object including: artifacts: {}

However, CLI reporter does output artifact in output:

Artifacts: screenshot: /.../output/Scenario_1.failed.png

ajeetd avatar Jul 18 '22 15:07 ajeetd