mirror of
https://github.com/valitydev/redash.git
synced 2024-11-06 17:15:17 +00:00
Fix flaky Map (Markers) tests (#4915)
* Fix flaky Map (Markers) tests * Fix flaky Choropleth tests
This commit is contained in:
parent
6bac19c1e4
commit
38dd3ff248
BIN
client/app/assets/images/fixtures/map-tile.png
Normal file
BIN
client/app/assets/images/fixtures/map-tile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
@ -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] });
|
||||
});
|
||||
});
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user