Files
editor/test/functional/keyboard/index.js
Harel M 18f45e932b Use driver pattern for e2e tests (#829)
I've moved all the logic relevant to WBIO into a single file in order to
be able to replace it.
I have tried to upgrade WDIO in order to use the latest version and it
got stuck on my computer.
Furthermore, I was not able to run it locally which made this whole
cycle very long.
After this will be merged I will replace WDIO with cypress.
This doesn't change anything, only moves some code in the tests to a
single file, removes unneeded files and uses the driver pattern, which
will later allow switching the underline WDIO with Cypress.

cc: @nyurik
2023-12-17 01:14:23 -05:00

57 lines
1.9 KiB
JavaScript

var assert = require("assert");
var driver = require("../driver");
describe("keyboard", function() {
describe("shortcuts", function() {
it("ESC should unfocus", async function() {
const targetSelector = driver.getDataAttribute("nav:inspect") + " select";
driver.click(targetSelector);
assert(await driver.isFocused(targetSelector));
await driver.typeKeys(["Escape"]);
assert(await (await $("body")).isFocused());
});
it("'?' should show shortcuts modal", async function() {
await driver.typeKeys(["?"]);
assert(await driver.isDisplayedInViewport(driver.getDataAttribute("modal:shortcuts")));
});
it("'o' should show open modal", async function() {
await driver.typeKeys(["o"]);
assert(await driver.isDisplayedInViewport(driver.getDataAttribute("modal:open")));
});
it("'e' should show export modal", async function() {
await driver.typeKeys(["e"]);
await driver.sleep(100);
assert(await driver.isDisplayedInViewport(driver.getDataAttribute("modal:export")));
});
it("'d' should show sources modal", async function() {
await driver.typeKeys(["d"]);
assert(await driver.isDisplayedInViewport(driver.getDataAttribute("modal:sources")));
});
it("'s' should show settings modal", async function() {
await driver.typeKeys(["s"]);
assert(await driver.isDisplayedInViewport(driver.getDataAttribute("modal:settings")));
});
it.skip("'i' should change map to inspect mode", async function() {
// await driver.typeKeys(["i"]);
});
it("'m' should focus map", async function() {
await driver.typeKeys(["m"]);
assert(await driver.isFocused(".maplibregl-canvas"));
});
it("'!' should show debug modal", async function() {
await driver.typeKeys(["!"]);
assert(await driver.isDisplayedInViewport(driver.getDataAttribute("modal:debug")));
});
});
});