concord-consortium / codap

CODAP (Common Online Data Analysis Platform)
MIT License
94 stars 38 forks source link

fix: handling of fetch errors when loading plugin config #1388

Closed kswenson closed 1 month ago

kswenson commented 1 month ago

While testing v3 with a spotty/nonexistent internet connection recently it became apparent that we weren't handling errors that occurred when loading the default plugins configuration using fetch correctly. This came to our attention recently as a source of flaky cypress tests as well. My first approach was a fairly small change to the PluginsButton code to improve handling of fetch errors. This wasn't easy to write a jest test for, however, so I split out the fetching code to a new useStandardPlugins() custom hook and wrote a jest test for that. To test various possible fetch responses I installed jest-fetch-mock (also used by CLUE). Then for good measure, I wrote a jest test for the PluginsButton component as well.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.76%. Comparing base (181b8da) to head (7a268f2). Report is 32 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1388 +/- ## ========================================== + Coverage 85.71% 85.76% +0.04% ========================================== Files 522 525 +3 Lines 25582 25710 +128 Branches 6966 6998 +32 ========================================== + Hits 21927 22049 +122 - Misses 3380 3506 +126 + Partials 275 155 -120 ``` | [Flag](https://app.codecov.io/gh/concord-consortium/codap/pull/1388/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=concord-consortium) | Coverage Δ | | |---|---|---| | [cypress](https://app.codecov.io/gh/concord-consortium/codap/pull/1388/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=concord-consortium) | `72.71% <90.47%> (+0.17%)` | :arrow_up: | | [jest](https://app.codecov.io/gh/concord-consortium/codap/pull/1388/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=concord-consortium) | `53.48% <100.00%> (-0.08%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=concord-consortium#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

cypress[bot] commented 1 month ago



Test summary

200 0 29 0Flakiness 2


Run details

Project codap-v3
Status Passed
Commit 069eb2c91d
Started Aug 8, 2024 9:09 PM
Ended Aug 8, 2024 9:18 PM
Duration 09:07 💡
OS Linux Ubuntu -
Browser Chrome 127

View run in Cypress Cloud ➡️


Flakiness

cypress/e2e/toolbar.spec.ts Flakiness
1 codap toolbar > will open a slider
2 codap toolbar > will display a webpage

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Cloud