Skip to content

When uses cy.screenshot doesn't attach in mochawesome report #29825

Open
@lhidalgomqa

Description

@lhidalgomqa

Current behavior

Hello,
we are using mochaawesome report.
In reality, we use the multireporter to generate JSON and XML files, which in turn perform the task of reporting XML results to AIO Test management in Jira and we merge the JSON format so that an HTML is generated, since it is not possible to generate an HTML with all the tests, since the tests are overwritten, so if we used HTML for the report directly, only one test would be shown. So we generate a JSON report for each test and then merge it into HTML. In this HTML, we always show screenshots of the testing process. I found a way to attach the tests if the test fails and works correctly, however, I have not found a way to override cy.screenshot to indicate the path to context (mochaawesome) and have it attached correctly in the HTML report.

  1. We need to generate an HTML directly without having to merge all the JSON generated from the tests, where the screenshots could be attached correctly in this HTML.
    2.I have noticed that if we use ":" (colon) in the test it and the test fails, the screenshot is not attached correctly.
  2. What way is there for mochaawesome to recognize the images by default that we attach in the tests and display them in the HTML? Since I have tried to use the code for when the test fails, make an else for when the test works, however, it is not valid.
  3. Sometimes mochaawesome does not update or accept the configuration that you are passing through cypress.config.js. We have realized that the assets, unless you pass them by parameter, often do not comply with these configurations.
  4. We believe that mochaawesome or cypress is not correctly passing the cy.screenshot parameters in the paths to attach the images.
  5. We need an easy and direct way to attach the screenshots from the context in JSON format or for you to provide us with how to generate an HTML of all the tests along with an XML of the tests.
  6. If the screeenshot is attach because the test failed, we need take the "screenshots" folder and attach into a zip with the report html because if not take the screenshot folder, the screenshots doesnt view in the html and "embebedScreenshot" is not work propertly.
    We provide a test project so that it can be check and tested.
    Thank you in advance.
    Best regards.

Desired behavior

Cypress should attach correctly the screenshot in the report.

Test code to reproduce

framework-with-bug-screenshots.zip
Attach a framework with the problem.

Cypress Version

13.12.0

Node version

20.14.0

Operating System

windows 10

Debug Logs

No have logs because doesn't return any error.

Other

If you check the screenshot route (example):
http://127.0.0.1:5501/1_busqueda_guia_medica.cy.js/0_login.png,/1_busqueda_guia_medica.cy.js/screenshots.png,/1_busqueda_guia_medica.cy.js/1_acceso_guia_medica.png,/1_busqueda_guia_medica.cy.js/cypress/resultados/screenshots.png,/1_busqueda_guia_medica.cy.js/2_busqueda_producto.png,/1_busqueda_guia_medica.cy.js/3_medicos_y_centros.png,/1_busqueda_guia_medica.cy.js/4_1_busqueda_medico_o_centro.png,/1_busqueda_guia_medica.cy.js/4_2_busqueda_correcta.png
But the screenshot is located in: C:\Users\lhidalgom\Documents\workspace\infra\mediadores-multireporter\cypress\resultados\screenshots\1_busqueda_guia_medica.cy.js\4_2_busqueda_correcta.png

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/reporterThis is due to an issue in the packages/reporter directorytype: enhancementRequested enhancement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions