diff --git a/cypress/fixtures/pfasLayer.json b/cypress/fixtures/pfasLayer.json new file mode 100644 index 000000000..d2c695dbf --- /dev/null +++ b/cypress/fixtures/pfasLayer.json @@ -0,0 +1,342 @@ +{ + "feed": { + "entry": [ + { + "id": { + "$t": "https://spreadsheets.google.com/feeds/list/1cjQ3H_DX-0dhVL5kMEesFEKaoJKLfC2wWAhokMnJxV4/1/public/values/cokwr" + }, + "updated": { + "$t": "2020-02-24T19:07:10.382Z" + }, + "category": [ + { + "scheme": "http://schemas.google.com/spreadsheets/2006", + "term": "http://schemas.google.com/spreadsheets/2006#list" + } + ], + "title": { + "type": "text", + "$t": "Geographic location of contamination/ DOD site name / entity sampled " + }, + "content": { + "type": "text", + "$t": "location: Town/City, County, State, pfoapfos: Affected water body/source (groundwater/drinking water/surface water):\n-PFOA: detection level in ppt (date sampled/reported)\n-PFOS: detection level in ppt (date sampled/reported)" + }, + "link": [ + { + "rel": "self", + "type": "application/atom+xml", + "href": "https://spreadsheets.google.com/feeds/list/1cjQ3H_DX-0dhVL5kMEesFEKaoJKLfC2wWAhokMnJxV4/1/public/values/cokwr" + } + ], + "gsx$contaminationsite": { + "$t": "Geographic location of contamination/ DOD site name / entity sampled " + }, + "gsx$state": { + "$t": "" + }, + "gsx$location": { + "$t": "Town/City, County, State" + }, + "gsx$latitude": { + "$t": "" + }, + "gsx$longitude": { + "$t": "" + }, + "gsx$natureofsources": { + "$t": "" + }, + "gsx$litigationyesno": { + "$t": "" + }, + "gsx$pfoapfos": { + "$t": "Affected water body/source (groundwater/drinking water/surface water):\n-PFOA: detection level in ppt (date sampled/reported)\n-PFOS: detection level in ppt (date sampled/reported)" + }, + "gsx$otherpfas": { + "$t": "" + }, + "gsx$dateofdiscovery": { + "$t": "" + }, + "gsx$suspectedcontaminationsource": { + "$t": "" + }, + "gsx$suspectedsourceurl": { + "$t": "" + }, + "gsx$notes": { + "$t": "" + }, + "gsx$date": { + "$t": "" + }, + "gsx$reggovresponse": { + "$t": "" + }, + "gsx$litigationdetails": { + "$t": "" + }, + "gsx$notes1": { + "$t": "" + }, + "gsx$communityresponse": { + "$t": "" + }, + "gsx$lastupdated": { + "$t": "" + }, + "gsx$url1": { + "$t": "" + }, + "gsx$url2": { + "$t": "" + }, + "gsx$url3": { + "$t": "" + }, + "gsx$url4": { + "$t": "" + }, + "gsx$url5": { + "$t": "" + } + }, + { + "id": { + "$t": "https://spreadsheets.google.com/feeds/list/1cjQ3H_DX-0dhVL5kMEesFEKaoJKLfC2wWAhokMnJxV4/1/public/values/cpzh4" + }, + "updated": { + "$t": "2020-02-24T19:07:10.382Z" + }, + "category": [ + { + "scheme": "http://schemas.google.com/spreadsheets/2006", + "term": "http://schemas.google.com/spreadsheets/2006#list" + } + ], + "title": { + "type": "text", + "$t": "Naval Arctic Research Lab Barrow - Naval Base Kitsap " + }, + "content": { + "type": "text", + "$t": "state: Alaska, location: Utqiaġvik, Alaska, latitude: 71.2905556, longitude: -156.7886110, natureofsources: Military-Naval Base, pfoapfos: Combined PFOS/PFOA = 144-262 ppt, otherpfas: N/A, dateofdiscovery: 2017, suspectedcontaminationsource: Firefighting foam used at Naval Arctic Research Lab Barrow - Naval Base Kitsap\n, suspectedsourceurl: https://partner-mco-archive.s3.amazonaws.com/client_files/1524589484.pdf, notes: All 5 surface water samples detected above the LHA\n\n, date: 2018, reggovresponse: Surface water (Imikpuk Lake) sampled; serves as intermittent water source for hunters and village elders. Investigation underway., litigationdetails: No Data, notes1: No Data" + }, + "link": [ + { + "rel": "self", + "type": "application/atom+xml", + "href": "https://spreadsheets.google.com/feeds/list/1cjQ3H_DX-0dhVL5kMEesFEKaoJKLfC2wWAhokMnJxV4/1/public/values/cpzh4" + } + ], + "gsx$contaminationsite": { + "$t": "Naval Arctic Research Lab Barrow - Naval Base Kitsap " + }, + "gsx$state": { + "$t": "Alaska" + }, + "gsx$location": { + "$t": "Utqiaġvik, Alaska" + }, + "gsx$latitude": { + "$t": "71.2905556" + }, + "gsx$longitude": { + "$t": "-156.7886110" + }, + "gsx$natureofsources": { + "$t": "Military-Naval Base" + }, + "gsx$litigationyesno": { + "$t": "" + }, + "gsx$pfoapfos": { + "$t": "Combined PFOS/PFOA = 144-262 ppt" + }, + "gsx$otherpfas": { + "$t": "N/A" + }, + "gsx$dateofdiscovery": { + "$t": "2017" + }, + "gsx$suspectedcontaminationsource": { + "$t": "Firefighting foam used at Naval Arctic Research Lab Barrow - Naval Base Kitsap\n" + }, + "gsx$suspectedsourceurl": { + "$t": "https://partner-mco-archive.s3.amazonaws.com/client_files/1524589484.pdf" + }, + "gsx$notes": { + "$t": "All 5 surface water samples detected above the LHA\n\n" + }, + "gsx$date": { + "$t": "2018" + }, + "gsx$reggovresponse": { + "$t": "Surface water (Imikpuk Lake) sampled; serves as intermittent water source for hunters and village elders. Investigation underway." + }, + "gsx$litigationdetails": { + "$t": "No Data" + }, + "gsx$notes1": { + "$t": "No Data" + }, + "gsx$communityresponse": { + "$t": "" + }, + "gsx$lastupdated": { + "$t": "" + }, + "gsx$url1": { + "$t": "" + }, + "gsx$url2": { + "$t": "" + }, + "gsx$url3": { + "$t": "" + }, + "gsx$url4": { + "$t": "" + }, + "gsx$url5": { + "$t": "" + } + }, + { + "id": { + "$t": "https://spreadsheets.google.com/feeds/list/1cjQ3H_DX-0dhVL5kMEesFEKaoJKLfC2wWAhokMnJxV4/1/public/values/cre1l" + }, + "updated": { + "$t": "2020-02-25T07:26:29.776Z" + }, + "category": [ + { + "scheme": "http://schemas.google.com/spreadsheets/2006", + "term": "http://schemas.google.com/spreadsheets/2006#list" + } + ], + "title": { + "type": "text", + "$t": "Decatur" + }, + "content": { + "type": "text", + "$t": "state: Alabama, location: Decatur, Alabama, latitude: 34.6059253, longitude: -86.9833417, natureofsources: Industry / Manufacturing, litigationyesno: 1, pfoapfos: WMEL Water and Sewer Authority (municipal drinking water)\r\n-PFOA: avg of 65 ppt (2014 UCMR3)\r\n-PFOS: avg of 50 ppt (2014 UCMR3)\r\n\r\nWheeler Lake (surface water & sediment)\r\n-[surface] Total PFAS: 33-754 ppt (July 2017)\r\n-[sediment] Total PFAS: 222-47,000 ppt (July 2017)\r\n, otherpfas: N/A, dateofdiscovery: 2008, suspectedcontaminationsource: 3M manufacturing facility in Decatur, suspectedsourceurl: https://theintercept.com/2016/04/11/lawsuits-charge-that-3m-knew-about-the-dangers-of-pfcs/, notes: Most of the county's 33,000 residents rely on bottled water, but only those that can afford it or recieve donations. The WMEL water authority installed a GAC filtration system, but it's not a permanent fix. A reverse osmosis system is needed long-term. WMEL planned to pay for the $25 million system with settlement money from its lawsuits against 3M and Daikin, but Daikin recently settled for only $4 million, and the 3M suit is still in court., date: 2008, reggovresponse: The State of Alabama has a loose agreement with 3M to try to remediate PFAS chemicals at the Decatur plant. No state limit exists for how much of PFASs 3M can discharge into the Tennessee River. EPA issued a health advisory for the WMEL customers in May 2016 after detecting high levels of PFOA & PFOS in the drinking water.\nWMEL warned customers to use bottled water and borrowed $4 million to pay for a carbon filtration system to filter out the chemicals.\nWMEL officials say they need a reverse osmosis filtration system for permanent safe water. It was estimated to cost about $25 million to install, but WMEL officials now say it will be much higher., litigationdetails: Multiple lawsuits filed against 3M Co., Dyneon LLC, and Daikin America, LLC. Daikin initially settles for $4M for carbon filtration and to residents, but decision was reversed in appellate court., notes1: Lawrence county residents have reported high rates of cancer and other health problems: \"There's more sick people then there are healthy people,\" says Beth McCarley... \"I wouldn't put my toe in it now,\" she said. \"It might rot off. I don't know.\" ... \"I think over half the people is dying from some kind of cancer,\" says Annie Hughes... \"Two or three funerals a week,\" said Darrius Bell. \"You know, four or five a month. That's kind of unusual.\" (quotes from article by WHNT News/Tribune Broadcasting), url1: http://www.aces.edu/pubs/docs/A/ANR-2326/ANR-2326.pdf https://nyenvirolaw.org/lawrence-county-al-pfoas/ , url2: http://keepyourpromisesdupont.com/ , url3: http://www.decaturdaily.com/news/local/wheeler-reservoir-included-in-fish-advisory/article_1b5b60f6-2774-530a-9489-4f8184f7ba50.html, url4: http://www.decaturdaily.com/news/local/court-blocks-million-daikin-settlement-on-water-pollution/article_05a10319-2fe0-5d79-ae66-abce535cc1fc.html, url5: http://www.decaturdaily.com/news/local/federal-report-focuses-on-toxicity-of-decatur-area-chemicals/article_c3e0b12a-0f12-5d48-932b-1a3e8b1c061b.html, _dkvya: http://www.decaturdaily.com/news/local/west-morgan-east-lawrence-water-board-to-consider-m-for/article_2f1bb3f2-d43f-506b-892d-4e3463d8dc30.html, _dmair: http://www.decaturdaily.com/news/local/authority-prepares-to-borrow-m-to-remove-toxins-from-drinking/article_105b67f7-56b1-5a2d-9989-9c4bb552d4dd.html, _dnp34: http://www.decaturdaily.com/news/local/sims-pitches-reverse-osmosis-for-drinking-water-but-board-delays/article_8599ac89-80ce-5ee0-a3b9-df83a44b6ce2.html, _dp3nl: https://www.decaturdaily.com/news/morgan_county/decatur/lawsuit-m-knew-chemicals-were-toxic/article_8a64d460-d353-5dac-a71b-5b5cca11f2e7.html, _df9om: https://whnt.com/2018/09/24/residents-concerned-about-drinking-water-quality-feel-abandoned-by-state-of-alabama/, _dgo93: https://whnt.com/2018/09/25/governor-remains-silent-on-lawrence-co-water-quality-issue-ags-office-working-to-get-answers/, _di2tg: https://whnt.com/2018/10/09/democratic-ag-candidate-vows-to-take-action-on-lawrence-county-water-issue-ag-remains-silent/, _djhdx: https://whnt.com/2018/10/16/west-morgan-east-lawrence-water-authority-asking-governor-ivey-ag-steve-marshall-for-help-suing-3m-over-drinking-water/, _dw4je: https://whnt.com/2018/10/18/alabama-ags-office-pledges-to-meet-with-west-morgan-east-lawrence-water-authority-on-drinking-water-lawsuit/, _dxj3v: https://www.decaturdaily.com/news/lawrence_county/sen-jones-hears-local-tainted-water-concerns/article_ec731613-312c-550b-accc-b8596452887b.html, _dyxo8: https://www.ewg.org/tapwater/system.php?pws=AL0001092" + }, + "link": [ + { + "rel": "self", + "type": "application/atom+xml", + "href": "https://spreadsheets.google.com/feeds/list/1cjQ3H_DX-0dhVL5kMEesFEKaoJKLfC2wWAhokMnJxV4/1/public/values/cre1l" + } + ], + "gsx$contaminationsite": { + "$t": "Decatur" + }, + "gsx$state": { + "$t": "Alabama" + }, + "gsx$location": { + "$t": "Decatur, Alabama" + }, + "gsx$latitude": { + "$t": "34.6059253" + }, + "gsx$longitude": { + "$t": "-86.9833417" + }, + "gsx$natureofsources": { + "$t": "Industry / Manufacturing" + }, + "gsx$litigationyesno": { + "$t": "1" + }, + "gsx$pfoapfos": { + "$t": "WMEL Water and Sewer Authority (municipal drinking water)\r\n-PFOA: avg of 65 ppt (2014 UCMR3)\r\n-PFOS: avg of 50 ppt (2014 UCMR3)\r\n\r\nWheeler Lake (surface water & sediment)\r\n-[surface] Total PFAS: 33-754 ppt (July 2017)\r\n-[sediment] Total PFAS: 222-47,000 ppt (July 2017)\r\n" + }, + "gsx$otherpfas": { + "$t": "N/A" + }, + "gsx$dateofdiscovery": { + "$t": "2008" + }, + "gsx$suspectedcontaminationsource": { + "$t": "3M manufacturing facility in Decatur" + }, + "gsx$suspectedsourceurl": { + "$t": "https://theintercept.com/2016/04/11/lawsuits-charge-that-3m-knew-about-the-dangers-of-pfcs/" + }, + "gsx$notes": { + "$t": "Most of the county's 33,000 residents rely on bottled water, but only those that can afford it or recieve donations. The WMEL water authority installed a GAC filtration system, but it's not a permanent fix. A reverse osmosis system is needed long-term. WMEL planned to pay for the $25 million system with settlement money from its lawsuits against 3M and Daikin, but Daikin recently settled for only $4 million, and the 3M suit is still in court." + }, + "gsx$date": { + "$t": "2008" + }, + "gsx$reggovresponse": { + "$t": "The State of Alabama has a loose agreement with 3M to try to remediate PFAS chemicals at the Decatur plant. No state limit exists for how much of PFASs 3M can discharge into the Tennessee River. EPA issued a health advisory for the WMEL customers in May 2016 after detecting high levels of PFOA & PFOS in the drinking water.\nWMEL warned customers to use bottled water and borrowed $4 million to pay for a carbon filtration system to filter out the chemicals.\nWMEL officials say they need a reverse osmosis filtration system for permanent safe water. It was estimated to cost about $25 million to install, but WMEL officials now say it will be much higher." + }, + "gsx$litigationdetails": { + "$t": "Multiple lawsuits filed against 3M Co., Dyneon LLC, and Daikin America, LLC. Daikin initially settles for $4M for carbon filtration and to residents, but decision was reversed in appellate court." + }, + "gsx$notes1": { + "$t": "Lawrence county residents have reported high rates of cancer and other health problems: \"There's more sick people then there are healthy people,\" says Beth McCarley... \"I wouldn't put my toe in it now,\" she said. \"It might rot off. I don't know.\" ... \"I think over half the people is dying from some kind of cancer,\" says Annie Hughes... \"Two or three funerals a week,\" said Darrius Bell. \"You know, four or five a month. That's kind of unusual.\" (quotes from article by WHNT News/Tribune Broadcasting)" + }, + "gsx$communityresponse": { + "$t": "" + }, + "gsx$lastupdated": { + "$t": "" + }, + "gsx$url1": { + "$t": "http://www.aces.edu/pubs/docs/A/ANR-2326/ANR-2326.pdf https://nyenvirolaw.org/lawrence-county-al-pfoas/ " + }, + "gsx$url2": { + "$t": "http://keepyourpromisesdupont.com/ " + }, + "gsx$url3": { + "$t": "http://www.decaturdaily.com/news/local/wheeler-reservoir-included-in-fish-advisory/article_1b5b60f6-2774-530a-9489-4f8184f7ba50.html" + }, + "gsx$url4": { + "$t": "http://www.decaturdaily.com/news/local/court-blocks-million-daikin-settlement-on-water-pollution/article_05a10319-2fe0-5d79-ae66-abce535cc1fc.html" + }, + "gsx$url5": { + "$t": "http://www.decaturdaily.com/news/local/federal-report-focuses-on-toxicity-of-decatur-area-chemicals/article_c3e0b12a-0f12-5d48-932b-1a3e8b1c061b.html" + }, + "gsx$_dkvya": { + "$t": "http://www.decaturdaily.com/news/local/west-morgan-east-lawrence-water-board-to-consider-m-for/article_2f1bb3f2-d43f-506b-892d-4e3463d8dc30.html" + }, + "gsx$_dmair": { + "$t": "http://www.decaturdaily.com/news/local/authority-prepares-to-borrow-m-to-remove-toxins-from-drinking/article_105b67f7-56b1-5a2d-9989-9c4bb552d4dd.html" + }, + "gsx$_dnp34": { + "$t": "http://www.decaturdaily.com/news/local/sims-pitches-reverse-osmosis-for-drinking-water-but-board-delays/article_8599ac89-80ce-5ee0-a3b9-df83a44b6ce2.html" + }, + "gsx$_dp3nl": { + "$t": "https://www.decaturdaily.com/news/morgan_county/decatur/lawsuit-m-knew-chemicals-were-toxic/article_8a64d460-d353-5dac-a71b-5b5cca11f2e7.html" + }, + "gsx$_df9om": { + "$t": "https://whnt.com/2018/09/24/residents-concerned-about-drinking-water-quality-feel-abandoned-by-state-of-alabama/" + }, + "gsx$_dgo93": { + "$t": "https://whnt.com/2018/09/25/governor-remains-silent-on-lawrence-co-water-quality-issue-ags-office-working-to-get-answers/" + }, + "gsx$_di2tg": { + "$t": "https://whnt.com/2018/10/09/democratic-ag-candidate-vows-to-take-action-on-lawrence-county-water-issue-ag-remains-silent/" + }, + "gsx$_djhdx": { + "$t": "https://whnt.com/2018/10/16/west-morgan-east-lawrence-water-authority-asking-governor-ivey-ag-steve-marshall-for-help-suing-3m-over-drinking-water/" + }, + "gsx$_dw4je": { + "$t": "https://whnt.com/2018/10/18/alabama-ags-office-pledges-to-meet-with-west-morgan-east-lawrence-water-authority-on-drinking-water-lawsuit/" + }, + "gsx$_dxj3v": { + "$t": "https://www.decaturdaily.com/news/lawrence_county/sen-jones-hears-local-tainted-water-concerns/article_ec731613-312c-550b-accc-b8596452887b.html" + }, + "gsx$_dyxo8": { + "$t": "https://www.ewg.org/tapwater/system.php?pws=AL0001092" + } + } + ] + } +} \ No newline at end of file diff --git a/cypress/integration/pfasLayer.spec.js b/cypress/integration/pfasLayer.spec.js new file mode 100644 index 000000000..2f2a931a7 --- /dev/null +++ b/cypress/integration/pfasLayer.spec.js @@ -0,0 +1,52 @@ +describe('Pfas layer', function() { + it('adds markers on click', function() { + cy.openWindow('/example/index.html#lat=43.000&lon=-92.000&zoom=5&layers=Standard') + cy.wait(300) + cy.window().then((win) => { + cy.fixture('pfasLayer').then((data) => { + cy.stub(win.PFASTracker, 'requestData', function() { + win.PFASTracker.parseData(data.feed.entry); + }) + }) + + cy.get('#menu-pfaslayer label').click({ force: true }) + cy.get('.leaflet-marker-pane img').should('have.length', 2) + }) + }) + + it('should have the layer name added to the hash', function() { + cy.hash().should('eq', '#lat=43.000&lon=-92.000&zoom=5&layers=Standard,pfasLayer') + }) + + it('has default markers in default mode', function() { + cy.get('.leaflet-marker-pane img').invoke('attr', 'src').should('eq', 'https://openclipart.org/image/300px/svg_to_png/117253/1297044906.png') + cy.get('.leaflet-marker-pane img[src="https://openclipart.org/image/300px/svg_to_png/117253/1297044906.png"]').should('have.length', 2) + }) + + it('has circle markers in minimal mode', function() { + cy.server() + cy.route('GET', 'https://spreadsheets.google.com/feeds/list/1cjQ3H_DX-0dhVL5kMEesFEKaoJKLfC2wWAhokMnJxV4/1/public/values?alt=json', 'fixture:pfasLayer.json') + const spy = cy.spy(window.top.aut.PFASTracker, 'requestData') + cy.get('[title="Show minimal markers"]').click().then(() => { + expect(spy).to.be.called + cy.get('.leaflet-overlay-pane svg g').children().should('have.length', 2) + cy.get('.leaflet-overlay-pane svg g path').invoke('attr', 'stroke').should('eq', '#7c7c7c') + cy.get('.leaflet-overlay-pane svg g path').invoke('attr', 'fill').should('eq', '#b52822') + cy.get('.leaflet-overlay-pane svg g path').invoke('attr', 'stroke-linecap').should('eq', 'round') + cy.get('.leaflet-overlay-pane svg g path').invoke('attr', 'stroke-linecap').should('eq', 'round') + }) + }) + + it('shows popup', function() { + cy.get('.leaflet-overlay-pane svg g').children().last().click({ force: true }) + cy.get('.leaflet-popup-pane').children().should('have.length', 1) + cy.get('.leaflet-popup-content').should('contain', 'Decatur') + }) + + it('removes markers from the map and the layer name from the hash when clicked again', function() { + cy.get('#menu-pfaslayer label').click({ force: true }) + cy.hash().should('eq', '#lat=43.000&lon=-92.000&zoom=5&layers=Standard') + cy.get('.leaflet-marker-pane img').should('have.length', 0) + cy.get('.leaflet-overlay-pane svg g').children().should('have.length', 0) + }) +})