Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error cy.task('copyScreenshot') failed with the following error: > ENOENT: no such file or directory, stat '(pathname)' when trying to run for the first time #99

Closed
faith-berroya opened this issue Aug 16, 2022 · 4 comments

Comments

@faith-berroya
Copy link

Hello. I tried to setup our project and added this plugin that uses baseline for visual testing. On my first run, instead of getting an image on my baseline folder, I'm getting this error. Did I miss a step? I have the folder in our repository, same path as to which the error is stating.

image

image

cypress.config.js

const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin')
module.exports = defineConfig({
  e2e: {
    async setupNodeEvents(on, config) {
        getCompareSnapshotsPlugin(on, config);

support/command.js

const compareSnapshotCommand = require('cypress-image-diff-js/dist/command')
compareSnapshotCommand()

support/e2e.js
require('./commands')

Script:

     assertHeaderAndFooterSnapshots(headingName){
        this.getHeadingHeader(headingName).eq(0)
            .scrollIntoView()
            .compareSnapshot('try', 0.1)
            .should('exist')
        this.getHeadingFooter(headingName).eq(0)
            .scrollIntoView()
            .compareSnapshot('try', 0.1)
            .should('exist')
        }
}

I also tried the one below but same result:
```
assertHeaderAndFooterSnapshots(headingName){
this.getHeadingHeader(headingName).eq(0)
.scrollIntoView()
.should('exist')
cy.compareSnapshot('try', 0.1)
this.getHeadingFooter(headingName).eq(0)
.scrollIntoView()
.should('exist')
cy.compareSnapshot('try', 0.1)
}

@faith-berroya faith-berroya changed the title Getting an error cy.task('copyScreenshot') failed with the following error: > ENOENT: no such file or directory, stat '/Users/faithberroya/Documents/CreateAutomatedTests/cypress-visual-screenshots/comparison/validate_k3_headers_combintation_k3_tags.feature-try.png' when trying to run for the first time Getting an error cy.task('copyScreenshot') failed with the following error: > ENOENT: no such file or directory, stat '(pathname)' when trying to run for the first time Aug 16, 2022
@surajwaits
Copy link

I am also facing the same error...
@PippoRaimondi, Could you please help us with this issue?

@PippoRaimondi
Copy link
Collaborator

This might have been due to the first Cypress version 10.x issue with windows and the way they handle screenshot folders... this shouldn't be an issue anymore... I will close within a few weeks if no more complaints

@jaime1702
Copy link

I am also facing the same error...
@PippoRaimondi , Could you please help us with this issue?

@jradelmo
Copy link

if you using badeball/cypress-cucumber-preprocessor, try add omitAfterScreenshotHandler as true on plugin configuration.

await preprocessor.addCucumberPreprocessorPlugin(on, config, {
    omitAfterScreenshotHandler: true,
  }); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants