diff --git a/client/app/assets/images/fixtures/map-tile.png b/client/app/assets/images/fixtures/map-tile.png new file mode 100644 index 00000000..06062629 Binary files /dev/null and b/client/app/assets/images/fixtures/map-tile.png differ diff --git a/client/cypress/integration/visualizations/choropleth_spec.js b/client/cypress/integration/visualizations/choropleth_spec.js index 55ffc2b8..d9199f8e 100644 --- a/client/cypress/integration/visualizations/choropleth_spec.js +++ b/client/cypress/integration/visualizations/choropleth_spec.js @@ -30,6 +30,8 @@ const SQL = ` `; describe("Choropleth", () => { + const viewportWidth = Cypress.config("viewportWidth"); + beforeEach(() => { cy.login(); createQuery({ query: SQL }).then(({ id }) => { @@ -84,8 +86,6 @@ describe("Choropleth", () => { .find(".map-visualization-container.leaflet-container") .should("exist"); - // This is unstable and therefore disabled until a better solution is available. - // const viewportWidth = Cypress.config("viewportWidth"); - // cy.percySnapshot("Visualizations - Choropleth", { widths: [viewportWidth] }); + cy.percySnapshot("Visualizations - Choropleth", { widths: [viewportWidth] }); }); }); diff --git a/client/cypress/integration/visualizations/map_spec.js b/client/cypress/integration/visualizations/map_spec.js index 297e3665..693a6eb9 100644 --- a/client/cypress/integration/visualizations/map_spec.js +++ b/client/cypress/integration/visualizations/map_spec.js @@ -1,15 +1,15 @@ /* global cy */ -import { createQuery } from "../../support/redash-api"; +import { createQuery, createVisualization } from "../../support/redash-api"; const SQL = ` - SELECT 'Israel' AS country, 32.0808800 AS lat, 34.7805700 AS lng UNION ALL + SELECT 'Israel' AS country, 32.0808800 AS lat, 34.7805700 AS lng UNION ALL SELECT 'Israel' AS country, 31.7690400 AS lat, 35.2163300 AS lng UNION ALL SELECT 'Israel' AS country, 32.8184100 AS lat, 34.9885000 AS lng UNION ALL - + SELECT 'Ukraine' AS country, 50.4546600 AS lat, 30.5238000 AS lng UNION ALL - SELECT 'Ukraine' AS country, 49.8382600 AS lat, 24.0232400 AS lng UNION ALL - SELECT 'Ukraine' AS country, 49.9808100 AS lat, 36.2527200 AS lng UNION ALL + SELECT 'Ukraine' AS country, 49.8382600 AS lat, 24.0232400 AS lng UNION ALL + SELECT 'Ukraine' AS country, 49.9808100 AS lat, 36.2527200 AS lng UNION ALL SELECT 'Hungary' AS country, 47.4980100 AS lat, 19.0399100 AS lng `; @@ -19,20 +19,20 @@ describe("Map (Markers)", () => { beforeEach(() => { cy.login(); - createQuery({ query: SQL }).then(({ id }) => { - cy.visit(`queries/${id}/source`); - cy.getByTestId("ExecuteButton").click(); - }); + + const mapTileUrl = "/static/images/fixtures/map-tile.png"; + + createQuery({ query: SQL }) + .then(({ id }) => createVisualization(id, "MAP", "Map (Markers)", { mapTileUrl })) + .then(({ id: visualizationId, query_id: queryId }) => { + cy.visit(`queries/${queryId}/source#${visualizationId}`); + cy.getByTestId("ExecuteButton").click(); + }); }); it("creates Map with groups", () => { cy.clickThrough(` - NewVisualization - VisualizationType - VisualizationType.MAP - `); - - cy.clickThrough(` + EditVisualization VisualizationEditor.Tabs.General Map.Editor.LatitudeColumnName Map.Editor.LatitudeColumnName.lat @@ -64,12 +64,7 @@ describe("Map (Markers)", () => { it("creates Map with custom markers", () => { cy.clickThrough(` - NewVisualization - VisualizationType - VisualizationType.MAP - `); - - cy.clickThrough(` + EditVisualization VisualizationEditor.Tabs.General Map.Editor.LatitudeColumnName Map.Editor.LatitudeColumnName.lat diff --git a/viz-lib/src/visualizations/choropleth/Renderer/index.jsx b/viz-lib/src/visualizations/choropleth/Renderer/index.jsx index 96cada33..0abae34d 100644 --- a/viz-lib/src/visualizations/choropleth/Renderer/index.jsx +++ b/viz-lib/src/visualizations/choropleth/Renderer/index.jsx @@ -53,7 +53,7 @@ export default function Renderer({ data, options, onOptionsChange }) { options // detect changes for all options except bounds, but pass them all! ); } - }, [map, geoJson, data, optionsWithoutBounds]); // eslint-disable-line react-hooks/exhaustive-deps + }, [map, geoJson, data.rows, optionsWithoutBounds]); // eslint-disable-line react-hooks/exhaustive-deps useEffect(() => { if (map) {