From 0b29a79131c51c4b1b35f1907acdc0b876d68f08 Mon Sep 17 00:00:00 2001 From: Denis Revunov Date: Thu, 10 Nov 2022 00:44:34 +0300 Subject: [PATCH] Fix tests --- e2e_tests/e2e.test.ts | 9 +++------ e2e_tests/utils.ts | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/e2e_tests/e2e.test.ts b/e2e_tests/e2e.test.ts index 3994e059..664f288f 100644 --- a/e2e_tests/e2e.test.ts +++ b/e2e_tests/e2e.test.ts @@ -8,7 +8,7 @@ import * as path from "path" import * as webdriver from "selenium-webdriver" import * as Until from "selenium-webdriver/lib/until" const {By} = webdriver -import {Options} from "selenium-webdriver/firefox" +import {Options, Driver} from "selenium-webdriver/firefox" import { getNewestFileIn, sendKeys } from "./utils"; @@ -32,14 +32,11 @@ describe("webdriver", () => { const options = (new Options()) .setPreference("xpinstall.signatures.required", false) - .addExtensions(extensionPath) if (env["HEADLESS"]) { options.headless(); } - const driver = new webdriver.Builder() - .forBrowser("firefox") - .setFirefoxOptions(options) - .build() + const driver = Driver.createSession(options) + await driver.installAddon(extensionPath, /*temporary*/true) // Wait until addon is loaded and :tutor is displayed await iframeLoaded(driver) // And wait a bit more otherwise Tridactyl won't be happy diff --git a/e2e_tests/utils.ts b/e2e_tests/utils.ts index 6b0d5ab1..a17fb79e 100644 --- a/e2e_tests/utils.ts +++ b/e2e_tests/utils.ts @@ -80,7 +80,7 @@ export function sendKeys (driver, keys) { }) .then(() => driver.sleep(delay)) } - + keys = keys.replace(":", "") let result = Promise.resolve() const regexp = /<[^>-]+-?[^>]*>/g const specialKeys = keys.match(regexp)