Skip to content

Commit

Permalink
COMPENF-126-Display marker on map based on coordinates (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
barrfalk authored Aug 17, 2023
1 parent df0d0ca commit 6385bb7
Show file tree
Hide file tree
Showing 25 changed files with 3,699 additions and 408 deletions.
12 changes: 10 additions & 2 deletions backend/db/migrations/R__Create-Test-Data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ VALUES('23-006887', 'Caller reporting a dumping site off the side of Hwy 3, goin
ON CONFLICT DO NOTHING;
INSERT INTO public.complaint
(complaint_identifier, detail_text, caller_name, caller_address, caller_email, caller_phone_1, caller_phone_2, caller_phone_3, location_summary_text, location_detailed_text, incident_datetime, incident_reported_datetime, referred_by_agency_other_text, create_user_id, create_timestamp, update_user_id, update_timestamp, referred_by_agency_code, owned_by_agency_code, complaint_status_code, geo_organization_unit_code, location_geometry_point)
VALUES('23-006888', 'Caller was involved in an altercation yesterday with a person who was exceeding the Caller’s understanding of the limit. SUBs were attempting to catch 5 fish, of each type, each person (total 20.) SUBs male and their wife. Caller requesting CO clarification regarding fish quotas for region 3. Caller has contacted front counter BC, who referred the answer to COS.', 'Kelsey', '135 fake st', NULL, '555-555-5565', NULL, NULL, 'Keefes Landing Rd and Danskin Rd', 'tester call description 8', '2023-04-11 07:24:00.000', '2023-04-10 07:24:00.000', 'test2', 'FLYWAY', '2023-06-29 22:16:16.754', 'FLYWAY', '2023-06-29 22:16:16.754', 'BYLAW', 'COS', 'OPEN', 'DANSKIN', 'SRID=4326;POINT (0 0)'::public.geometry)
VALUES('23-006888', 'Caller was involved in an altercation yesterday with a person who was exceeding the Caller’s understanding of the limit. SUBs were attempting to catch 5 fish, of each type, each person (total 20.) SUBs male and their wife. Caller requesting CO clarification regarding fish quotas for region 3. Caller has contacted front counter BC, who referred the answer to COS.', 'Kelsey', '135 fake st', NULL, '555-555-5565', NULL, NULL, 'Keefes Landing Rd and Danskin Rd', 'tester call description 8', '2023-04-11 07:24:00.000', '2023-04-10 07:24:00.000', 'test2', 'FLYWAY', '2023-06-29 22:16:16.754', 'FLYWAY', '2023-06-29 22:16:16.754', 'BYLAW', 'COS', 'OPEN', 'DANSKIN', 'SRID=4326;POINT (53.991532 -125.7878868)'::public.geometry)
ON CONFLICT DO NOTHING;
INSERT INTO public.complaint
(complaint_identifier, detail_text, caller_name, caller_address, caller_email, caller_phone_1, caller_phone_2, caller_phone_3, location_summary_text, location_detailed_text, incident_datetime, incident_reported_datetime, referred_by_agency_other_text, create_user_id, create_timestamp, update_user_id, update_timestamp, referred_by_agency_code, owned_by_agency_code, complaint_status_code, geo_organization_unit_code, location_geometry_point)
Expand Down Expand Up @@ -1195,7 +1195,7 @@ VALUES('23-007022', 'Calling to report that a moose was hit by a car this mornin
ON CONFLICT DO NOTHING;
INSERT INTO public.complaint
(complaint_identifier, detail_text, caller_name, caller_address, caller_email, caller_phone_1, caller_phone_2, caller_phone_3, location_summary_text, location_detailed_text, incident_datetime, incident_reported_datetime, referred_by_agency_other_text, create_user_id, create_timestamp, update_user_id, update_timestamp, referred_by_agency_code, owned_by_agency_code, complaint_status_code, geo_organization_unit_code, location_geometry_point)
VALUES('23-007023', 'Caller reporting plastic garbage dumped in the shallows of Lake near the mouth of the creek When caller picked up plastics she saw a small amount of paint spill from the bag. The water is fish baring and caller can see a little cloud of material. Caller does not know how much pain was originally in the plastic bag. Caller threw out the garbage but took a picture.', 'Chris', '130 fake st', NULL, '555-555-5560', '555-555-5568', NULL, '5807 crystal Rd', NULL, '2023-04-06 07:24:00.000', '2023-04-05 07:24:00.000', NULL, 'FLYWAY','2023-06-29 22:16:16.754', 'FLYWAY','2023-06-29 22:16:16.754', NULL, 'COS', 'OPEN', 'ROSELAK', 'SRID=4326;POINT (0 0)'::public.geometry)
VALUES('23-007023', 'Caller reporting plastic garbage dumped in the shallows of Lake near the mouth of the creek When caller picked up plastics she saw a small amount of paint spill from the bag. The water is fish baring and caller can see a little cloud of material. Caller does not know how much pain was originally in the plastic bag. Caller threw out the garbage but took a picture.', 'Chris', '130 fake st', NULL, '555-555-5560', '555-555-5568', NULL, '5807 crystal Rd', NULL, '2023-04-06 07:24:00.000', '2023-04-05 07:24:00.000', NULL, 'FLYWAY','2023-06-29 22:16:16.754', 'FLYWAY','2023-06-29 22:16:16.754', NULL, 'COS', 'OPEN', 'ROSELAK', 'SRID=4326;POINT (50.1705571 -115.6849567)'::public.geometry)
ON CONFLICT DO NOTHING;
INSERT INTO public.complaint
(complaint_identifier, detail_text, caller_name, caller_address, caller_email, caller_phone_1, caller_phone_2, caller_phone_3, location_summary_text, location_detailed_text, incident_datetime, incident_reported_datetime, referred_by_agency_other_text, create_user_id, create_timestamp, update_user_id, update_timestamp, referred_by_agency_code, owned_by_agency_code, complaint_status_code, geo_organization_unit_code, location_geometry_point)
Expand Down Expand Up @@ -1271,3 +1271,11 @@ INSERT INTO public.allegation_complaint (in_progress_ind,observed_ind,suspect_wi
(true,false,NULL,'FLYWAY','2023-07-26 19:25:34.66322','FLYWAY','2023-07-26 19:25:34.66322','23-007028','RECREATN'),
(true,true,NULL,'FLYWAY','2023-07-26 19:25:34.66322','FLYWAY','2023-07-26 19:25:34.66322','23-007029','FISHERY')
ON CONFLICT DO NOTHING;

UPDATE public.complaint t
set location_geometry_point = 'POINT (50.1705571 -115.6849567)'
where t.complaint_identifier = '23-007023';

UPDATE public.complaint t
set location_geometry_point = 'POINT (53.991532 -125.7878868)'
where t.complaint_identifier = '23-006888';
2 changes: 1 addition & 1 deletion frontend/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate"
X-Content-Type-Options "nosniff"
Strict-Transport-Security "max-age=31536000"
Content-Security-Policy "default-src 'self' https://*.gov.bc.ca data:; script-src https://*.gov.bc.ca 'self' 'unsafe-eval' https://www2.gov.bc.ca ;style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://use.fontawesome.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https://fonts.googleapis.com http://www.w3.org https://*.gov.bc.ca"
Content-Security-Policy "default-src 'self' https://*.gov.bc.ca data:; script-src https://*.gov.bc.ca 'self' 'unsafe-eval' https://www2.gov.bc.ca ;style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://use.fontawesome.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https://fonts.googleapis.com http://www.w3.org https://*.gov.bc.ca https://*.tile.openstreetmap.org"
Referrer-Policy "same-origin"
Feature-Policy "fullscreen 'self'; camera 'none'; microphone 'none'"
}
Expand Down
37 changes: 8 additions & 29 deletions frontend/cypress/e2e/allegation-details-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,13 @@ Test to verify that the user is able to click the edit button
on the wildlife contacts details page and see all the inputs
*/
describe("Complaint Edit Page spec - Edit Allegation View", () => {
before(function () {
beforeEach(function () {
cy.viewport("macbook-16");
cy.kcLogout().kcLogin();
});

it("Navigate to the Complaint Edit page & check inputs", () => {
cy.visit("/");

//-- click on Allegation tab
cy.get("#ers-tab").click({ force: true });

//this is our first test that is run after a deployment... give it a bit of extra time to finish while things spin up.
cy.get('.comp-loader-overlay', {timeout: 30000}).should('exist');
cy.get('.comp-loader-overlay', {timeout: 30000}).should('not.exist');

//-- check to make sure there are items in the table
cy.get("#comp-table")
.find("tr")
.then(({ length }) => {
expect(length, "rows N").to.be.gt(0);
});

cy.get(
"#comp-table > tbody > tr:nth-child(2) td.comp-location-cell.comp-cell"
).click({ force: true });

//this is our first test that is run after a deployment... give it a bit of extra time to finish while things spin up.
cy.get('.comp-loader-overlay', {timeout: 30000}).should('exist');
cy.get('.comp-loader-overlay', {timeout: 30000}).should('not.exist');

cy.window().scrollTo("top");


cy.get("#details-screen-edit-button").click({ force: true });
cy.navigateToAllegationEditScreen("23-006888");


// Note: if the layout of this page changes, these selectors that use classes may break
Expand Down Expand Up @@ -211,4 +184,10 @@ describe("Complaint Edit Page spec - Edit Allegation View", () => {
cy.get("#subject-of-complaint-pair-id textarea").should("exist");

});

it("it has a map on screen with a marker at the correct location", function () {
cy.navigateToAllegationEditScreen("23-006888");
cy.verifyMapMarkerExists();
});

});
24 changes: 5 additions & 19 deletions frontend/cypress/e2e/allegation-details.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,7 @@ describe("COMPENF-37 Display ECR Details", () => {
});

it("it has correct call details", () => {
//-- navigate to application root
cy.visit("/");

//-- click on HWCR tab
cy.get("#ers-tab").click({ force: true });
cy.get('.comp-loader-overlay').should('exist');
cy.get('.comp-loader-overlay').should('not.exist');
cy.get("#comp-zone-close").click({ force: true }); //clear zone filter so this complaint is in the list view
cy.get('.comp-loader-overlay').should('exist');
cy.get('.comp-loader-overlay').should('not.exist');

//-- check to make sure there are items in the table
cy.get("#comp-table")
.find("tr")
.then(({ length }) => {
expect(length, "rows N").to.be.gt(0);
});

cy.get("#comp-table > tbody > tr > td.comp-small-cell").contains("23-007890").click({ force: true });
cy.navigateToAllegationDetailsScreen("23-007890");

//-- verify the call details block
cy.get("#root > div > div.comp-main-content > div > div:nth-child(4) > div > div > div.comp-padding-right-28.col-md-6 > div:nth-child(1) > p").contains(callDetails.description)
Expand All @@ -96,5 +78,9 @@ describe("COMPENF-37 Display ECR Details", () => {
cy.get("#root > div > div.comp-main-content > div > div:nth-child(4) > div > div > div.comp-padding-left-28.col-md-6 > div:nth-child(7) > span.comp-details-content").contains(callDetails.region)
});

it("it has a map on screen with a marker at the correct location", function () {
cy.navigateToAllegationDetailsScreen("23-006888");
cy.verifyMapMarkerExists();
});

});
37 changes: 10 additions & 27 deletions frontend/cypress/e2e/hwcr-details-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,13 @@ Test to verify that the user is able to click the edit button
on the wildlife contacts details page and see all the inputs
*/
describe("Complaint Edit Page spec - Edit View", () => {
before(function () {
beforeEach(function () {
cy.viewport("macbook-16");
cy.kcLogout().kcLogin();
});

it("Navigate to the Complaint Edit page & check inputs", () => {
cy.visit("/");

//-- click on HWCR tab
cy.get("#hwcr-tab").click({ force: true });

cy.get('.comp-loader-overlay').should('exist');
cy.get('.comp-loader-overlay').should('not.exist');

//-- check to make sure there are items in the table
cy.get("#comp-table")
.find("tr")
.then(({ length }) => {
expect(length, "rows N").to.be.gt(0);
});

cy.get(
"#comp-table > tbody > tr:nth-child(1) td.comp-location-cell.comp-cell"
).click({ force: true });

cy.get('.comp-loader-overlay').should('exist');
cy.get('.comp-loader-overlay').should('not.exist');

cy.window().scrollTo("top");

cy.get("#details-screen-edit-button").click({ force: true });
it("Navigate to the Complaint Edit page & check inputs", function() {
cy.navigateToHWLCEditScreen("23-007023");

// Note: if the layout of this page changes, these selectors that use classes may break
// Check the First Section inputs
Expand Down Expand Up @@ -189,4 +165,11 @@ describe("Complaint Edit Page spec - Edit View", () => {
});
cy.get("#referred-pair-id input").should("exist");
});

it("it has a map on screen with a marker at the correct location", () => {
cy.navigateToHWLCEditScreen("23-007023");

cy.verifyMapMarkerExists();

});
});
Loading

0 comments on commit 6385bb7

Please sign in to comment.