This commit is contained in:
Nathan Bierema 2021-06-06 14:24:04 -04:00
parent 7dd41441a1
commit 380133a22a

View File

@ -1,6 +1,7 @@
import { join } from 'path'; import { join } from 'path';
import webdriver from 'selenium-webdriver'; import webdriver from 'selenium-webdriver';
import electronPath from 'electron'; import electronPath from 'electron';
// import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e'; import { switchMonitorTests, delay } from '../utils/e2e';
const port = 9515; const port = 9515;
@ -8,6 +9,8 @@ const devPanelPath = 'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/window
describe('DevTools panel for Electron', function () { describe('DevTools panel for Electron', function () {
beforeAll(async () => { beforeAll(async () => {
// chromedriver.start();
// await delay(1000);
this.driver = new webdriver.Builder() this.driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`) .usingServer(`http://localhost:${port}`)
.withCapabilities({ .withCapabilities({
@ -23,15 +26,20 @@ describe('DevTools panel for Electron', function () {
afterAll(async () => { afterAll(async () => {
await this.driver.quit(); await this.driver.quit();
// chromedriver.stop();
}); });
it('should open Redux DevTools tab', async () => { it('should open Redux DevTools tab', async () => {
const originalWindow = await this.driver.getWindowHandle();
const windows = await this.driver.getAllWindowHandles(); const windows = await this.driver.getAllWindowHandles();
for (const window of windows) { for (const window of windows) {
await this.driver.switchTo().window(window); if (window !== originalWindow) {
if ((await this.driver.getCurrentUrl()).startsWith('devtools')) { await this.driver.switchTo().window(window);
break; // if ((await this.driver.getCurrentUrl()).startsWith('devtools')) {
// break;
// }
} }
// await delay(2000);
} }
expect(await this.driver.getCurrentUrl()).toMatch( expect(await this.driver.getCurrentUrl()).toMatch(
/devtools:\/\/devtools\/bundled\/devtools_app.html/ /devtools:\/\/devtools\/bundled\/devtools_app.html/
@ -39,6 +47,8 @@ describe('DevTools panel for Electron', function () {
await this.driver.manage().timeouts().pageLoadTimeout(5000); await this.driver.manage().timeouts().pageLoadTimeout(5000);
// await this.driver.wait(() => window.UI && window.UI.inspectorView, 5000);
const id = await this.driver.executeAsyncScript(function (callback) { const id = await this.driver.executeAsyncScript(function (callback) {
let attempts = 5; let attempts = 5;
function showReduxPanel() { function showReduxPanel() {