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