testing circle

This commit is contained in:
Abhinav Adduri 2017-07-17 09:49:24 -07:00
parent e5f2b386bb
commit ab60262cc9
2 changed files with 10 additions and 9 deletions

View File

@ -9,6 +9,7 @@ dependencies:
pre: pre:
- npm i -g get-firefox - npm i -g get-firefox
- get-firefox --platform linux --extract --target /home/ubuntu/send - get-firefox --platform linux --extract --target /home/ubuntu/send
- npm i -g geckodriver
deployment: deployment:
latest: latest:

View File

@ -1,22 +1,22 @@
var webdriver = require('selenium-webdriver'), const webdriver = require('selenium-webdriver');
By = webdriver.By, const path = require('path');
until = webdriver.until; const until = webdriver.until;
var driver = new webdriver.Builder() const driver = new webdriver.Builder()
.forBrowser('firefox') .forBrowser('firefox')
.build(); .build();
driver.get('file:///' + __dirname + '/frontend.test.html'); driver.get(path.join('file:///', __dirname, '/frontend.test.html'));
driver.wait(until.titleIs('Mocha Tests'), 1000); driver.wait(until.titleIs('Mocha Tests'), 1000);
driver.wait(until.titleMatches(/^[0-1]$/), 10000); driver.wait(until.titleMatches(/^[0-1]$/), 10000);
driver.getTitle().then(title => { driver.getTitle().then(title => {
driver.quit().then(() => { driver.quit().then(() => {
if (title === "0") { if (title === '0') {
process.exit(0); // process.exit(0);
} else { } else {
throw new Error(`Frontend tests are failing. ` + throw new Error('Frontend tests are failing. ' +
`Please open the frontend.test.html file in a browser.`); 'Please open the frontend.test.html file in a browser.');
} }
}) })
}) })