feat(e2e-tests): only open and close the driver once per run

This commit is contained in:
Ken Sodemann
2017-11-07 15:26:48 -06:00
parent 8511ff2a76
commit f4d4c9c675

View File

@ -8,6 +8,7 @@ const webdriver = require('selenium-webdriver');
const Snapshot = require('./Snapshot');
let driver;
let snapshot;
let specIndex = 0;
let takeScreenshots = false;
@ -53,7 +54,6 @@ function processCommandLine() {
function registerE2ETest(desc, tst) {
// NOTE: Do not use an arrow function here because: https://mochajs.org/#arrow-functions
it(desc, async function() {
const driver = new webdriver.Builder().forBrowser('chrome').build();
await tst(driver);
if (takeScreenshots) {
await snapshot.takeScreenshot(driver, {
@ -61,7 +61,7 @@ function registerE2ETest(desc, tst) {
specIndex: specIndex++
});
}
return driver.quit();
return Promise.resolve(true);
});
}
@ -77,6 +77,8 @@ async function run() {
slow: 2000
});
driver = new webdriver.Builder().forBrowser('chrome').build();
processCommandLine();
const devServer = await startDevServer();
@ -113,6 +115,7 @@ async function run() {
process.exit(failures); // exit with non-zero status if there were failures
});
devServer.close();
driver.quit();
});
});
}