leaflet-environmental-layers icon indicating copy to clipboard operation
leaflet-environmental-layers copied to clipboard

migrate gsheet api to public-google-sheets-parser to fix pfasLayer and spreadsheet utility

Open daemon1024 opened this issue 4 years ago • 20 comments

  • migrate gsheet api to ~~v4~~ public-google-sheets-parser
  • ~~need of API_TOKEN * data reference not based of XML now direct json arrays~~

Fixes #553

daemon1024 avatar Aug 16 '21 17:08 daemon1024

gitpod-io[bot] avatar Aug 16 '21 17:08 gitpod-io[bot]

image working screenshot

daemon1024 avatar Aug 16 '21 17:08 daemon1024

Some things I wanted to note.

  • I am using my personal API_TOKEN for now.
  • I made a spreadsheet copy from the public csv based on the older sheet, since the sheet itself was not available but the csv was at https://docs.google.com/spreadsheets/u/0/d/1cjQ3H_DX-0dhVL5kMEesFEKaoJKLfC2wWAhokMnJxV4/pub?output=csv

daemon1024 avatar Aug 16 '21 17:08 daemon1024

Oof, will need to debug the tests too 👀

daemon1024 avatar Aug 16 '21 17:08 daemon1024

image Fixed the spreadsheet utility as well

daemon1024 avatar Aug 17 '21 14:08 daemon1024

No need of API Token anymore :D and it works too.

We still need the sheet to be public though.

daemon1024 avatar Aug 20 '21 01:08 daemon1024

Will need to debug tests 😓

daemon1024 avatar Aug 20 '21 01:08 daemon1024

Just wondering if it's just not transpiled the right way! the new npm module I added.

daemon1024 avatar Aug 20 '21 10:08 daemon1024

Yes, the error is due to public-google-sheets-parser not being transpiled right. I will have to look into how to configure that in the Gruntfile.

After transpile

ReferenceError: Can't find variable: regeneratorRuntime at dist/LeafletEnvironmentalLayers_babel.js:5432

this is part of public-google-sheets-parser code.

daemon1024 avatar Aug 20 '21 10:08 daemon1024

@jywarren any hints/suggestions for how to proceed with fixing these tests?

daemon1024 avatar Aug 20 '21 11:08 daemon1024

Hmm, looking... could it be related to:

https://github.com/fureweb-com/public-google-sheets-parser/issues/3

jywarren avatar Aug 31 '21 17:08 jywarren

The transpile theory makes sense... Jasmine has trouble with some untranspiled code, i think i remember.

Cypress shouldn't, but the errors there are different anyways:

  1) Loads demo page
       has layers menu control:

      AssertionError: Timed out retrying: Too many elements found. Found '22', expected '21'.

jywarren avatar Aug 31 '21 17:08 jywarren

Yay, that worked! Pointed at my own patch branch. We can repoint if they merge my PR.

image

jywarren avatar Aug 31 '21 18:08 jywarren

