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