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

CPLAT-15628 Add default timeout to waitForElementToBeRemoved #34

Merged
merged 6 commits into from
Sep 21, 2021

Conversation

brianphillips-wk
Copy link
Contributor

@brianphillips-wk brianphillips-wk commented Sep 17, 2021

Motivation

waitForElementToBeRemoved doesn’t have a default for timeout. Though it calls waitFor (which has a default timeout), it throws its own timeout exception which uses waitFor's duration in the message.

For more info, see this Slack thread.

Changes

  • Add a 1-second default Duration to the timeout parameter

Release Notes

Review

See CONTRIBUTING.md for more details on review types (+1 / QA +1 / +10) and code review process.

QA Checklist

  • Tests were updated and provide good coverage of the changeset and other affected code
  • Manual testing was performed if needed:

Merge Checklist

While we perform many automated checks before auto-merging, some manual checks are needed:

  • A Client Platform member has reviewed these changes
  • There are no unaddressed comments - this check can be automated if reviewers use the "Request Changes" feature
  • For release PRs - Version metadata in Rosie comment is correct

@aviary3-wk
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

Comment on lines 209 to 216
test('an element that is never removed, throws with default timeout value', () async {
expect(
() => rtl.waitForElementToBeRemoved(() => elementThatWontBeRemoved, container: view.container),
throwsA(allOf(
isA<TimeoutException>(),
hasToStringValue(contains('The element returned from the callback was still present in the container after ${asyncQueryTimeout.inMilliseconds}ms:')),
)));
}, timeout: asyncQueryTestTimeout);
Copy link
Contributor Author

@brianphillips-wk brianphillips-wk Sep 20, 2021

Choose a reason for hiding this comment

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

Alrighty folks, this test should do the trick. As @sydneyjodon-wk suggested, I'm testing against an element that is never removed. Fails without the default value set (Cannot read properties of null), passes when default is set 👍

I removed my previous test—looks like the test on line 174 already handles that case.

sydneyjodon-wk
sydneyjodon-wk previously approved these changes Sep 20, 2021
Copy link
Contributor

@sydneyjodon-wk sydneyjodon-wk left a comment

Choose a reason for hiding this comment

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

+10 Looks great!

joebingham-wk
joebingham-wk previously approved these changes Sep 21, 2021
Copy link
Contributor

@joebingham-wk joebingham-wk left a comment

Choose a reason for hiding this comment

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

🔥 🔥 🔥

Copy link
Contributor

@sydneyjodon-wk sydneyjodon-wk left a comment

Choose a reason for hiding this comment

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

+10

  • CI passes - the only failures are just because of formatting on Dart 2.14.2 being different than formatting on Dart 2.13.4

@brianphillips-wk brianphillips-wk merged commit 2ce9dc4 into master Sep 21, 2021
@joebingham-wk joebingham-wk deleted the add_duration_waitForElementToBeRemoved branch September 21, 2021 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants