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

Unable to Run tests Headless (using Nightmare) #2323

Closed
TheBeachMaster opened this issue Apr 17, 2018 · 4 comments
Closed

Unable to Run tests Headless (using Nightmare) #2323

TheBeachMaster opened this issue Apr 17, 2018 · 4 comments
Assignees
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot.

Comments

@TheBeachMaster
Copy link

Are you requesting a feature or reporting a bug?

  • Bug

What is the current behavior?

  • Windows

    • Unable to connect to browser
      testcafe2
  • Ubuntu

    • Error Launching (Electron) App
      testcafe

What is the expected behavior?

  • Ubuntu : based on issues 1133,1493, and 4 and usage, running the following commands
sudo xvfb-run -a --server-args='-ac -screen 0 1024x768x16' npm run test 

should execute tests successfully with xvfb installed on Ubuntu.

  • Windows : running npm test should execute the test command without errros

How would you reproduce the current behavior (if this is a bug)?

  • Run tests against nightmare on headless mode , e.g. on a Bitbucket pipelines environment with a default Ubuntu image.

  • Or, run any simple tests against Bash on Windows on Ubuntu with xvfb installed.

Provide the test code and the tested page URL (if applicable)

Tested page URL: https://bitbucket.org/augke/bitbucketaddon/src/master/

Test code

import { Selector } from 'testcafe'
fixture `Dummy Test`
    .page `https://bitbucket.org/augke/bitbucketaddon/src/master/`

test("Dummy Test Stub", async t => {
    const i = 2;
    const j = 3;
    const res = 5;
    await t
        .expect(res == i + j).ok();
});

Specify your

  • operating system: [Windows 10.0.16299.371, Ubuntu 16.04.4 LTS]
  • testcafe version: 0.19.2
  • node.js version: [Ubuntu : 5.7.1, Windows: 5.8.0]
@AndreyBelym AndreyBelym self-assigned this Apr 18, 2018
@AndreyBelym
Copy link
Contributor

Hi @TheBeachMaster!

I've reproduced your issue with a disconnected browser. Unfortunately, testcafe-browser-provider-nightmare is unusable, because conflict between Nightmare and our proxy, testcafe-hammerhead.

So it's a problem in the provider, and I've created an issue in its repository: ryx/testcafe-browser-provider-nightmare#14.

You can use it to check the progress of resolving this problem.

Also there is another problem with 'Error launching app'. You've got it, because you had installed Linux version of Nightmare on Windows. Windows Subsystem for Linux a.k.a. Bash for Windows can't run Linux binaries of Electron apps such as Nightmare in its current state. You have to force npm to install Windows version:

export npm_config_platform=win32
npm install testcafe-browser-provider-nightmare

Check this thread for details: electron-userland/electron-prebuilt#260 (comment)

@AndreyBelym
Copy link
Contributor

AndreyBelym commented Apr 19, 2018

Also I've forgot to mention that you can use Firefox and Chrome in headless mode! You don't even need things like xvfb-run for it. For Firefox, it's just enough to install it from Ubuntu's repositories (sudo apt-get firefox), however for Chrome you have to install some additional dependencies, check this comment for the command that will install them.

@TheBeachMaster
Copy link
Author

Awesome, let me try this

@lock
Copy link

lock bot commented Mar 28, 2019

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.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot.
Projects
None yet
Development

No branches or pull requests

2 participants