Pavlo Kozlov
Pavlo Kozlov

Reputation: 1101

Codeceptjs with Nightmare doesn't output result of test

Basically, I did everything as described in get started section on http://codecept.io/ page.

devDependencies from package.json:

"codeceptjs": "^0.5.1",
"nightmare": "^2.10.0",
"nightmare-upload": "^0.1.1"

codecept.json:

{
  "tests": "./tests/acceptance/*_test.js",
  "timeout": 10000,
  "output": "./output",
  "helpers": {
    "Nightmare": {
      "url": "http://localhost:8080",
      "show": false,
      "restart": false
    }
  },
  "include": {},
  "bootstrap": false,
  "mocha": {},
  "name": "vagrant"
}

The test itself is also from tutorial:

Feature('My first test');

Scenario('test something', (I) => {
    I.amOnPage('http://yahoo.com');
    I.fillField('p', 'github nightmare');
    I.click('Search Web');
    I.waitForElement('#main');
    I.seeElement('#main .searchCenterMiddle li a');
    I.seeElement("//a[contains(@href,'github.com/segmentio/nightmare')]");
    I.see('segmentio/nightmare','#main li a');
});

When I run codeceptjs run --steps I get an output in console: screenshot

It doesn't matter is test should pass or fail, output is always the same.

Does anybody knows what am I doing wrong and how to fix it?

Upvotes: 1

Views: 589

Answers (1)

Pavlo Kozlov
Pavlo Kozlov

Reputation: 1101

Ok. I managed it to work. The problem was virtual buffer (I run codeceptjs from inside vagrant). The solution is simple and common in such cases but I totally forget about it.

You need to run codeceptjs with xvfb. It looks like this:

xvfb-run --server-args='-screen 0 1024x768x24' codeceptjs run --steps

Don't forget to install all necessary libraries before:

sudo apt-get install pkg-config libjpeg-dev libgif-dev g++ git-all xvfb libgtk2.0-0 dbus-x11 -y;
sudo apt-get install libnss3-dev -y;
sudo apt-get install gtk2-engines-pixbuf xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable -y;

Upvotes: 2

Related Questions