-
Notifications
You must be signed in to change notification settings - Fork 93
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
updated tests and added coverage for edit feature #608
Conversation
✅ Deploy Preview for mozilla-perfcompare ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
650de0c
to
558bde6
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## beta #608 +/- ##
==========================================
+ Coverage 93.67% 97.87% +4.20%
==========================================
Files 64 64
Lines 1422 1410 -12
Branches 223 219 -4
==========================================
+ Hits 1332 1380 +48
+ Misses 88 28 -60
Partials 2 2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this work!
As far as I understand the PR contains 3 different topics:
- The edit mode tests
- the result of
npm audit fix
- the change of style of ExpandableRow
- (and also some change I don't understand in CompareWithBase, so I'm not sure where this goes)
Therefore before moving further, it would be good to make this PR only about the edit mode tests, so that we're not confused about all the other changes. I haven't reviewed the other topics anyway, so please remove them away from this PR and create separate PR for these. I'll gladly review them separately.
Now let's go for the meat of this issue!
I think the tests work well and bring some more coverage, especially around clicking inside the dropdown, so that's great.
I left a few easy comments that go basically into 3 buckets:
- make the file easier to work with (about setting the fetch mocks especially, or not doing twice the same tests)
- have fetch mocks for everything (see warnings in the console)
- bring some more coverage to our code (uncheck the elements in the dropdown instead of using the cross)
Happy to discuss :)
@@ -272,6 +254,7 @@ function CompareWithBase({ | |||
action='/compare-results' | |||
className='form-wrapper' | |||
onSubmit={possiblyPreventFormSubmission} | |||
role='form' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not needed, a <form>
already has the implicit role form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, true. But the test kept outputting an error, saying it can't findByRole('form')
. That's why I added it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, indeed I found this old issue with some more explanations: testing-library/dom-testing-library#1021
In short a <form>
is not exposed with the role form
implicitely if it doesn't have an accessible name. But this seems to have changed since then, so I filed this new one: testing-library/dom-testing-library#1293
Hopefully this issue will be fixed in the future then. In the mean time I think your change is valid.
Now I wonder if we could add an aria-label instead of a role. Surely this makes some sense, especially when we'll have both "Compare with base" and "Compare over time" in the future. Labeling the form could help a screen reader user to know which form they're focusing in, and I also believe the screen readers have functionality to list all forms and focus them.
Therefore I would suggest to add a aria-label
(maybe aria-label="Compare with base"
is good enough) instead of a role
. What do you think?
43d42e6
to
e3ef454
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me, good work!
I'd like just 2 small last changes before merging :-) Then with these changes you can merge directly without an extra review.
@@ -272,6 +254,7 @@ function CompareWithBase({ | |||
action='/compare-results' | |||
className='form-wrapper' | |||
onSubmit={possiblyPreventFormSubmission} | |||
role='form' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, indeed I found this old issue with some more explanations: testing-library/dom-testing-library#1021
In short a <form>
is not exposed with the role form
implicitely if it doesn't have an accessible name. But this seems to have changed since then, so I filed this new one: testing-library/dom-testing-library#1293
Hopefully this issue will be fixed in the future then. In the mean time I think your change is valid.
Now I wonder if we could add an aria-label instead of a role. Surely this makes some sense, especially when we'll have both "Compare with base" and "Compare over time" in the future. Labeling the form could help a screen reader user to know which form they're focusing in, and I also believe the screen readers have functionality to list all forms and focus them.
Therefore I would suggest to add a aria-label
(maybe aria-label="Compare with base"
is good enough) instead of a role
. What do you think?
(window.fetch as FetchMockSandbox) | ||
.get('begin:https://treeherder.mozilla.org/api/perfcompare/results/', []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: you can chain with the previous definitions:
global.fetch.get(
...
)
.get(
...
)
.get(
...
);
@julienw This seems like a good solution to me, esp since I'm working on the |
972fbf7
to
cdde0d1
Compare
This PR resolves the following issues: