Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

daemon1024
Copy link
Member

@daemon1024 daemon1024 commented Aug 16, 2021

  • 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

@gitpod-io
Copy link

gitpod-io bot commented Aug 16, 2021

@daemon1024
Copy link
Member Author

image
working screenshot

@daemon1024
Copy link
Member Author

Some things I wanted to note.

@daemon1024 daemon1024 requested a review from jywarren August 16, 2021 17:51
@daemon1024
Copy link
Member Author

Oof, will need to debug the tests too 👀

@daemon1024
Copy link
Member Author

image
Fixed the spreadsheet utility as well

@daemon1024 daemon1024 changed the title fix pfasLayer migrate gsheet api to v4 to fix pfasLayer and spreadsheet utility Aug 17, 2021
* migrate gsheet api to v4
* need of API_TOKEN
* data reference not based of XML now direct json arrays
@daemon1024 daemon1024 changed the title migrate gsheet api to v4 to fix pfasLayer and spreadsheet utility migrate gsheet api to public-google-sheets-parser to fix pfasLayer and spreadsheet utility Aug 20, 2021
@daemon1024
Copy link
Member Author

daemon1024 commented Aug 20, 2021

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

We still need the sheet to be public though.

@daemon1024
Copy link
Member Author

daemon1024 commented Aug 20, 2021

Will need to debug tests 😓

@daemon1024
Copy link
Member Author

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

@daemon1024
Copy link
Member Author

daemon1024 commented Aug 20, 2021

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
Copy link
Member Author

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

@jywarren
Copy link
Member

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

fureweb-com/public-google-sheets-parser#3

src/pfasLayer.js Outdated
@@ -1,156 +1,207 @@
const PublicGoogleSheetsParser = require("public-google-sheets-parser");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we require this instead, as it'll have been babelified and transpiled already?

https://github.com/fureweb-com/public-google-sheets-parser/blob/main/dist/index.js

So... maybe:

Suggested change
const PublicGoogleSheetsParser = require("public-google-sheets-parser");
const PublicGoogleSheetsParser = require("node_modules/public-google-sheets-parser/dist/index.js");

It's worth a try!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, i tried this but there was an issue which I filed a fix for in the upstream library: fureweb-com/public-google-sheets-parser#11

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they don't merge it, we could change our package.json to point at: https://github.com/jywarren/public-google-sheets-parser/tree/patch-1

@jywarren
Copy link
Member

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
Copy link
Member

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

image

@jywarren
Copy link
Member

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
Copy link
Member

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.

@daemon1024
Copy link
Member Author

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

@daemon1024
Copy link
Member Author

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

@daemon1024
Copy link
Member Author

daemon1024 commented Aug 31, 2021

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 👀

@jywarren
Copy link
Member

jywarren commented Sep 5, 2021

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
Copy link
Member

jywarren commented Jun 7, 2022

Retriggering tests so we can see the latest logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Spreadsheet API v3 Deprecation
2 participants