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

Doc request - is nightmare.js headless? #744

Closed
RichardJECooke opened this issue Aug 1, 2016 · 9 comments
Closed

Doc request - is nightmare.js headless? #744

RichardJECooke opened this issue Aug 1, 2016 · 9 comments

Comments

@RichardJECooke
Copy link

Hi, my company is trying to choose a test framework. Nightmare looks great. It provides promises, ES6, await.

But the docs don't state if it's headless - i.e. does it open an instance of Electron for every test? (Like Selenium opens Firefox for each test).

Or is Electron just Javascript that runs in memory (like Phantom.js & Casper.js which I imagine is much faster because it doesn't have to open an entire application and Window on your screen).

Please will you add a brief note on this to your readme.md

@RichardJECooke
Copy link
Author

Oh no, I ran an example an it opens a whole Electron window :(

So it's not headless. Please put this in the docs. Now I can't run it in Docker to have automated tests.

@RichardJECooke
Copy link
Author

Ahhh, now I see:

Pass { show: true } to the nightmare constructor to have it create a visible, rendered window that you can watch what's happening.

It would be cool if at the top of your readme you changed this line:

var nightmare = Nightmare({ show: true })

to

var nightmare = Nightmare({ show: true }) //use false for headless testing (e.g. in Docker)

@VoidMonk
Copy link

VoidMonk commented Aug 2, 2016

You can run it headless using xvfb or xvfb-run. See #224.

@RichardJECooke
Copy link
Author

Are you saying if I don't have show: true and don't use xvfb it's still not headless?

@rosshinkley
Copy link
Contributor

@RichardJECooke Whether or not you have show: true when running under Docker does not make it headless or headed. It makes the rendering on the framebuffer (most likely Xvfb) render as though it were visible.

Nightmare isn't truly headless: it requires an Electron instance to work, which in turn requires a framebuffer to render properly (at least, for now).

Setting that aside: if you set show: true or show: false (the default), it will likely not run out-of-the-box on a Docker instance as Docker instances are intended to be headless, and as such, don't typically have a framebuffer included on the image. To do that, @VoidMonk's suggestion stands: have a look at #224 regarding running with Xvfb or xvfb-run. You may also want to have a look at the test suite for Nightmare as that runs on a headless CircleCI server.

@smtx
Copy link

smtx commented Sep 1, 2016

@RichardJECooke perhaps this docker image https://hub.docker.com/r/smtx/nightmarejs-webservice/ helps you build your nightmare app inside a docker container.

Here is the Dockerfile: https://hub.docker.com/r/smtx/nightmarejs-webservice/~/dockerfile/

@bchr02
Copy link
Contributor

bchr02 commented Sep 10, 2016

#744 (comment)

@RichardJECooke I agree, having that information there would be helpful. I just started using the example and noticed it opened a window, which is great while debugging but when I did a search on README.md for headless or hide, to my surprise I did not get an answer. So, having this would have saved me some time from continuing to dig for an answer or having to read the electron docs.

@fake-name
Copy link

If it requries X, it's not headless.

@rosshinkley
Copy link
Contributor

I think this is resolved. If not, feel free to reopen/open a new issue.

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

No branches or pull requests

6 participants