This commit is contained in:
Nathan Bierema 2021-10-21 09:53:49 -04:00
parent 503aa58eb0
commit 8b32405da2
2 changed files with 11 additions and 16 deletions

View File

@ -1,5 +1,6 @@
import { resolve } from 'path'; import { resolve } from 'path';
import webdriver from 'selenium-webdriver'; import webdriver from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome';
import chromedriver from 'chromedriver'; import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e'; import { switchMonitorTests, delay } from '../utils/e2e';
@ -17,11 +18,9 @@ describe('Chrome extension', function () {
await delay(2000); await delay(2000);
driver = new webdriver.Builder() driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`) .usingServer(`http://localhost:${port}`)
.withCapabilities({ .setChromeOptions(
chromeOptions: { new chrome.Options().addArguments(`load-extension=${path}`)
args: [`load-extension=${path}`], )
},
})
.forBrowser('chrome') .forBrowser('chrome')
.build(); .build();
}); });
@ -72,7 +71,6 @@ describe('Chrome extension', function () {
await driver.switchTo().window(tabs[1]); await driver.switchTo().window(tabs[1]);
expect(await driver.getCurrentUrl()).toMatch(url); expect(await driver.getCurrentUrl()).toMatch(url);
await driver.manage().timeouts().pageLoadTimeout(5000);
await driver.switchTo().window(tabs[0]); await driver.switchTo().window(tabs[0]);

View File

@ -1,5 +1,6 @@
import { join } from 'path'; import { join } from 'path';
import webdriver from 'selenium-webdriver'; import webdriver from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome';
import electronPath from 'electron'; import electronPath from 'electron';
import chromedriver from 'chromedriver'; import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e'; import { switchMonitorTests, delay } from '../utils/e2e';
@ -16,15 +17,13 @@ describe('DevTools panel for Electron', function () {
await delay(1000); await delay(1000);
driver = new webdriver.Builder() driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`) .usingServer(`http://localhost:${port}`)
.withCapabilities({ .setChromeOptions(
chromeOptions: { new chrome.Options()
binary: electronPath, .setChromeBinaryPath(electronPath)
args: [`app=${join(__dirname, 'fixture')}`], .addArguments(`app=${join(__dirname, 'fixture')}`)
}, )
}) .forBrowser('chrome')
.forBrowser('electron')
.build(); .build();
await driver.manage().timeouts().setScriptTimeout(10000);
}); });
afterAll(async () => { afterAll(async () => {
@ -48,8 +47,6 @@ describe('DevTools panel for Electron', function () {
/devtools:\/\/devtools\/bundled\/devtools_app.html/ /devtools:\/\/devtools\/bundled\/devtools_app.html/
); );
await driver.manage().timeouts().pageLoadTimeout(5000);
const id = await driver.executeAsyncScript(function (callback) { const id = await driver.executeAsyncScript(function (callback) {
let attempts = 5; let attempts = 5;
function showReduxPanel() { function showReduxPanel() {