diff options
Diffstat (limited to 'test/runner/selenium/runSelenium.js')
-rw-r--r-- | test/runner/selenium/runSelenium.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/runner/selenium/runSelenium.js b/test/runner/selenium/runSelenium.js new file mode 100644 index 000000000..247cd8472 --- /dev/null +++ b/test/runner/selenium/runSelenium.js @@ -0,0 +1,31 @@ +import chalk from "chalk"; +import createDriver from "./createDriver.js"; + +export async function runSelenium( + url, + { browser }, + { debug, headless, verbose } = {} +) { + if ( debug && headless ) { + throw new Error( "Cannot debug in headless mode." ); + } + + const driver = await createDriver( { + browserName: browser, + headless, + verbose + } ); + + try { + await driver.get( url ); + await driver.executeScript( +`return new Promise( ( resolve ) => { + QUnit.on( "runEnd", resolve ); +} )` + ); + } finally { + if ( !debug || headless ) { + await driver.quit(); + } + } +} |