From 1d938b5a8b3c7cd4db9816b6997bcdca12a482f4 Mon Sep 17 00:00:00 2001 From: shelly_goldblit Date: Mon, 1 Jan 2024 15:53:15 +0200 Subject: [PATCH] review comments --- ...r-driver.ts => maputnik-cypress-helper.ts} | 0 cypress/e2e/maputnik-driver.ts | 33 ++++++++----------- cypress/e2e/modal-driver.ts | 2 +- cypress/e2e/modals.cy.ts | 4 +-- 4 files changed, 16 insertions(+), 23 deletions(-) rename cypress/e2e/{cypress-wrapper-driver.ts => maputnik-cypress-helper.ts} (100%) diff --git a/cypress/e2e/cypress-wrapper-driver.ts b/cypress/e2e/maputnik-cypress-helper.ts similarity index 100% rename from cypress/e2e/cypress-wrapper-driver.ts rename to cypress/e2e/maputnik-cypress-helper.ts diff --git a/cypress/e2e/maputnik-driver.ts b/cypress/e2e/maputnik-driver.ts index b43885e1..0a77eff2 100644 --- a/cypress/e2e/maputnik-driver.ts +++ b/cypress/e2e/maputnik-driver.ts @@ -1,6 +1,6 @@ import { CypressHelper } from "@shellygo/cypress-test-utils"; import { Assertable, then } from "@shellygo/cypress-test-utils/assertable"; -import MaputnikCypressHelper from "./cypress-wrapper-driver"; +import MaputnikCypressHelper from "./maputnik-cypress-helper"; import ModalDriver from "./modal-driver"; const baseUrl = "http://localhost:8888/"; @@ -108,18 +108,18 @@ export class MaputnikDriver { ) => { let url = "?debug"; switch (styleProperties) { - case "geojson": - url += `&style=${baseUrl}geojson-style.json`; - break; - case "raster": - url += `&style=${baseUrl}raster-style.json`; - break; - case "both": - url += `&style=${baseUrl}geojson-raster-style.json`; - break; - case "layer": - url += `&style=${baseUrl}/example-layer-style.json`; - break; + case "geojson": + url += `&style=${baseUrl}geojson-style.json`; + break; + case "raster": + url += `&style=${baseUrl}raster-style.json`; + break; + case "both": + url += `&style=${baseUrl}geojson-raster-style.json`; + break; + case "layer": + url += `&style=${baseUrl}/example-layer-style.json`; + break; } if (zoom) { url += `#${zoom}/41.3805/2.1635`; @@ -169,13 +169,6 @@ export class MaputnikDriver { styleFromLocalStorage: () => this.helper.get.window().then((win) => styleFromWindow(win)), - maputnikStyleFromLocalStorageObj: () => { - const styleId = localStorage.getItem("maputnik:latest_style"); - const styleItem = localStorage.getItem(`maputnik:style:${styleId}`); - const obj = JSON.parse(styleItem || ""); - return obj; - }, - exampleFileUrl: () => { return baseUrl + "example-style.json"; }, diff --git a/cypress/e2e/modal-driver.ts b/cypress/e2e/modal-driver.ts index 67a8a173..8a8b992c 100644 --- a/cypress/e2e/modal-driver.ts +++ b/cypress/e2e/modal-driver.ts @@ -1,5 +1,5 @@ import { v1 as uuid } from "uuid"; -import MaputnikCypressHelper from "./cypress-wrapper-driver"; +import MaputnikCypressHelper from "./maputnik-cypress-helper"; export default class ModalDriver { private helper = new MaputnikCypressHelper(); diff --git a/cypress/e2e/modals.cy.ts b/cypress/e2e/modals.cy.ts index 49ae193e..b30068f0 100644 --- a/cypress/e2e/modals.cy.ts +++ b/cypress/e2e/modals.cy.ts @@ -5,7 +5,7 @@ describe("modals", () => { beforeAndAfter(); beforeEach(() => { - when.visit("/"); + when.setStyle(""); }); describe("open", () => { beforeEach(() => { @@ -51,7 +51,7 @@ describe("modals", () => { when.click("nav:export"); }); - it.skip("close", () => { + it("close", () => { when.modal.close("modal:export"); then(get.elementByTestId("modal:export")).shouldNotExist(); });