cypress-mochawesome-reporter icon indicating copy to clipboard operation
cypress-mochawesome-reporter copied to clipboard

Special chars in screenshot urls aren't properly escaped

Open FRSgit opened this issue 1 year ago • 1 comments

Environment

- OS: MacOS 12.4
- Node: 16.16.0
- cypress-mochawesome-reporter: 3.2.2
- cypress: 10.7.0

What happened?

Image was not visible in the generated report due to improperly escaped special characters in the screenshot's name.

Screenshot file name: test-file#0 Generated img src: screenshots/spec.cy.js/test-file#0.png Expected img src: screenshots/spec.cy.js/test-file%230.png

Config file

No cypress.json in Cypress 10 anymore, but that's my cypress.config.js:

const { defineConfig } = require("cypress");

module.exports = defineConfig({
  reporter: 'cypress-mochawesome-reporter',
  e2e: {
    setupNodeEvents(on, config) {
      require('cypress-mochawesome-reporter/plugin')(on);
    },
    specPattern: "cypress/e2e/**/*.cy.{js,jsx,ts,tsx}"
  },

  component: {
    setupNodeEvents(on, config) {
      require('cypress-mochawesome-reporter/plugin')(on);
    },
    devServer: {
      framework: "vue-cli",
      bundler: "webpack",
    },
  },
});


### Relevant log output

_No response_

### Anything else?

_No response_

FRSgit avatar Sep 11 '22 20:09 FRSgit

I've prepared a branch with reproduction here: https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/tree/example/mochawesome-unescaped-chars To reproduce the bug:

  • checkout the linked branch,
  • install deps via yarn command
  • run command yarn test:e2e:ci
  • open up a report file and see that the image "is missing" though it was copied to the reports directory properly

FRSgit avatar Sep 11 '22 21:09 FRSgit

Should be fixed in v3.2.3.

Thank you for reporting this issue (:

LironEr avatar Oct 06 '22 18:10 LironEr

Nice, I've seen your PR - looks really nice. You don't even know how much will that help me with development of https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff ❤️

I'll come back to you when I test your solution a bit heavier 😄

FRSgit avatar Oct 06 '22 20:10 FRSgit

Should be fixed in v3.2.3.

Thank you for reporting this issue (: I updated it to 3.2.3, and I can still reproduce the problem, image

luqy avatar Oct 08 '22 02:10 luqy

@luqy maybe you have other issue, please provide an example so I can take a look.

LironEr avatar Oct 13 '22 15:10 LironEr