Fix chromedriver issues (#1548)

* Test removing chromedriver

* Remove port

* Try removing it altogether

* Alright, try that

* Attempt to run xvfb directly

* Halfway happy?
This commit is contained in:
Nathan Bierema 2023-12-07 19:15:18 -05:00 committed by GitHub
parent 8979004b53
commit a7d612fbdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 15 deletions

View File

@ -73,7 +73,7 @@
"jest-environment-jsdom": "^29.7.0", "jest-environment-jsdom": "^29.7.0",
"pug": "^3.0.2", "pug": "^3.0.2",
"rimraf": "^5.0.5", "rimraf": "^5.0.5",
"selenium-webdriver": "^4.15.0", "selenium-webdriver": "^4.16.0",
"sinon-chrome": "^3.0.1", "sinon-chrome": "^3.0.1",
"ts-jest": "^29.1.1", "ts-jest": "^29.1.1",
"typescript": "~5.2.2", "typescript": "~5.2.2",

View File

@ -1,10 +1,8 @@
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 chrome from 'selenium-webdriver/chrome';
import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e'; import { switchMonitorTests, delay } from '../utils/e2e';
const port = 9515;
const path = resolve(__dirname, '..', '..', 'dist'); const path = resolve(__dirname, '..', '..', 'dist');
const extensionId = 'lmhkpmbekcpmknklioeibfkpmmfibljd'; const extensionId = 'lmhkpmbekcpmknklioeibfkpmmfibljd';
const actionsPattern = const actionsPattern =
@ -14,12 +12,11 @@ describe('Chrome extension', function () {
let driver; let driver;
beforeAll(async () => { beforeAll(async () => {
chromedriver.start();
await delay(2000);
driver = new webdriver.Builder() driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`)
.setChromeOptions( .setChromeOptions(
new chrome.Options().addArguments(`load-extension=${path}`), new chrome.Options()
.setBrowserVersion('stable')
.addArguments(`load-extension=${path}`),
) )
.forBrowser('chrome') .forBrowser('chrome')
.build(); .build();
@ -27,7 +24,6 @@ describe('Chrome extension', function () {
afterAll(async () => { afterAll(async () => {
await driver.quit(); await driver.quit();
chromedriver.stop();
}); });
it("should open extension's window", async () => { it("should open extension's window", async () => {
@ -63,7 +59,7 @@ describe('Chrome extension', function () {
); );
it('should get actions list', async () => { 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 driver.executeScript(`window.open('${url}')`);
await delay(2000); await delay(2000);

View File

@ -5,7 +5,6 @@ import electronPath from 'electron';
import chromedriver from 'chromedriver'; import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e'; import { switchMonitorTests, delay } from '../utils/e2e';
const port = 9515;
const devPanelPath = const devPanelPath =
'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/window.html'; 'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/window.html';
@ -16,7 +15,7 @@ describe('DevTools panel for Electron', function () {
chromedriver.start(); chromedriver.start();
await delay(1000); await delay(1000);
driver = new webdriver.Builder() driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`) .usingServer('http://localhost:9515')
.setChromeOptions( .setChromeOptions(
new chrome.Options() new chrome.Options()
.setChromeBinaryPath(electronPath) .setChromeBinaryPath(electronPath)

View File

@ -202,8 +202,8 @@ importers:
specifier: ^5.0.5 specifier: ^5.0.5
version: 5.0.5 version: 5.0.5
selenium-webdriver: selenium-webdriver:
specifier: ^4.15.0 specifier: ^4.16.0
version: 4.15.0 version: 4.16.0
sinon-chrome: sinon-chrome:
specifier: ^3.0.1 specifier: ^3.0.1
version: 3.0.1 version: 3.0.1
@ -16809,6 +16809,7 @@ packages:
chalk: 3.0.0 chalk: 3.0.0
diff-match-patch: 1.0.5 diff-match-patch: 1.0.5
dev: false dev: false
bundledDependencies: []
/jsonfile@4.0.0: /jsonfile@4.0.0:
resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==}
@ -19832,8 +19833,8 @@ packages:
resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==} resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==}
dev: true dev: true
/selenium-webdriver@4.15.0: /selenium-webdriver@4.16.0:
resolution: {integrity: sha512-BNG1bq+KWiBGHcJ/wULi0eKY0yaDqFIbEmtbsYJmfaEghdCkXBsx1akgOorhNwjBipOr0uwpvNXqT6/nzl+zjg==} resolution: {integrity: sha512-IbqpRpfGE7JDGgXHJeWuCqT/tUqnLvZ14csSwt+S8o4nJo3RtQoE9VR4jB47tP/A8ArkYsh/THuMY6kyRP6kuA==}
engines: {node: '>= 14.20.0'} engines: {node: '>= 14.20.0'}
dependencies: dependencies:
jszip: 3.10.1 jszip: 3.10.1