Closed stevenirby closed 4 months ago
Ive given the PR a test-run on a few different accounts:
Results below.
Unread-fix confirmed working. Storage_info() doesn't work though. (Output is all zeros) Tested with English US locale.
Unread-fix confirmed working. Storage_info() doesn't work though. (Output is all zeros) Tested with Norwegian and English UK locale.
Unread-fix partially working. Better than before, but produces console-warnings for all counters not Inbox, and provides 0
as result, even for labels which has unreads.
Storage_info() doesn't work though. (Output is all zeros)
I see storage_info() is implemented using a regexp on text values.
Below are the texts Ive seen for my accounts:
Based on the regexp used, Id say the reason for the failure is assuming "X of Y" format and assuming percentage at the end.
Maybe you can relax the conditions slightly?
@josteink thank you so much for testing!
One big issue is that a lot of data isn't in the DOM until the page is fully loaded. After gmail.observe.on('load', () => {})
is done. I believe the correct fix is to add more watchers to wait until more of the DOM is loaded?
Unread-fix partially working. Better than before, but produces console-warnings for all counters not Inbox, and provides 0 as result, even for labels which has unreads.
Do you think it should return undefined instead? I didn't want to break any scripts out there using this.
Based on the regexp used, Id say the reason for the failure is assuming "X of Y" format and assuming percentage at the end. Maybe you can relax the conditions slightly?
Will do.
What might help make things easier for you is to separate data-fetching from data-processing into 2 different functions.
That way you can unit-test the processing and just add my real world examples above as test-cases.
That may sound complicated at first, but I think it will help you solve this faster and better.
This fixes two of the methods
api.helper.get.navigation_count
andapi.get.storage_info
. It returns a fair amount of data back:I'm trying to target the aria labels and accessibility tags, as I think it's a better move to try to parse the page like https://testing-library.com/ library does testing. Looking at the page like a real user or a screen reader would, rather than targeting class names or such, which is a cat-and-mouse game.
I'm also doing console.warns when things aren't found for easier debugging. Throwing an error or console.error seemed a bit too much.
I'm totally open to any advice or feedback!