Testcafe: Unable to take screenshot with v1.6.0 (possibly due to not creating testrun output directory)

Created on 3 Nov 2019  路  11Comments  路  Source: DevExpress/testcafe

Hi,

I'm upgrading from testcafe 1.4.3 and 1.5.0 to 1.6.0 and I ran into an issue with screenshots.

On version 1.4.3 and 1.5 screenshots are created and saved on failure without any problems.
But with version 1.6.0 I get an error. Testcafe did not create a directory for the testrun in my output directory, so it cannot save the screenshot on error.

Warnings (1):
 --
  Was unable to take a screenshot due to an error.

  Error: ENOENT: no such file or directory, open
  '/home/stefan/data/fragment-header/output/component-test/2019-11-03_14-36-48/test-1/Chrome_74.0.3723_Linux_0.0.0/errors/1.png'

With v1.5.0 I used the old cli options -s for output path and -S to save screenshot on error.
In the output/component-test/ directory testcafe has created a directory for the testrun and a screenshot is saved without issue.

With v1.6.0 I tried the old style and the new style command line (-s path=output/component-test,takeOnFails=true). But as testcafe does not create a testrun directory in my output directory, no screenshot can be saved.

Your Environment details:

  • testcafe version: 1.6.0
  • node.js version: v10.15.3
  • command-line arguments: testcafe chromium:testcafe.conf.js test/specs/component-test -s path=output/component-test,takeOnFails=true --hostname localhost --debug-on-fail
  • browser name and version: Chrome 74.0.3723 / Linux 0.0.0
  • platform and version: Ubuntu 18.04.3 LTS
Auto-locked Duplicate

All 11 comments

Hi @stefanschenk,

I couldn't reproduce this behavior. Does the testcafe process have a permission to create a directory there? Could you also show the testcafe.conf.js file content?

I'm experiencing this problem too. Here are my scripts from package.json

"e2e-chrome": "set E2E_PORT=18080 && testcafe \"chrome -incognito\" e2e/**/*.e2e.js -S -s e2e/screenshots --app \"npm run e2e-serve\" --app-init-delay 10000 --concurrency=1 --assertion-timeout 10000 && set E2E_PORT= ",
"e2e-serve": "set VUE_CLI_TEST=true && vue-cli-service serve --port=18080 && set VUE_CLI_TEST=",

I'm also seeing the same error with version 1.6.1. This repository contains a simple test case: https://github.com/jrnorth/testcafe-test. I am running the test using yarn test; the actual command being executed is testcafe puppeteer:no_sandbox test.js -S -s screenshots. I even tested without the deprecated command options but the result was the same: testcafe puppeteer:no_sandbox test.js -s takeOnFails=true.

I also tested with version 1.4.3 and the screenshots were created successfully.

Environment details

OS: Mac OS X 10.14.6
Browser: HeadlessChrome 78.0.3882
Yarn version: 1.17.3
Node version: 10.16.1
Npm version: 6.5.0

I'm also seeing the same error with version 1.6.1. This repository contains a simple test case: https://github.com/jrnorth/testcafe-test. I am running the test using yarn test; the actual command being executed is testcafe puppeteer:no_sandbox test.js -S -s screenshots. I even tested without the

A little off topic but I'm curious how you're currently testing using puppeteer

A little off topic but I'm curious how you're currently testing using puppeteer

I don't know how jrnorth uses puppeteer, but I'm using (a forked version) of the puppeteer browser provider plugin

Hi @stefanschenk,

I couldn't reproduce this behavior. Does the testcafe process have a permission to create a directory there? Could you also show the testcafe.conf.js file content?

Hi @alexey-lin, the testcafe process did have permissions to create the folder, as with testcafe 1.4.3 screenshots were saved perfectly fine. So I would suspect no change in that respect.

The testcafe.conf.js is holding a collection of page urls (used in the tests) and chromium startup arguments. Like this:

export const config = {
    appUrl: baseUrls.get(args.env).join(''),
    baseUrl: baseUrls.get(args.env)[0],
    chromium: {
        args: ['--disable-infobars', '--window-size=1600,900'],
        defaultViewport: {
            height: 900,
            width: 1600,
        },
        headless: !!args.headless,
        timeout: 30000,
    },
};

-== Added ==-
It seems like it is browser provider plugin related.
If I run my tests against chrome I get screenshots, but when I use the puppeteer browser provider the error is reported that the screenshot cannot be saved due to the fact that the (custom) screenshot directory does not exist.

@jrnorth

Thank you for the provided example. The problem is related to the testcafe-browser-provider-puppeteer module. Please create an issue in the https://github.com/jdobosz/testcafe-browser-provider-puppeteer repository.

@miherlosev Too bad you immediately close this issue. Maybe you could point us in the right direction. I would like to present all possible info when submitting a bug in the browser provider repo.
I also have my own fork of that repo, so some pointer would be nice. Maybe I can fix it myself.

And as the bug is introduced with upgrading from testcafe 1.4.3 (possibly 1.5) to 1.6 you guys apparently introduced a breaking change in the functionality of taking screenshots, it doesn't matter how small this change is.

When introducting such change, documentation would be nice. Don't leave is in the dark :-)

Thank you for your patience. We will try to research this problem in the context of https://github.com/DevExpress/testcafe/issues/4477.

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings