私はnodejsサーバーを持っていますので、nightwatchでいくつかの機能テストを開始します。テストは実行されません - 標準mochaとphantomjsを使用したnightwatch
手動でセレンを起動し、mocha(コマンド:mocha ./test/functional/*.spec.js --compilers js:babel-register)で実行すると、ノードサーバーが起動し、firefoxで正常に動作しますデフォルト - 途中でそれが他のブラウザにデフォルトのFirefoxから変更することができますどのように標準モカを使用して):
import nightwatch from 'nightwatch';
require('../../server');
describe('Functional', function wrapIt() {
const client = nightwatch.initClient({
silent: true,
});
const browser = client.api();
this.timeout(99999999);
beforeEach((done) => {
client.start(done);
});
it('should login', (done) => {
browser
.url('http://localhost:8441/')
.waitForElementVisible('button[name=login]', 1000)
.click('button[name=login]')
.pause(1000);
browser.expect.element('button').to.have.attribute('class').which.contains('theme__button');
browser.end();
client.start(done);
});
after((done) => {
browser.end();
client.start(done);
});
});
今私はセレンサーバが起動し、竹の上に置くとphantomjsを使用すると、サーバが起動しnodejsけど?テストは実行されません。 私はnightwatch.jsonを持っている:
{
"src_folders" : ["test/night"],
"output_folder": "reports",
"test_runner" : "mocha",
"selenium" : {
"start_process": true,
"server_path": ".//bin/selenium-server-standalone-2.53.1.jar",
"log_path": "./reports",
"host": "127.0.0.1",
"port": 4444
},
"test_settings" : {
"default" : {
"desiredCapabilities": {
"browserName": "phantomjs",
"phantomjs.cli.args" : ["--ignore-ssl-errors=true"],
"version":"latest",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}
、
nightwatch.conf.jsは次のとおりです。
require('babel-core/register');
module.exports = require('./nightwatch.json');
と夜フォルダ内のテスト・スクリプト:
require('../../server');
describe('Functional', function wrapIt() {
const client = this.client;
const browser = client.api();
this.timeout(99999999);
beforeEach((done) => {
client.start(done);
});
it('should login', (done) => {
browser
.url('http://localhost:8441/')
.waitForElementVisible('button[name=login]', 1000)
.click('button[name=login]')
.pause(1000);
browser.expect.element('button').to.have.attribute('class').which.contains('theme__button');
browser.end();
client.start(done);
});
after((done) => {
browser.end();
client.start(done);
});
});
ので、実行していますnightwatchでセレンサーバを起動し、nodejsサーバもokを開始しますが、何も起こりませんs。
は、そのセレンサーバパス里です、それを起動するcommmandを追加しましたght?また、Bambooのログもありますか?彼らはあなたに問題を指摘するのに役立つかもしれません。 – reergymerej