Skip to content

Commit

Permalink
convert more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shelly_goldblit committed Dec 30, 2023
1 parent 0dc3f4b commit 085eda7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
5 changes: 3 additions & 2 deletions cypress/e2e/layers.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});
Expand Down
18 changes: 11 additions & 7 deletions cypress/e2e/map.cy.ts
Original file line number Diff line number Diff line change
@@ -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();
});
});
});
7 changes: 1 addition & 6 deletions cypress/e2e/maputnik-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default class MaputnikDriver {
typeKeys: (keys: string, selector?: string) =>

Check failure on line 112 in cypress/e2e/maputnik-driver.ts

View workflow job for this annotation

GitHub Actions / build on ubuntu-latest

'selector' is declared but its value is never read.

Check failure on line 112 in cypress/e2e/maputnik-driver.ts

View workflow job for this annotation

GitHub Actions / build artifacts

'selector' is declared but its value is never read.

Check failure on line 112 in cypress/e2e/maputnik-driver.ts

View workflow job for this annotation

GitHub Actions / build on windows-latest

'selector' is declared but its value is never read.

Check failure on line 112 in cypress/e2e/maputnik-driver.ts

View workflow job for this annotation

GitHub Actions / build on macos-latest

'selector' is declared but its value is never read.
this.helper.get.element("body").type(keys),

clickZoomin: () => {
clickZoomIn: () => {
this.helper.get.element(".maplibregl-ctrl-zoom-in").click();
},

Expand Down Expand Up @@ -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");
},
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/modal-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
},
};
Expand Down
7 changes: 5 additions & 2 deletions cypress/e2e/modals.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("modals", () => {
when.click("nav:open");
});

it("close", () => {
it.only("close", () => {
when.modal.close("modal:open");
should.notExist("modal:open");
});
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 085eda7

Please sign in to comment.