Ugh - looks like I solved one issue but the original regeneratorRuntime is still there:


   - leaflet is created......✓
   - baselayer is added by default......X
     TypeError: undefined is not a function (evaluating 'L.LayerGroup.EnvironmentalLayers({
    })') in file:///home/runner/work/leaflet-environmental-layers/leaflet-environmental-layers/spec/javascripts/basicImplementation.spec.js (line 26) (1)
   - include specific layers......X
     TypeError: undefined is not a function (evaluating 'L.LayerGroup.EnvironmentalLayers({
      include: ['eonetFiresLayer', 'Unearthing'],
      display: ['eonetFiresLayer']
    })') in file:///home/runner/work/leaflet-environmental-layers/leaflet-environmental-layers/spec/javascripts/basicImplementation.spec.js (line 33) (1)
   - exclude specific layers......X
     TypeError: undefined is not a function (evaluating 'L.LayerGroup.EnvironmentalLayers({
      exclude: ['eonetFiresLayer']
    })') in file:///home/runner/work/leaflet-environmental-layers/leaflet-environmental-layers/spec/javascripts/basicImplementation.spec.js (line 43) (1)
   - display shows layer......X
     TypeError: undefined is not a function (evaluating 'L.LayerGroup.EnvironmentalLayers({
      display: ['eonetFiresLayer'],
    })') in file:///home/runner/work/leaflet-environmental-layers/leaflet-environmental-layers/spec/javascripts/basicImplementation.spec.js (line 52) (1)
   - addLayersToMap shows all included layers......X
     TypeError: undefined is not a function (evaluating 'L.LayerGroup.EnvironmentalLayers({
      include: ['eonetFiresLayer', 'Unearthing'],
      addLayersToMap: true,
    })') in file:///home/runner/work/leaflet-environmental-layers/leaflet-environmental-layers/spec/javascripts/basicImplementation.spec.js (line 61) (1)
   - simpleLayerControl shows simple menu......X
     TypeError: undefined is not a function (evaluating 'L.LayerGroup.EnvironmentalLayers({
      simpleLayerControl: true,
    })') in file:///home/runner/work/leaflet-environmental-layers/leaflet-environmental-layers/spec/javascripts/basicImplementation.spec.js (line 72) (1)
   - embed shows embed control......X
     TypeError: undefined is not a function (evaluating 'L.LayerGroup.EnvironmentalLayers({
      embed: true,
    })') in file:///home/runner/work/leaflet-environmental-layers/leaflet-environmental-layers/spec/javascripts/basicImplementation.spec.js (line 80) (1)
 embed control properties
   default properties
     - encountered a declaration exception......X
       TypeError: undefined is not a constructor (evaluating 'new L.control.embed()') in file:///home/runner/work/leaflet-environmental-layers/leaflet-environmental-layers/spec/javascripts/embedControl.spec.js (line 8) (1)
   passed in properties

jywarren avatar Aug 31 '21 19:08 jywarren

Does that library by chance use async/await? https://stackoverflow.com/questions/33527653/babel-6-regeneratorruntime-is-not-defined says we need the babel-polyfill library.

jywarren avatar Aug 31 '21 19:08 jywarren

Oh... Hi 👋🏽 I will go through the updates here.

daemon1024 avatar Aug 31 '21 19:08 daemon1024

The failures right now are due to using a combination of Babel 6 ( the new deps ) and Babel 7 ( what we have already )

daemon1024 avatar Aug 31 '21 21:08 daemon1024

The failing cypress tests seems to be due to the new added test spreadsheet layer? Updating the count will do ig 🤔 If that is the case any new test will fail the test ig 👀

daemon1024 avatar Aug 31 '21 21:08 daemon1024

Updated the counts to make some progress. There are still errors related to undefineds, though -- is this ES6 incompatibility with Jasmine again?

Then, i see a bunch related to missing images in the pfas layer test. Running it manually what do you think might be happening here?

  5 failing

  1) Pfas layer
       adds markers on click:
     AssertionError: Timed out retrying: Expected to find element: `.leaflet-marker-pane img`, but never found it.
      at Context.eval (http://localhost:8080/__cypress/tests?p=cypress/integration/pfasLayer.spec.js:17:42)

  2) Pfas layer
       has default markers in default mode:
     AssertionError: Timed out retrying: Expected to find element: `.leaflet-marker-pane img`, but never found it.
      at Context.eval (http://localhost:8080/__cypress/tests?p=cypress/integration/pfasLayer.spec.js:24:8)

  3) Pfas layer
       has circle markers in minimal mode:
     AssertionError: Timed out retrying: Expected to find element: `.leaflet-overlay-pane svg g`, but never found it.
      at Context.eval (http://localhost:8080/__cypress/tests?p=cypress/integration/pfasLayer.spec.js:33:10)

  4) Pfas layer
       shows popup:
     AssertionError: Timed out retrying: Expected to find element: `.leaflet-overlay-pane svg g`, but never found it.
      at Context.eval (http://localhost:8080/__cypress/tests?p=cypress/integration/pfasLayer.spec.js:41:8)

  5) Pfas layer
       removes markers from the map and the layer name from the hash when clicked again:
     AssertionError: Timed out retrying: Expected to find element: `.leaflet-overlay-pane svg g`, but never found it.
      at Context.eval (http://localhost:8080/__cypress/tests?p=cypress/integration/pfasLayer.spec.js:53:8)

jywarren avatar Sep 05 '21 20:09 jywarren

Retriggering tests so we can see the latest logs

jywarren avatar Jun 07 '22 06:06 jywarren