-
Notifications
You must be signed in to change notification settings - Fork 355
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
Add queryElements test helper, remove t.plan #1343
Conversation
4e82cd4
to
87954aa
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.
Do we want to add a lint check to make sure t.plan()
and findElements()
aren't accidentally added in the future?
Edit: or, maybe not lint against t.plan()
; there may be cases where it's still useful.
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 think a lint check would be good. We also need to update our documentation in the wiki for this change.
I added a lint check in c16088f -- there were still 12 uses (not counting the one in
|
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've addressed my own comments. :-)
Documentation in the wiki should be updated. I don't want to do this now since my changes haven't been reviewed and I don't want the documentation to be out of sync with what's in
|
@smhigley, could you please look at Simon's changes? It would be good to have a review of the entire PR from @sh0ji or @spectranaut as well. Given the number of files touched, I'd like to get this merged as soon as we can. |
8ea952a
to
e6a221e
Compare
@@ -5,6 +5,10 @@ | |||
}, | |||
"rules": { | |||
"no-unused-vars": 0, | |||
"no-undef": 0 | |||
"no-undef": 0, | |||
"no-restricted-properties": [2, { |
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.
Should plan
be added if you're trying to discourage it too?
test/index.js
Outdated
@@ -1,3 +1,5 @@ | |||
/* eslint no-restricted-properties: 0 */ |
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.
Might makes sense to use a single line ignore instead of a file level one
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.
Looks like it can be re-enabled now
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.
This looks great! but I don't think we can merge until this issue Simon brought up is resolved.
Simon said:
I added a lint check in c16088f -- there were still 12 uses (not counting the one in
queryElement.js
). Do you think those should be changed to usequeryElements
?
These would take more work to replace, because some of them make sure we get zero results from the query (which would cause a failure). I think our options are to (1) allow findElements in linter because of this case or (2) add a helper function for this particular scenario, and otherwise use queryElements. Preferences, @zcorpan or @smhigley ?
I left those 12 in there intentionally because they dealt with testing the number returned, rather than just assuming within the test that there would be a non-empty array. I think that could still be a valid use case for What if we add a lint rule for |
I considered linting For the cases where |
What is the best approach to arriving at a decision for how to resolve the remaining issue here? The technical aspect of this discussion is beyond my expertise. One thing I hope we optimize for is clarity of code, especially for new comers to test writing. |
I like @zcorpan's suggestion of |
e6a221e
to
d614c2f
Compare
I rebased and removed all the remaining uses of @spectranaut / @zcorpan / @nschonni, how do you feel about the PR after those changes? |
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.
A few minor indenting things, maybe need to run eslint fix for.
Didn't go through them all, but might want to check that the /* eslint no-restricted-properties: 0 */
lines still make sense
test/index.js
Outdated
@@ -1,3 +1,5 @@ | |||
/* eslint no-restricted-properties: 0 */ |
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.
Looks like it can be re-enabled now
test/tests/checkbox_checkbox-2.js
Outdated
@@ -1,10 +1,13 @@ | |||
/* eslint no-restricted-properties: 0 */ |
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.
Think this can be re-enabled again
@nschonni I removed the now-unnecessary |
@smhigley don't worry about it then :) |
@spectranaut are you ok with the PR now/do you have any outstanding concerns? |
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.
Reviewing on behalf of @spectranaut :)
LGTM. This now has conflicts though.
(I didn't get to resolving conflicts today.) |
@zcorpan conflicts resolved :) |
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.
Looks good, but a test in CI failed.
not ok 629 - NoSuchSessionError: Tried to run command without establishing a connection
Maybe this was a flaky failure? If so, we can try rerunning CI. (Done by closing and reopening.)
Infrastructure: Add queryElements test helper, remove t.plan from regression tests (pull #1343) Resolves issue #1312 with changes that: * add queryElements helper * update findElements to queryElements in tests, remove unused imports * update missing awaits * Add a lint check for findElements and exclude current uses * Document `t` argument, unconditionally return `result` * add assertNoElements test helper * removed unnecessary eslit no-restricted-props * update carousel tests to use queryElements Co-authored-by: Simon Pieters <zcorpan@gmail.com> Co-authored-by: Matt King <a11yThinker@Gmail.com>
…ression tests (pull #1343) Resolves issue #1312 with changes that: * add queryElements helper * update findElements to queryElements in tests, remove unused imports * update missing awaits * Add a lint check for findElements and exclude current uses * Document `t` argument, unconditionally return `result` * add assertNoElements test helper * removed unnecessary eslit no-restricted-props * update carousel tests to use queryElements Co-authored-by: Simon Pieters <zcorpan@gmail.com> Co-authored-by: Matt King <a11yThinker@Gmail.com>
Resolves #1312
Adds
t.context.queryElements
helper function that wrapst.context.session.findElements
, and fails the test if no elements are found.Removes
t.plan()
, now that it isn't needed to ensure that tests are run.Removes some unrelated unused imports caught while updating the above.