mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +08:00
feat(e2e-tests): only open and close the driver once per run
This commit is contained in:
@ -8,6 +8,7 @@ const webdriver = require('selenium-webdriver');
|
|||||||
|
|
||||||
const Snapshot = require('./Snapshot');
|
const Snapshot = require('./Snapshot');
|
||||||
|
|
||||||
|
let driver;
|
||||||
let snapshot;
|
let snapshot;
|
||||||
let specIndex = 0;
|
let specIndex = 0;
|
||||||
let takeScreenshots = false;
|
let takeScreenshots = false;
|
||||||
@ -53,7 +54,6 @@ function processCommandLine() {
|
|||||||
function registerE2ETest(desc, tst) {
|
function registerE2ETest(desc, tst) {
|
||||||
// NOTE: Do not use an arrow function here because: https://mochajs.org/#arrow-functions
|
// NOTE: Do not use an arrow function here because: https://mochajs.org/#arrow-functions
|
||||||
it(desc, async function() {
|
it(desc, async function() {
|
||||||
const driver = new webdriver.Builder().forBrowser('chrome').build();
|
|
||||||
await tst(driver);
|
await tst(driver);
|
||||||
if (takeScreenshots) {
|
if (takeScreenshots) {
|
||||||
await snapshot.takeScreenshot(driver, {
|
await snapshot.takeScreenshot(driver, {
|
||||||
@ -61,7 +61,7 @@ function registerE2ETest(desc, tst) {
|
|||||||
specIndex: specIndex++
|
specIndex: specIndex++
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return driver.quit();
|
return Promise.resolve(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +77,8 @@ async function run() {
|
|||||||
slow: 2000
|
slow: 2000
|
||||||
});
|
});
|
||||||
|
|
||||||
|
driver = new webdriver.Builder().forBrowser('chrome').build();
|
||||||
|
|
||||||
processCommandLine();
|
processCommandLine();
|
||||||
|
|
||||||
const devServer = await startDevServer();
|
const devServer = await startDevServer();
|
||||||
@ -113,6 +115,7 @@ async function run() {
|
|||||||
process.exit(failures); // exit with non-zero status if there were failures
|
process.exit(failures); // exit with non-zero status if there were failures
|
||||||
});
|
});
|
||||||
devServer.close();
|
devServer.close();
|
||||||
|
driver.quit();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user