From 0ed6bb518f0597bbf006b0b7cbd3f5882df7a046 Mon Sep 17 00:00:00 2001 From: shelly_goldblit Date: Sun, 31 Dec 2023 18:53:46 +0200 Subject: [PATCH] fix more tests --- cypress/e2e/layers.cy.ts | 8 +++----- cypress/e2e/modals.cy.ts | 28 ++++++++++++++++------------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/cypress/e2e/layers.cy.ts b/cypress/e2e/layers.cy.ts index cf61077d..053429d3 100644 --- a/cypress/e2e/layers.cy.ts +++ b/cypress/e2e/layers.cy.ts @@ -491,12 +491,10 @@ describe("layers", () => { type: "background", }); - then(get.elementByTestId("layer-list-group:foo")).shouldBeVisible(); + then(get.elementByTestId("layer-list-item:foo")).shouldBeVisible(); + then(get.elementByTestId("layer-list-item:foo_bar")).shouldNotBeVisible(); then( - get.elementByTestId("layer-list-group:foo_bar") - ).shouldNotBeVisible(); - then( - get.elementByTestId("layer-list-group:foo_bar_baz") + get.elementByTestId("layer-list-item:foo_bar_baz") ).shouldNotBeVisible(); when.click("layer-list-group:foo-0"); then(get.elementByTestId("layer-list-item:foo")).shouldBeVisible(); diff --git a/cypress/e2e/modals.cy.ts b/cypress/e2e/modals.cy.ts index c2f57856..fc9a29ac 100644 --- a/cypress/e2e/modals.cy.ts +++ b/cypress/e2e/modals.cy.ts @@ -20,7 +20,7 @@ describe("modals", () => { it.skip("upload", () => { // HM: I was not able to make the following choose file actually to select a file and close the modal... when.chooseExampleFile(); - then(get.responseBody("example-style.json")).shouldDeepEqual( + then(get.responseBody("example-style.json")).shouldHaveLocalStorageStyle( get.maputnikStyleFromLocalStorageObj() ); }); @@ -34,9 +34,9 @@ describe("modals", () => { when.wait(200); }); it("load from url", () => { - then(get.responseBody("example-style.json")).shouldDeepEqual( - get.maputnikStyleFromLocalStorageObj() - ); + then( + get.responseBody("example-style.json") + ).shouldHaveLocalStorageStyle(get.maputnikStyleFromLocalStorageObj()); }); }); }); @@ -103,7 +103,9 @@ describe("modals", () => { }); it("show name specifications", () => { - then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({ + then( + get.maputnikStyleFromLocalStorage() + ).shouldIncludeLocalStorageStyle({ name: "foobar", }); }); @@ -116,7 +118,9 @@ describe("modals", () => { when.wait(200); }); it("should update owner in local storage", () => { - then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({ + then( + get.maputnikStyleFromLocalStorage() + ).shouldIncludeLocalStorageStyle({ owner: "foobar", }); }); @@ -125,7 +129,7 @@ describe("modals", () => { it("sprite url", () => { when.setValue("modal:settings.sprite", "http://example.com"); when.click("modal:settings.name"); - then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({ + then(get.maputnikStyleFromLocalStorage()).shouldIncludeLocalStorageStyle({ sprite: "http://example.com", }); }); @@ -133,7 +137,7 @@ describe("modals", () => { let glyphsUrl = "http://example.com/{fontstack}/{range}.pbf"; when.setValue("modal:settings.glyphs", glyphsUrl); when.click("modal:settings.name"); - then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({ + then(get.maputnikStyleFromLocalStorage()).shouldIncludeLocalStorageStyle({ glyphs: glyphsUrl, }); }); @@ -145,8 +149,8 @@ describe("modals", () => { apiKey ); when.click("modal:settings.name"); - then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({ - metadata: { "maputnik:openmaptiles_access_token": apiKey }, + then(get.maputnikStyleFromLocalStorage()).shouldIncludeLocalStorageStyle({ + "maputnik:openmaptiles_access_token": apiKey, }); }); @@ -157,7 +161,7 @@ describe("modals", () => { apiKey ); when.click("modal:settings.name"); - then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({ + then(get.maputnikStyleFromLocalStorage()).shouldIncludeLocalStorageStyle({ metadata: { "maputnik:thunderforest_access_token": apiKey }, }); }); @@ -170,7 +174,7 @@ describe("modals", () => { ); when.click("modal:settings.name"); - then(get.maputnikStyleFromLocalStorage()).shouldDeepNestedInclude({ + then(get.maputnikStyleFromLocalStorage()).shouldIncludeLocalStorageStyle({ metadata: { "maputnik:renderer": "ol" }, }); });