Fix tests

This commit is contained in:
Denis Revunov 2022-11-10 00:44:34 +03:00
parent 80aad263df
commit 0b29a79131
2 changed files with 4 additions and 7 deletions

View file

@ -8,7 +8,7 @@ import * as path from "path"
import * as webdriver from "selenium-webdriver" import * as webdriver from "selenium-webdriver"
import * as Until from "selenium-webdriver/lib/until" import * as Until from "selenium-webdriver/lib/until"
const {By} = webdriver const {By} = webdriver
import {Options} from "selenium-webdriver/firefox" import {Options, Driver} from "selenium-webdriver/firefox"
import { getNewestFileIn, sendKeys } from "./utils"; import { getNewestFileIn, sendKeys } from "./utils";
@ -32,14 +32,11 @@ describe("webdriver", () => {
const options = (new Options()) const options = (new Options())
.setPreference("xpinstall.signatures.required", false) .setPreference("xpinstall.signatures.required", false)
.addExtensions(extensionPath)
if (env["HEADLESS"]) { if (env["HEADLESS"]) {
options.headless(); options.headless();
} }
const driver = new webdriver.Builder() const driver = Driver.createSession(options)
.forBrowser("firefox") await driver.installAddon(extensionPath, /*temporary*/true)
.setFirefoxOptions(options)
.build()
// Wait until addon is loaded and :tutor is displayed // Wait until addon is loaded and :tutor is displayed
await iframeLoaded(driver) await iframeLoaded(driver)
// And wait a bit more otherwise Tridactyl won't be happy // And wait a bit more otherwise Tridactyl won't be happy

View file

@ -80,7 +80,7 @@ export function sendKeys (driver, keys) {
}) })
.then(() => driver.sleep(delay)) .then(() => driver.sleep(delay))
} }
keys = keys.replace(":", "<S-;>")
let result = Promise.resolve() let result = Promise.resolve()
const regexp = /<[^>-]+-?[^>]*>/g const regexp = /<[^>-]+-?[^>]*>/g
const specialKeys = keys.match(regexp) const specialKeys = keys.match(regexp)