From a7d612fbdcb5599025935c95113852e5f6a5c136 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Thu, 7 Dec 2023 19:15:18 -0500 Subject: [PATCH] Fix chromedriver issues (#1548) * Test removing chromedriver * Remove port * Try removing it altogether * Alright, try that * Attempt to run xvfb directly * Halfway happy? --- extension/package.json | 2 +- extension/test/chrome/extension.spec.js | 12 ++++-------- extension/test/electron/devpanel.spec.js | 3 +-- pnpm-lock.yaml | 9 +++++---- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/extension/package.json b/extension/package.json index 22e8b0d8..a1ed67cf 100644 --- a/extension/package.json +++ b/extension/package.json @@ -73,7 +73,7 @@ "jest-environment-jsdom": "^29.7.0", "pug": "^3.0.2", "rimraf": "^5.0.5", - "selenium-webdriver": "^4.15.0", + "selenium-webdriver": "^4.16.0", "sinon-chrome": "^3.0.1", "ts-jest": "^29.1.1", "typescript": "~5.2.2", diff --git a/extension/test/chrome/extension.spec.js b/extension/test/chrome/extension.spec.js index b3eba673..86fdb064 100644 --- a/extension/test/chrome/extension.spec.js +++ b/extension/test/chrome/extension.spec.js @@ -1,10 +1,8 @@ import { resolve } from 'path'; import webdriver from 'selenium-webdriver'; import chrome from 'selenium-webdriver/chrome'; -import chromedriver from 'chromedriver'; import { switchMonitorTests, delay } from '../utils/e2e'; -const port = 9515; const path = resolve(__dirname, '..', '..', 'dist'); const extensionId = 'lmhkpmbekcpmknklioeibfkpmmfibljd'; const actionsPattern = @@ -14,12 +12,11 @@ describe('Chrome extension', function () { let driver; beforeAll(async () => { - chromedriver.start(); - await delay(2000); driver = new webdriver.Builder() - .usingServer(`http://localhost:${port}`) .setChromeOptions( - new chrome.Options().addArguments(`load-extension=${path}`), + new chrome.Options() + .setBrowserVersion('stable') + .addArguments(`load-extension=${path}`), ) .forBrowser('chrome') .build(); @@ -27,7 +24,6 @@ describe('Chrome extension', function () { afterAll(async () => { await driver.quit(); - chromedriver.stop(); }); it("should open extension's window", async () => { @@ -63,7 +59,7 @@ describe('Chrome extension', function () { ); it('should get actions list', async () => { - const url = 'http://zalmoxisus.github.io/examples/router/'; + const url = 'https://zalmoxisus.github.io/examples/router/'; await driver.executeScript(`window.open('${url}')`); await delay(2000); diff --git a/extension/test/electron/devpanel.spec.js b/extension/test/electron/devpanel.spec.js index 62705f71..94dc5065 100644 --- a/extension/test/electron/devpanel.spec.js +++ b/extension/test/electron/devpanel.spec.js @@ -5,7 +5,6 @@ import electronPath from 'electron'; import chromedriver from 'chromedriver'; import { switchMonitorTests, delay } from '../utils/e2e'; -const port = 9515; const devPanelPath = 'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/window.html'; @@ -16,7 +15,7 @@ describe('DevTools panel for Electron', function () { chromedriver.start(); await delay(1000); driver = new webdriver.Builder() - .usingServer(`http://localhost:${port}`) + .usingServer('http://localhost:9515') .setChromeOptions( new chrome.Options() .setChromeBinaryPath(electronPath) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3441300d..745065d0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -202,8 +202,8 @@ importers: specifier: ^5.0.5 version: 5.0.5 selenium-webdriver: - specifier: ^4.15.0 - version: 4.15.0 + specifier: ^4.16.0 + version: 4.16.0 sinon-chrome: specifier: ^3.0.1 version: 3.0.1 @@ -16809,6 +16809,7 @@ packages: chalk: 3.0.0 diff-match-patch: 1.0.5 dev: false + bundledDependencies: [] /jsonfile@4.0.0: resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} @@ -19832,8 +19833,8 @@ packages: resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==} dev: true - /selenium-webdriver@4.15.0: - resolution: {integrity: sha512-BNG1bq+KWiBGHcJ/wULi0eKY0yaDqFIbEmtbsYJmfaEghdCkXBsx1akgOorhNwjBipOr0uwpvNXqT6/nzl+zjg==} + /selenium-webdriver@4.16.0: + resolution: {integrity: sha512-IbqpRpfGE7JDGgXHJeWuCqT/tUqnLvZ14csSwt+S8o4nJo3RtQoE9VR4jB47tP/A8ArkYsh/THuMY6kyRP6kuA==} engines: {node: '>= 14.20.0'} dependencies: jszip: 3.10.1