MangoTools / node-slimerjs

Other
16 stars 4 forks source link

Test fails on fresh install with SlimerJS 0.9.5 #1

Open ssteinerx opened 9 years ago

ssteinerx commented 9 years ago

(master)# slimerjs --version Innophi SlimerJS 0.9.5, Copyright 2012-2015 Laurent Jouanneau & Innophi

(master)# ./run_tests

testUnexpectedExit ✔ testUnexpectedExit

testbadpath ✔ testSlimerCreatePagePath

testcommandlineoptions ✔ testCommandLineOptions

testcreatepage Slimer spawn err: TypeError: Cannot read property 'createPage' of undefined at /Users/ssteiner/...node-slimerjs/tests/testcreatepage.js:6:11 at /Users/ssteiner/...node-slimerjs/node-slimerjs.js:146:20 at null._onTimeout (/Users/ssteiner/...node-slimerjs/node-slimerjs.js:139:18) at Timer.listOnTimeout (timers.js:110:15)

FAILURES: Undone tests (or their setups/teardowns):

To fix this, make sure all tests call test.done()

ssteinerx commented 9 years ago

Added this:

exports.testSlimerCreatePage = function (test) {
  slimer.create(function (error, sl) {
    console.log(error);

Got this:

testcreatepage Slimer immediately exited with: 1 Slimer spawn err: TypeError: Cannot read property 'createPage' of undefined at /Users/ssteiner/...node-slimerjs/tests/testcreatepage.js:7:7 at /Users/ssteiner/...node-slimerjs/node-slimerjs.js:146:20 at null._onTimeout (/Users/ssteiner/...node-slimerjs/node-slimerjs.js:139:18) at Timer.listOnTimeout (timers.js:110:15)

ssteinerx commented 9 years ago

NOTE: The test fails on the bundled slimerjs, but succeeds if I pass options to the create function to use my locally installed 0.9.5 slimerjs installation.

var slimer = require('../node-slimerjs');

exports.testSlimerCreatePage = function (test) {
  slimer.create(function (err, sl) {
    console.log(err);
    test.ifError(err);
    sl.createPage(function (err, page) {
      test.ifError(err);
      sl.exit();
      test.done();
    });
  }, {
    slimerPath: '/usr/local/bin/slimerjs'
  });
};
ssteinerx commented 9 years ago

Changed default in node-slimerjs.js to be my installed slimerjs and got much further.

Slimer leaves windows open which must be closed for the test to finish. Since this is my first experience with this 'not really headless' approach, I'm not sure whether that's normal...

billiegoose commented 9 years ago

Is there a good reason to include a copy of SlimerJS in "node-slimerjs" package? I could not get the copy distributed with this package to run on Windows without an error, but if I used the copy provided by the "slimerjs" package then node-slimerjs works for me. Should node-slimerjs package just use the slimerjs package?

puzrin commented 9 years ago

See original https://github.com/baudehlo/node-phantom-simple, it now 2.0.0 and includes SlimerJS support with lot of bugfixes.