2017-07-17 18:49:24 +02:00
|
|
|
const webdriver = require('selenium-webdriver');
|
|
|
|
const path = require('path');
|
|
|
|
const until = webdriver.until;
|
2017-07-17 18:39:51 +02:00
|
|
|
|
2017-07-17 18:49:24 +02:00
|
|
|
const driver = new webdriver.Builder()
|
2017-07-17 18:39:51 +02:00
|
|
|
.forBrowser('firefox')
|
|
|
|
.build();
|
|
|
|
|
2017-07-17 18:49:24 +02:00
|
|
|
driver.get(path.join('file:///', __dirname, '/frontend.test.html'));
|
2017-07-18 03:06:20 +02:00
|
|
|
driver.wait(until.titleIs('Mocha Tests'), 10000);
|
2017-07-17 18:39:51 +02:00
|
|
|
driver.wait(until.titleMatches(/^[0-1]$/), 10000);
|
|
|
|
|
|
|
|
driver.getTitle().then(title => {
|
|
|
|
driver.quit().then(() => {
|
2017-07-17 18:49:24 +02:00
|
|
|
if (title === '0') {
|
2017-07-17 19:27:43 +02:00
|
|
|
console.log('Frontend tests have passed.');
|
2017-07-17 18:39:51 +02:00
|
|
|
} else {
|
2017-07-17 18:49:24 +02:00
|
|
|
throw new Error('Frontend tests are failing. ' +
|
|
|
|
'Please open the frontend.test.html file in a browser.');
|
2017-07-17 18:39:51 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|