mirror of
https://github.com/maputnik/editor.git
synced 2026-02-06 04:30:01 +00:00
convert more tests
This commit is contained in:
@@ -296,13 +296,14 @@ describe("layers", () => {
|
||||
when.click("layer-list-item:background:" + bgId);
|
||||
|
||||
let errorSelector = ".CodeMirror-lint-marker-error";
|
||||
should.notExist(errorSelector);
|
||||
// Not a good idea to check that something doesn't exist. infinite things don't exist.
|
||||
then(get.elementByTestId(errorSelector)).shouldNotExist();
|
||||
|
||||
when.click(".CodeMirror");
|
||||
when.typeKeys(
|
||||
"\uE013\uE013\uE013\uE013\uE013\uE013\uE013\uE013\uE013\uE013\uE013\uE013 {"
|
||||
);
|
||||
should.exist(errorSelector);
|
||||
then(get.elementByTestId(errorSelector)).shouldExist();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
import { then } from "@shellygo/cypress-test-utils/assertable";
|
||||
import MaputnikDriver from "./maputnik-driver";
|
||||
|
||||
describe("map", () => {
|
||||
let { beforeAndAfter, when, should } = new MaputnikDriver();
|
||||
let { beforeAndAfter, get, when } = new MaputnikDriver();
|
||||
beforeAndAfter();
|
||||
describe("zoom level", () => {
|
||||
it("via url", () => {
|
||||
let zoomLevel = 12.37;
|
||||
when.setStyle("geojson", zoomLevel);
|
||||
should.beVisible("maplibre:ctrl-zoom");
|
||||
should.containText("maplibre:ctrl-zoom", "Zoom: " + zoomLevel);
|
||||
then(get.elementByTestId("maplibre:ctrl-zoom")).shouldBeVisible();
|
||||
then(get.elementByTestId("maplibre:ctrl-zoom")).shouldContainText(
|
||||
"Zoom: " + zoomLevel
|
||||
);
|
||||
});
|
||||
|
||||
it("via map controls", () => {
|
||||
let zoomLevel = 12.37;
|
||||
when.setStyle("geojson", zoomLevel);
|
||||
|
||||
should.beVisible("maplibre:ctrl-zoom");
|
||||
when.clickZoomin();
|
||||
should.containText("maplibre:ctrl-zoom", "Zoom: "+(zoomLevel + 1));
|
||||
then(get.elementByTestId("maplibre:ctrl-zoom")).shouldBeVisible();
|
||||
then(get.elementByTestId("maplibre:ctrl-zoom")).shouldContainText(
|
||||
"Zoom: " + (zoomLevel + 1)
|
||||
);
|
||||
when.clickZoomIn();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -112,7 +112,7 @@ export default class MaputnikDriver {
|
||||
typeKeys: (keys: string, selector?: string) =>
|
||||
this.helper.get.element("body").type(keys),
|
||||
|
||||
clickZoomin: () => {
|
||||
clickZoomIn: () => {
|
||||
this.helper.get.element(".maplibregl-ctrl-zoom-in").click();
|
||||
},
|
||||
|
||||
@@ -167,11 +167,6 @@ export default class MaputnikDriver {
|
||||
};
|
||||
|
||||
public should = {
|
||||
canvasBeFocused: () => {
|
||||
this.when.within("maplibre:map", () => {
|
||||
this.helper.get.element("canvas").should("be.focused");
|
||||
});
|
||||
},
|
||||
notExist: (selector: string) => {
|
||||
this.helper.get.element(selector).should("not.exist");
|
||||
},
|
||||
|
||||
@@ -32,7 +32,6 @@ export default class ModalDriver {
|
||||
},
|
||||
|
||||
close: (key: string) => {
|
||||
this.helper.when.waitUntil(() => this.helper.get.element(key));
|
||||
this.helper.when.click(key + ".close-modal");
|
||||
},
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ describe("modals", () => {
|
||||
when.click("nav:open");
|
||||
});
|
||||
|
||||
it("close", () => {
|
||||
it.only("close", () => {
|
||||
when.modal.close("modal:open");
|
||||
should.notExist("modal:open");
|
||||
});
|
||||
@@ -125,7 +125,10 @@ describe("modals", () => {
|
||||
|
||||
it("thunderforest access token", () => {
|
||||
let apiKey = "testing123";
|
||||
when.setValue("modal:settings.maputnik:thunderforest_access_token", apiKey);
|
||||
when.setValue(
|
||||
"modal:settings.maputnik:thunderforest_access_token",
|
||||
apiKey
|
||||
);
|
||||
when.click("modal:settings.name");
|
||||
|
||||
should.equalStyleStore(
|
||||
|
||||
Reference in New Issue
Block a user