Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Delete Terrain basemap for compare mode #336

Merged
merged 2 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/pages/comparison/comparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ import { Layout } from "../../utils/enums";
import { useAppDispatch } from "../../redux/hooks";
import { setDragMode } from "../../redux/slices/drag-mode-slice";
import { setColorsByAttrubute } from "../../redux/slices/symbolization-slice";
import { setInitialBaseMaps } from "../../redux/slices/base-maps-slice";
import {
deleteBaseMaps,
setInitialBaseMaps,
} from "../../redux/slices/base-maps-slice";

type ComparisonPageProps = {
mode: ComparisonMode;
Expand Down Expand Up @@ -140,6 +143,7 @@ export const Comparison = ({ mode }: ComparisonPageProps) => {
setBookmarks([]);
dispatch(setColorsByAttrubute(null));
dispatch(setDragMode(DragMode.pan));
dispatch(deleteBaseMaps("Terrain"));
return () => {
dispatch(setInitialBaseMaps());
};
Expand Down
7 changes: 4 additions & 3 deletions src/pages/comparison/e2e.comparison.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
checkLayersPanel,
inserAndDeleteLayer,
} from "../../utils/testing-utils/e2e-layers-panel";
import { PageId } from "../../types";

describe("Compare", () => {
let browser;
Expand Down Expand Up @@ -141,14 +142,14 @@ describe("Compare - Layers Panel Across Layers mode", () => {
const panelId = "#left-layers-panel";
await page.waitForSelector(panelId);
expect(await page.$$(panelId)).toBeDefined();
await checkLayersPanel(page, panelId);
await checkLayersPanel(page, panelId, undefined, PageId.comparison);
});

it("Should show right layers panel", async () => {
const panelId = "#right-layers-panel";
await page.waitForSelector(panelId);
expect(await page.$$(panelId)).toBeDefined();
await checkLayersPanel(page, panelId);
await checkLayersPanel(page, panelId, undefined, PageId.comparison);
});

it("Should select layers", async () => {
Expand Down Expand Up @@ -224,7 +225,7 @@ describe("Compare - Layers Panel Within Layer mode", () => {
const panelId = "#left-layers-panel";
await page.waitForSelector(panelId);
expect(await page.$$(panelId)).toBeDefined();
await checkLayersPanel(page, panelId);
await checkLayersPanel(page, panelId, undefined, PageId.comparison);
});

it("Shouldn't show right layers panel", async () => {
Expand Down
15 changes: 12 additions & 3 deletions src/utils/testing-utils/e2e-layers-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { PageId } from "../../types";

function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}

export const checkLayersPanel = async (
page,
panelId: string,
hasSelectedLayer = false
hasSelectedLayer = false,
appMode = ""
) => {
// Tabs
const tabsContainer = await page.$(`${panelId} > :first-child`);
Expand Down Expand Up @@ -69,8 +72,14 @@ export const checkLayersPanel = async (
`${panelId} > :nth-child(4) > :first-child > :nth-child(2) > div`,
(nodes) => nodes.map((node) => node.innerText)
);
expect(baseMapsNames.length).toBe(3);
expect(baseMapsNames).toEqual(["Dark", "Light", "Terrain"]);

if (appMode === PageId.comparison) {
expect(baseMapsNames.length).toBe(2);
expect(baseMapsNames).toEqual(["Dark", "Light"]);
} else {
expect(baseMapsNames.length).toBe(3);
expect(baseMapsNames).toEqual(["Dark", "Light", "Terrain"]);
}

// Dark is selected
const darkMapBackground = await page.$eval(
Expand Down