A
A
Alex Pts2015-03-17 15:02:44
Software testing
Alex Pts, 2015-03-17 15:02:44

How to use mocha+chai in phantomJs?

There are functional tests for the site. Currently using zombieJs+mocha. There are always some problems with zombies. We decided to try phantomJs.
I liked phantomJs myself. But it's not entirely clear how to add mocha in the simplest demo test.

var page = require('webpage').create();
page.open('http://google.com', function() {
  var title = page.evaluate(function() {
    return document.title;
  });

  // Далее хочется что-то вроде такого
   it('check title', function(){
        expect(title).to.equal('Google');
    });
});

Who uses phantomJs to test the site, show some of your simple examples.
How do you run all these tests?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Pts, 2015-03-18
@AlexPTS

Actually, I found the solution myself. You need some kind of phantomjs bridge npm module to be able to run mocha and include phantom as a module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question