Skip to content

Commit

Permalink
Merge branch 'staging' into data-whitelisting
Browse files Browse the repository at this point in the history
  • Loading branch information
emre2038 authored Jul 4, 2023
2 parents 7077b88 + 9a9be2f commit d77883f
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 22 deletions.
1 change: 1 addition & 0 deletions __tests__/gui/aborting_geo_request.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 6 additions & 1 deletion __tests__/gui/aborting_geo_request/aborting_geo_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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();
})
2 changes: 1 addition & 1 deletion __tests__/gui/aborting_geo_request/profiles.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@
}
}
]
}
}
19 changes: 9 additions & 10 deletions __tests__/gui/common_cy_functions/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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) {
Expand Down Expand Up @@ -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})
}
4 changes: 4 additions & 0 deletions __tests__/gui/data_mapper.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion __tests__/gui/data_mapper/data_mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
})
1 change: 1 addition & 0 deletions __tests__/gui/data_mapper_geo.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions __tests__/gui/data_mapper_geo/data_mapper_geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -103,4 +104,8 @@ Then('I wait until map is ready for Western Cape', () => {

Then('I navigate to ZA', () => {
visitToGeo('ZA');
})
})

And('I zoom out so whole map is visible', () => {
zoomOutMap();
})
5 changes: 3 additions & 2 deletions __tests__/gui/facilities/facilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -132,7 +134,6 @@ When('I navigate to a geography with no points', () => {
});
});

collapseRichDataPanel();
visitToGeo('NC');
expandRichDataPanel();
})
Expand Down Expand Up @@ -190,4 +191,4 @@ Then('I check if error message is displayed on the theme count section', () => {

When('I collapse Rich Data Panel', () => {
collapseRichDataPanel();
})
})
3 changes: 3 additions & 0 deletions __tests__/gui/rich_data_panel_link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions __tests__/gui/rich_data_panel_link/rich_data_panel_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
setupInterceptions,
waitUntilGeographyIsLoaded,
visitToGeo,
zoomOutMap,
} from "../common_cy_functions/general";


Expand Down Expand Up @@ -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();
})
10 changes: 5 additions & 5 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -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"
ENVIRONMENT = "FE_Branch-deploy"

0 comments on commit d77883f

Please sign in to comment.