diff --git a/__tests__/gui/aborting_geo_request.feature b/__tests__/gui/aborting_geo_request.feature index 56936b05d..f683b64da 100644 --- a/__tests__/gui/aborting_geo_request.feature +++ b/__tests__/gui/aborting_geo_request.feature @@ -9,6 +9,7 @@ Feature: Aborting geo request And I click on "Language" in Data Mapper And I click on "Language most spoken at home" in Data Mapper And I click on "15-19" in Data Mapper + And I zoom out so whole map is visible When I navigate to WC and without waiting for response visit ZA Then I wait until map is ready diff --git a/__tests__/gui/aborting_geo_request/aborting_geo_request.js b/__tests__/gui/aborting_geo_request/aborting_geo_request.js index a3ce1604f..eeadf076e 100644 --- a/__tests__/gui/aborting_geo_request/aborting_geo_request.js +++ b/__tests__/gui/aborting_geo_request/aborting_geo_request.js @@ -5,7 +5,8 @@ import { gotoHomepage, setupInterceptions, waitUntilGeographyIsLoaded, - visitToGeo + visitToGeo, + zoomOutMap } from "../common_cy_functions/general"; import all_details from "./all_details.json"; import profile from "./profile.json"; @@ -102,3 +103,7 @@ When('I navigate to WC and without waiting for response visit ZA', () => { visitToGeo('ZA-Test', true); sendResponse(); }) + +And('I zoom out so whole map is visible', () => { + zoomOutMap(); +}) diff --git a/__tests__/gui/aborting_geo_request/profiles.json b/__tests__/gui/aborting_geo_request/profiles.json index 36bca8a18..39d21d8b5 100644 --- a/__tests__/gui/aborting_geo_request/profiles.json +++ b/__tests__/gui/aborting_geo_request/profiles.json @@ -90,4 +90,4 @@ } } ] -} \ No newline at end of file +} diff --git a/__tests__/gui/common_cy_functions/general.js b/__tests__/gui/common_cy_functions/general.js index 78d1cb489..8233c87a5 100644 --- a/__tests__/gui/common_cy_functions/general.js +++ b/__tests__/gui/common_cy_functions/general.js @@ -157,8 +157,9 @@ export function setupInterceptionsForSpecificGeo(geoCode, all_details) { } export function visitToGeo(geoCode, isParent = false, forceClick = false) { + cy.wait(1000) + const geoName = geoCoordinates[geoCode].name; if (isParent) { - const geoName = geoCoordinates[geoCode].name; cy.get(`.map-location .location-tag .location-tag__name .truncate:contains('${geoName}')`, {timeout: 20000}).click(); } else { const coords = geoCoordinates[geoCode]; @@ -167,17 +168,11 @@ export function visitToGeo(geoCode, isParent = false, forceClick = false) { L = win.L; let map = win.map; const latlng = L.latLng(coords.lat, coords.lng); - - map.flyTo(latlng, 14); - const waitMs = forceClick ? 4000 : 0; - hoverOverTheMapCenter('.leaflet-overlay-pane .leaflet-zoom-animated') - .then(() => { - cy.wait(waitMs).then(() => { - cy.get('.leaflet-overlay-pane .leaflet-zoom-animated').click({force: forceClick}); - }) - }) + var point = map.latLngToContainerPoint(latlng); + cy.get('#main-map', {timeout: 20000}).trigger('click', point.x, point.y); }); } + waitUntilGeographyIsLoaded(geoName); } export function extractRequestedIndicatorData(url, indicatorData) { @@ -545,3 +540,7 @@ export function confirmChartIsFiltered(group, value, chartTitle) { expect(matches).equal(true); }) } + +export function zoomOutMap() { + cy.get("a.leaflet-control-zoom-out", {timeout: 20000}).click({force: true}) +} diff --git a/__tests__/gui/data_mapper.feature b/__tests__/gui/data_mapper.feature index cb7aafd07..317da3795 100644 --- a/__tests__/gui/data_mapper.feature +++ b/__tests__/gui/data_mapper.feature @@ -14,6 +14,8 @@ Feature: Data Mapper Then I check if choropleth legend is displayed Then I expand filter dialog Then I check if everything is zero + And I zoom out so whole map is visible + And I collapse the choropleth filter dialog And I navigate to EC and check if the loading state is displayed correctly @@ -42,6 +44,7 @@ Feature: Data Mapper # confirm that navigating between geographies does not break the data mapper & choropleth And I navigate to ZA + And I collapse the choropleth filter dialog And I navigate to WC And I expand Data Mapper Then I check if there are 2 categories @@ -58,6 +61,7 @@ Feature: Data Mapper And I click on "2016 Municipal elections" in Data Mapper And I click on "Number of hung and majority councils" in Data Mapper And I click on "Hung" in Data Mapper + And I expand the choropleth filter dialog Then I check if the message is displayed correctly # confirm that default filters do not break navigating diff --git a/__tests__/gui/data_mapper/data_mapper.js b/__tests__/gui/data_mapper/data_mapper.js index db8502559..e6428c25c 100644 --- a/__tests__/gui/data_mapper/data_mapper.js +++ b/__tests__/gui/data_mapper/data_mapper.js @@ -16,7 +16,8 @@ import { gotoHomepage, mapBottomItems, selectChoroplethDropdownOption, setupInterceptions, visitToGeo, - waitUntilGeographyIsLoaded + waitUntilGeographyIsLoaded, + zoomOutMap, } from "../common_cy_functions/general"; import all_details from "./all_details.json"; import all_details_FS from "./all_details_FS.json"; @@ -120,6 +121,7 @@ When('I navigate to EC and check if the loading state is displayed correctly', ( }) visitToGeo('EC'); + expandChoroplethFilterDialog(); cy.get('.data-mapper-content__loading').should('be.visible').then(() => { //loading = true @@ -317,3 +319,7 @@ Then('I collapse Rich Data Panel', () => { Then(/^I check if the geography name is "([^"]*)"$/, function (name) { cy.get('.location__title h1').should('have.text', name); }); + +And('I zoom out so whole map is visible', () => { + zoomOutMap(); +}) diff --git a/__tests__/gui/data_mapper_geo.feature b/__tests__/gui/data_mapper_geo.feature index 06086874f..effd07d54 100644 --- a/__tests__/gui/data_mapper_geo.feature +++ b/__tests__/gui/data_mapper_geo.feature @@ -16,6 +16,7 @@ Feature: Data Mapper And I click on "20-24" in Data Mapper Then I check if mapchip header text contains "20-24" + And I zoom out so whole map is visible When I navigate to WC Then I wait until map is ready for Western Cape diff --git a/__tests__/gui/data_mapper_geo/data_mapper_geo.js b/__tests__/gui/data_mapper_geo/data_mapper_geo.js index fc8e0e81d..eb504ec41 100644 --- a/__tests__/gui/data_mapper_geo/data_mapper_geo.js +++ b/__tests__/gui/data_mapper_geo/data_mapper_geo.js @@ -6,7 +6,8 @@ import { gotoHomepage, mapBottomItems, setupInterceptions, visitToGeo, - waitUntilGeographyIsLoaded + waitUntilGeographyIsLoaded, + zoomOutMap } from "../common_cy_functions/general"; import all_details from "./all_details.json"; import profile from "./profile.json"; @@ -103,4 +104,8 @@ Then('I wait until map is ready for Western Cape', () => { Then('I navigate to ZA', () => { visitToGeo('ZA'); -}) \ No newline at end of file +}) + +And('I zoom out so whole map is visible', () => { + zoomOutMap(); +}) diff --git a/__tests__/gui/facilities/facilities.js b/__tests__/gui/facilities/facilities.js index a9f7c900e..e7f43af63 100644 --- a/__tests__/gui/facilities/facilities.js +++ b/__tests__/gui/facilities/facilities.js @@ -108,6 +108,8 @@ When('I navigate to EC and check if the loading state is displayed correctly', ( }) When('I navigate to a geography with no points', () => { + collapseRichDataPanel(); + visitToGeo('ZA-Test', true, true); cy.intercept(`/api/v1/${allDetailsEndpoint}/profile/8/geography/NC/?version=test&skip-children=true&format=json`, (request) => { request.reply({ statusCode: 200, @@ -132,7 +134,6 @@ When('I navigate to a geography with no points', () => { }); }); - collapseRichDataPanel(); visitToGeo('NC'); expandRichDataPanel(); }) @@ -190,4 +191,4 @@ Then('I check if error message is displayed on the theme count section', () => { When('I collapse Rich Data Panel', () => { collapseRichDataPanel(); -}) \ No newline at end of file +}) diff --git a/__tests__/gui/rich_data_panel_link.feature b/__tests__/gui/rich_data_panel_link.feature index 4eb7c4d60..e2ca78e7e 100644 --- a/__tests__/gui/rich_data_panel_link.feature +++ b/__tests__/gui/rich_data_panel_link.feature @@ -11,6 +11,7 @@ Feature: Rich Data Panel Link Then I check if the location facilities is visible Then I check if rich data panel has data Then I expand Data Mapper + And I zoom out so whole map is visible When I visit Western Cape Then I wait until map is ready for Western Cape @@ -21,6 +22,7 @@ Feature: Rich Data Panel Link Then I check if the location facilities is hidden Then I check if rich data panel has data Then I expand Data Mapper + And I zoom out so whole map is visible When I visit City of Cape Town Then I wait until map is ready for City of Cape Town @@ -40,6 +42,7 @@ Feature: Rich Data Panel Link Then I check if the location facilities is hidden Then I check if rich data panel is empty Then I expand Data Mapper + And I zoom out so whole map is visible When I revisit Western Cape Then I wait until map is ready for Western Cape diff --git a/__tests__/gui/rich_data_panel_link/rich_data_panel_link.js b/__tests__/gui/rich_data_panel_link/rich_data_panel_link.js index fa539b7ff..dd27112af 100644 --- a/__tests__/gui/rich_data_panel_link/rich_data_panel_link.js +++ b/__tests__/gui/rich_data_panel_link/rich_data_panel_link.js @@ -8,6 +8,7 @@ import { setupInterceptions, waitUntilGeographyIsLoaded, visitToGeo, + zoomOutMap, } from "../common_cy_functions/general"; @@ -179,3 +180,7 @@ Then('I check if rich data panel is empty', () => { When('I revisit Western Cape', () => { visitToGeo('WC', true); }) + +And('I zoom out so whole map is visible', () => { + zoomOutMap(); +}) diff --git a/netlify.toml b/netlify.toml index be917293c..5336c6888 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,23 +1,23 @@ # Production context: all deploys from the Production branch set in your site's deploy contexts will inherit these settings. [context.production.environment] - GOOGLE_ANALYTICS_ID = "UA-93649482-25" + GOOGLE_ANALYTICS_ID = "G-7DSTL89K69" SENTRY_DSN = "https://aae3ed779891437d984db424db5c9dd0@o242378.ingest.sentry.io/5257787" ENVIRONMENT = "FE_Production" # Specific branch context: all deploys from this specific branch will inherit these settings. [context.staging.environment] # 'staging' is a branch - GOOGLE_ANALYTICS_ID = "" + GOOGLE_ANALYTICS_ID = "G-9HFRD1796B" SENTRY_DSN = "https://aae3ed779891437d984db424db5c9dd0@o242378.ingest.sentry.io/5257787" ENVIRONMENT = "FE_Staging" # Deploy preview context: all deploys generated from a pull/merge request will inherit these settings. [context.deploy-preview.environment] - GOOGLE_ANALYTICS_ID = "" + GOOGLE_ANALYTICS_ID = "G-9HFRD1796B" SENTRY_DSN = "https://aae3ed779891437d984db424db5c9dd0@o242378.ingest.sentry.io/5257787" ENVIRONMENT = "FE_Deploy-preview" # Branch deploy context: all deploys that are not from a pull/merge request or from the Production branch will inherit these settings. [context.branch-deploy.environment] - GOOGLE_ANALYTICS_ID = "" + GOOGLE_ANALYTICS_ID = "G-9HFRD1796B" SENTRY_DSN = "https://aae3ed779891437d984db424db5c9dd0@o242378.ingest.sentry.io/5257787" - ENVIRONMENT = "FE_Branch-deploy" \ No newline at end of file + ENVIRONMENT = "FE_Branch-deploy"