nathanboktae / mocha-phantomjs

:coffee: :ghost: Run client-side mocha tests in the command line through phantomjs
MIT License
954 stars 112 forks source link

how to use Page Module inside tests #260

Closed basherr closed 6 years ago

basherr commented 6 years ago

There isn't such example using webpage module with mocha?

Test test.js

consolge.log(window.page);
ReferenceError: Can't find variable: page

   at file:///C:/tests/test.js:1
nathanboktae commented 6 years ago

No because you can't. mocha-phantomjs takes a mocha that's running in the browser and pipes the result out to your console - mocha and all your tests run in the browser, not knowing phantom is there (most likely). the page object is on the phantomjs automation side. mocha-phantomjs exposes a little bit of that.

What are you trying to do? if you're trying to do more end-to-end or integration tests, look at mocha-casperjs or honestly these days Nightmare.js is the best, as phantomjs is basically dead.

basherr commented 6 years ago

I would like write integration tests with nightmare/phantomjs with Mocha. Is it possible to load these integration tests within browser with any of them?