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

Add safe send_keys methods to FunctionalTest. Stop implicit wait. #4546

Merged
merged 1 commit into from
Jun 26, 2019

Conversation

rmol
Copy link
Contributor

@rmol rmol commented Jun 21, 2019

Status

Ready for review

Description of Changes

Add methods to more reliably send key events to elements. This seems
to have fixed one of the most pernicious flaky tests,
test_journalist_interface_ui_with_modal, allowing removal of the
hideous retry hack that could make the tests take minutes longer.

Use them to replace other usages of send_keys, including some that
have definitely been flaky, though not as bad as that one.

Also simplify the safe_click* methods, as WebDriverWait.until returns
the result of the wait condition, and some of the other element
manipulations were unnecessary, given the expected conditions.

Stop setting a default implicit wait in the web drivers. If an element
might not be present, we should use explicit waits instead of adding
this potential delay to every element-locating call. There's also
ample Selenium folklore that mixing implicit and explicit waits leads
to unpredictable timeouts and possible bad behavior.

Rename _alert_wait and _alert_accept.

Double the timeout in alert_wait. This helped with some timeouts
waiting for confirmation popups.

Fixes #4541.

Testing

Run make -C securedrop test. Or just wait for the CI results here.

Deployment

This only involves the functional tests.

Checklist

If you made changes to the server application code:

  • Linting (make lint) and tests (make -C securedrop test) pass in the development container

If you made non-trivial code changes:

  • I have written a test plan and validated it for this PR

Add methods to more reliably send key events to elements. This seems
to have fixed one of the most pernicious flaky tests,
test_journalist_interface_ui_with_modal, allowing removal of the
hideous retry hack that could make the tests take minutes longer.

Use them to replace other usages of send_keys, including some that
have definitely been flaky, though not as bad as that one.

Also simplify the safe_click* methods, as WebDriverWait.until returns
the result of the wait condition, and some of the other element
manipulations were unnecessary, given the expected conditions.

Stop setting a default implicit wait in the web drivers. If an element
might not be present, we should use explicit waits instead of adding
this potential delay to every element-locating call. There's also
ample Selenium folklore that mixing implicit and explicit waits leads
to unpredictable timeouts and possible bad behavior.

Rename _alert_wait and _alert_accept.

Double the timeout in alert_wait. This helped with some timeouts
waiting for confirmation popups.
Copy link
Contributor

@zenmonkeykstop zenmonkeykstop left a comment

Choose a reason for hiding this comment

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

Functional tests are passing locally for me with no issues apart from existing infrequent HOTP and TOTP flakes.
LGTM!

@zenmonkeykstop zenmonkeykstop merged commit 82d4cd2 into freedomofpress:develop Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

investigate/fix test flake: confirmation popup timeout in functional tests
3 participants