Files
editor/test/functional/keyboard/index.js
Harel M 73f7798a1d Use driver pattern for e2e tests (#2)
* Initial commit

* Fix spec

* Move driver

* Fix config location

* Fix helper location

* More usage of driver

* Add click

* Fix click

* Migrate more tests

* Add setValue to driver

* Move more code to driver

* add isExisting to driver

* Change modal tests to use driver

* Fix tests

* Fix test

* Fix invalid alert wait

* Fix missing wd

* Fix tests

* Fix missing fs

* Fix test

* Fix path

* Move screenshort to driver

* Migrate keyboard

* Migrate skiplinks to driver

* Fix tests

* Try fix skip-links

* add config

* Add helper

* Fix driver?

* remove helper

* remove wd-helper

* Remove redundant file

* Remove webdriver extsions
2023-12-14 18:14:06 +02: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")));
});
});
});