Fix flaky Map (Markers) tests (#4915)

* Fix flaky Map (Markers) tests

* Fix flaky Choropleth tests
This commit is contained in:
Levko Kravets 2020-05-26 10:57:08 +03:00 committed by GitHub
parent 6bac19c1e4
commit 38dd3ff248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 25 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -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] });
});
});

View File

@ -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

View File

@ -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) {