我有一个简单的浏览器测试,它运行并在本地传递:
import {expect} from 'chai';
import webdriver from 'selenium-webdriver';
import path from 'path';
const By = webdriver.By;
const until = webdriver.until;
const chromeDriverPathAddition = `:${path.dirname(require('chromedriver').path)}`;
process.env.PATH += chromeDriverPathAddition;
const driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
afterEach(() => {
driver.quit();
});
describe('App', () => {
it('page is loaded', async () => {
driver.get('http://www.google.com/ncr');
driver.findElement(By.name('q')).sendKeys('webdriver');
driver.findElement(By.name('btnG')).click();
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
const results = await driver.findElement(By.id('search')).getAttribute('innerHTML');
expect(results.indexOf('webdriver')).to.be.above(0);
});
});
我的npm测试命令是:
"scripts": {
"test": "mocha ./test/**/*.browser.js --compilers js:babel-core/register --require babel-polyfill --timeout 60000"
}
我正在连接酱汁连接购买我的测试有时间: https://travis-ci.org/yanivefraim/tdd-tutorial
我做错了什么?