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 missing waits and asserts in acceptance tests #25975

Merged
merged 9 commits into from
Mar 8, 2021

Conversation

danxuliu
Copy link
Member

@danxuliu danxuliu commented Mar 6, 2021

This pull request should make some acceptance tests more robust as now it will be properly waited for the elements. Additionally, as some asserts were added too, it should make the tests fail at the right step if something does not pass. Ironically adding the missing asserts could cause some tests to start failing sometimes if they were flaky, but based on a few runs it should be fine. I hope :-)

Due to all that and as it only touches the acceptance tests I would suggest to backport it (but if the backport fails feel free to ignore it).

As no timeout was specified the elements were tried to be found just
once. This caused the steps to fail if the elements did not appear yet
in the page when they were tried to be found.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
WaitFor::element... calls only perform the waiting and return whether
the condition succeeded or not, but that result needs to be explicitly
checked to prevent further steps from being executed if the wait failed.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Adding some missing asserts showed that the "delete user" acceptance
test was silently failing, as the deletion was not being confirmed in
the dialog and thus the user was not being deleted.

The dialog button contains a single quote ("user0's"), so the XPath
expression had to be adjusted (it seems that it is not possible to
escape a single quote in a string enclosed in single quotes in XPath
1.0).

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
"Actor::find" is a more robust way to look for elements, as it handles
some exceptions that may be thrown. Therefore, even if the elements are
not actually used and it is only checked whether they exist or not using
the actor is the preferred way when possible (and it also makes it
consistent with the rest of the acceptance tests).

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Instead of looking for the bundle button and then checking its value now
the expected value is included in the locator and the button is checked
similarly to other elements.

No "Disable all" locator was added as it was not currently needed
anywhere.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
Although if the element could not be found an exception would be thrown
and the test aborted if an element is in the DOM but hidden it would be
found and the test would pass.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
The input element is always hidden, so the check always ended falling
back to the label. Moreover, the label is the element that the user
interacts with, so it must be the one used.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
@danxuliu danxuliu added the 2. developing Work in progress label Mar 6, 2021
@danxuliu danxuliu added this to the Nextcloud 22 milestone Mar 6, 2021
@danxuliu
Copy link
Member Author

danxuliu commented Mar 6, 2021

/backport to stable21

@danxuliu
Copy link
Member Author

danxuliu commented Mar 6, 2021

/backport to stable20

@danxuliu danxuliu marked this pull request as ready for review March 6, 2021 13:15
@danxuliu danxuliu added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 6, 2021
Copy link
Contributor

@kesselb kesselb left a comment

Choose a reason for hiding this comment

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

🎉

@rullzer rullzer merged commit f8c7ce5 into master Mar 8, 2021
@rullzer rullzer deleted the add-missing-waits-and-asserts-in-acceptance-tests branch March 8, 2021 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants