testcafe: Indicate that the cdpPort option can't be used in concurrency mode

What is your Test Scenario?

Just testing the google search webpage. I make the test failed to see If the screenshot on fail works.

What is the Current behaviour?

3 screenshots are in the screenshot folder for the 2nd test (3 retires x 1 test). No screenshot is taken for the 1st and 3rd, plus I’ve got the error below. BUT I can take a screenshot if there is only ONE test. It only happens if there is more than one test.

 Warnings:
     Was unable to take a screenshot due to an error.

    TypeError: Cannot read property 'Page' of undefined
        at Object.getScreenshotData (C:\Users\hdelannoy\Documents\Code\testcafe-manage\node_modules\testcafe\src\browser\provider\built-in\dedicated\chrome\cdp.js:48:41)
        at BrowserProviderPluginHost.takeScreenshot (C:\Users\hdelannoy\Documents\Code\testcafe-manage\node_modules\testcafe\src\browser\provider\built-in\dedicated\base.js:53:52)
        at BrowserProvider.takeScreenshot (C:\Users\hdelannoy\Documents\Code\testcafe-manage\node_modules\testcafe\src\browser\provider\index.js:303:27)
Allure reporter closed...

What is the Expected behaviour?

I should have 9 screenshots (3 retries x 3 tests) in the screenshot directory and no error on the console.

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example): http://google.com/

Your complete test code (or attach your test files):
fixture('featureName')

test("Test screenshoot", async t => {
    await t.navigateTo('http://google.com/')
    await t.expect(1%2 === 2).ok()
}).only

test("Test screenshoot 2", async t => {
    await t.navigateTo('http://google.com/')
    await t.expect(1%2 === 2).ok()
}).only

test("Test screenshoot 3", async t => {
    await t.navigateTo('http://google.com/')
    await t.expect(1%2 === 2).ok()
}).only
Your complete configuration file (if any):
const createTestCafe = require("testcafe");

let testcafe = null;



createTestCafe("localhost", 1337, 1338)
    .then(tc => {
        testcafe = tc;
        const runner = testcafe.createRunner();


        return (
            runner
            .src("./tests/**/*.ts")
            .browsers(['chrome:headless:cdpPort=9222 --no-sandbox'])
            .concurrency(4)
            .reporter([
                'teamcity',
                {
                    name: 'allure',
                    output: '/allure/allure-results'
                }
            ])
            .screenshots(
                "./report/screenshots/",
                true,
                "${USERAGENT}_${FIXTURE}_${TEST}_${QUARANTINE_ATTEMPT}.png"
            )
            .run({
                skipJsErrors: true,
                quarantineMode: true,
                selectorTimeout: 10000,
                assertionTimeout: 10000
            })
        );
    })
    .then(failedCount => {
        console.log("Tests failed: " + failedCount);
        testcafe.close();
        process.exit(failedCount ? 1 : 0);
    });
Your complete test report:

Screenshots:

Steps to Reproduce:

Your Environment details:

  • testcafe version: 1.3.2
  • node.js version: v10.15.3
  • command-line arguments: node conf/runner.js
  • browser name and version: Chrome 75.0.3770.100 (64 bits)
  • platform and version: W10
  • other: “testcafe-reporter-teamcity”: “^1.0.10”, “testcafe-reporter-allure”: “^1.0.5”,

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Ok! You right, I forget it and it works perfectly. Thank you for supporting this feature!

Specifying cdpPort is a part of the workaround. Have you removed it from TestCafe parameters?