【问题标题】:Codeceptjs with Nightmare doesn't output result of test带有 Nightmare 的 Codeceptjs 不输出测试结果
【发布时间】:2017-07-23 21:24:58
【问题描述】:

基本上,我按照http://codecept.io/ 页面上的get started 部分所述进行了所有操作。

来自 package.json 的 devDependencies:

"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"
}

测试本身也来自教程:

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');
});

当我运行codeceptjs run --steps 时,我在控制台中得到一个输出: screenshot

不管测试是通过还是失败,输出都是一样的。

有人知道我做错了什么以及如何解决吗?

【问题讨论】:

    标签: javascript acceptance-testing nightmare codeceptjs


    【解决方案1】:

    好的。我设法让它工作。问题是虚拟缓冲区(我从 vagrant 内部运行 codeceptjs)。 在这种情况下,解决方案既简单又常见,但我完全忘记了。

    您需要使用xvfb 运行codeceptjs。它看起来像这样:

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

    之前不要忘记安装所有必要的库:

    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;
    

    【讨论】:

      猜你喜欢
      • 2014-01-09
      • 1970-01-01
      • 2021-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-29
      • 1970-01-01
      相关资源
      最近更新 更多