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

Indicate that the cdpPort option can't be used in concurrency mode #4029

Closed
HugoDel opened this issue Jul 15, 2019 · 16 comments
Closed

Indicate that the cdpPort option can't be used in concurrency mode #4029

HugoDel opened this issue Jul 15, 2019 · 16 comments
Labels
STATE: Need improvement A minor issue that can't be treated as a bug. STATE: Stale An outdated issue that will be automatically closed by the Stale bot.
Projects
Milestone

Comments

@HugoDel
Copy link

HugoDel commented Jul 15, 2019

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",
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 15, 2019
@AlexKamaev AlexKamaev self-assigned this Jul 15, 2019
@AlexKamaev
Copy link
Contributor

It looks like you enable two conflicting options: concurrency and cdpPort. You cannot run two browsers that use the same cdp port at the same time.
Please check if your test works without defining the cdpPort option (in this case the cdpPort option will be assigned automatically).
Meanwhile, I think that we need to improve our documentation or throw an error message to make the issue clear

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 15, 2019
@AlexKamaev AlexKamaev added the TYPE: bug The described behavior is considered as wrong (bug). label Jul 15, 2019
@AlexKamaev AlexKamaev added this to the Planned milestone Jul 15, 2019
@AlexKamaev AlexKamaev added the AREA: docs An issue related to the product documentation. label Jul 15, 2019
@HugoDel
Copy link
Author

HugoDel commented Jul 15, 2019

Ok, it seems to work! I'm impatient to be able to use concurrency and CdpPort, thanks for your help.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 15, 2019
@AndreyBelym
Copy link
Contributor

If you don't mind, could you please clarify why do you want to explicitly configure the CDP port in concurrency mode?

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 15, 2019
@HugoDel
Copy link
Author

HugoDel commented Jul 15, 2019

Yes of course! In some test, we need to download files to check their content. Since we have a lot of tests, we use concurrency mode to speed up.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 15, 2019
@AndreyBelym AndreyBelym added this to Browser manipulations in Bugs triage Jul 15, 2019
@AndreyBelym AndreyBelym removed AREA: docs An issue related to the product documentation. labels Jul 16, 2019
@miherlosev miherlosev self-assigned this Jul 17, 2019
@miherlosev
Copy link
Collaborator

We decided to raise an error if the same cdpPort was specified for several browser instances in concurrency mode.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 17, 2019
@HugoDel
Copy link
Author

HugoDel commented Jul 17, 2019

OK! It's technically possible to use concurrency and cdpPort to communicate with browsers? If yes, do you will plan it in your roadmap?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 17, 2019
@AndreyBelym
Copy link
Contributor

AndreyBelym commented Jul 17, 2019

Could you please clarify why you have to manually configure CDP ports? Please note that in concurrency mode each browser needs a dedicated port. It means that if you want to run 4 browsers concurrently, you have to handle 4 different ports. I think this is quite inconvenient, so that's why I am so curious about your use case.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 17, 2019
@HugoDel
Copy link
Author

HugoDel commented Jul 17, 2019

This is exactly the same problem as in #3127 and #3600
I want to download files and use concurrency to speed up tests. I know that it's complicated to handle both but If we can set manually each port for each browser in concurrency mode, I think it will be possible to resolve the problem.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 17, 2019
@AlexKamaev
Copy link
Contributor

I've modified the example from #3127 a little. Now it will allow you to use the concurrency option. Please refer to https://gist.github.com/AlexKamaev/8c1eb8a5fb638fa366b44447f6d7c5a4
This example is using an internal TestCafe API. It works stable, however, it can change in the future

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 18, 2019
@HugoDel
Copy link
Author

HugoDel commented Aug 2, 2019

Hi, sorry for the response delay but your solution doesn't solve my problem :/
I'm still getting TypeError: Cannot read property 'Page' of undefined

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Aug 2, 2019
@AndreyBelym AndreyBelym changed the title Can't take screenshot: "Cannot read property 'Page'" Indicate that the cdpPort option can't be used in concurrency mode Aug 2, 2019
@AndreyBelym
Copy link
Contributor

AndreyBelym commented Aug 2, 2019

The problem with file downloading in Headless Chrome is fixed in testcafe@1.4.0-rc.2. Please try to remove all workarounds and run your tests with this version.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Aug 2, 2019
@AndreyBelym AndreyBelym added STATE: Need improvement A minor issue that can't be treated as a bug. and removed TYPE: bug The described behavior is considered as wrong (bug). labels Aug 2, 2019
@HugoDel
Copy link
Author

HugoDel commented Aug 2, 2019

Well, I'm still having the same error with the last version. I remove all workaround, update to 1.4.0-rc.2

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Aug 2, 2019
@AndreyBelym
Copy link
Contributor

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

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Aug 2, 2019
@HugoDel
Copy link
Author

HugoDel commented Aug 5, 2019

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

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Aug 5, 2019
@Farfurix Farfurix removed the STATE: Need response An issue that requires a response or attention from the team. label Aug 5, 2019
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.

@github-actions github-actions bot added the STATE: Stale An outdated issue that will be automatically closed by the Stale bot. label Nov 25, 2020
@github-actions
Copy link

github-actions bot commented Dec 5, 2020

We're closing this issue after a prolonged period of inactivity. If it still affects you, please create a new issue with up-to-date information. Thank you.

@github-actions github-actions bot closed this as completed Dec 5, 2020
Bugs triage automation moved this from Browser manipulations to Closed Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATE: Need improvement A minor issue that can't be treated as a bug. STATE: Stale An outdated issue that will be automatically closed by the Stale bot.
Projects
Bugs triage
  
Closed
Development

No branches or pull requests

5 participants