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

Adjustments in Settings UI tests to avoid flakyness #2737

Merged
merged 3 commits into from
Dec 3, 2019

Conversation

jesmrec
Copy link
Collaborator

@jesmrec jesmrec commented Nov 27, 2019

Issues: #2732 #2709

Some actions performed:

  • Camera Uploads section:

For these tests, the whole preferences activity was loaded, taking advantage that the section is on the top (visible at a glance). Some tests were flaky because the activity takes a bit longer in loading, before the action over the camera uploads checkbox is done (this is something not desirable that the testing framework should take care). Therefore, the dialog warning users to set up correctly the camera uploads is not displayed, failing the matcher over the "OK" button.

As fix, the activity is only loaded with the camera uploads section.

  • LocalFolderPicker activity

Here, the fix is a bit hacky. An implicit wait till the UI componentes are visible to launch the tests. Although there is a loop, it will not be infinite since the activityRule always is created.

  • Passcode

The test for cancelling the activity was removed. It was being flaky due to isFinishing assertion. Such test is not a critical one (too far from this.. it only checks that a cancelled view is dismissed). So, better to get rid of.

These fixes were tested with:

  • Samsung Galaxy S9, Android 9
  • Nexus 6P , Android 7
  • Huawei P20 Lite, Android 9

Copy link
Contributor

@hannesa2 hannesa2 left a comment

Choose a reason for hiding this comment

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

Sorry, I see no improvement here
image

@jesmrec jesmrec force-pushed the fix/settings_tests_flakiness branch from 4d6d410 to 43fca1a Compare November 28, 2019 10:06
@jesmrec
Copy link
Collaborator Author

jesmrec commented Nov 28, 2019

After merging #2725, the Log menu UI has changed, so the tests were failing in the BitRise push job. Latest commit adapts it, by simple checks on the new options.

@jesmrec jesmrec force-pushed the fix/settings_tests_flakiness branch from 43fca1a to 80f0010 Compare November 28, 2019 11:14
@jesmrec
Copy link
Collaborator Author

jesmrec commented Nov 28, 2019

@hannesa2 i guess you trigger the tests in a local emulator. By executing in a real device, and also BitRise are working. Taking a look as well

@davigonz
Copy link
Contributor

davigonz commented Nov 28, 2019

I've been executing the tests in a Nexus 6P emulator and there's some intent errors triggered during OCSettingsMoreTest execution, something like E/TestRunner: androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: Wanted to match 1 intents. Actually matched 0 intents. and java.lang.IllegalStateException: #init was called twice in a row

I've performed some changes there and it increased a bit the success rate.

Screenshot 2019-11-28 at 10 59 26

Could you check them @jesmrec ? It would be great to have 100% even with emulator.

Anyway, this issue is about the Settings tests, not all of instrumented ones so first we want the Settings tests to be fixed and the other related to shares and capabilities are being fixed via #2728

So as soon as the Setting tests are not flacky anymore (no more OCSettingsWhatever tests failing when executing ./gradlew :owncloudApp:connectedDebugAndroidTest), we will merge them, close this issue and follow up
#2709 for the whole instrumented test suite of presentation layer (owncloudApp module)

@jesmrec jesmrec force-pushed the fix/settings_tests_flakiness branch 2 times, most recently from e19fccc to f9f75c7 Compare November 29, 2019 12:56
@jesmrec
Copy link
Collaborator Author

jesmrec commented Nov 29, 2019

I have get rid of the ugly implicit wait in the LocalFolderPicker suite, since it does not fix the problem and it is not desirable to have.

I have updated and performed more testing, with the following results:

  • Real devices: i have tested with different devices from Android 7 to Android 10, and all the Settings tests passed correctly.

  • CI: BitRise is passing correctly the tests over their emulators

  • Local emulators: With Pixel emulators, tests are running correctly as well. But, other emulators like Nexus are running into issues. After researching a bit about it, i've realised that most of them are caused by some kind of weird race condition in the moment of loading the ActivityRule. Activity is loaded, but the first action (in most cases, a click) is not performed but there is no NuSuchElementException or similar either.

Which emulators are you using @davigonz @hannesa2? do you trigger directly with ./gradlew test or use additional options?

@jesmrec jesmrec mentioned this pull request Dec 2, 2019
37 tasks
@davigonz
Copy link
Contributor

davigonz commented Dec 2, 2019

Which emulators are you using @davigonz @hannesa2? do you trigger directly with ./gradlew test or use additional options?

@jesmrec ./gradlew :owncloudApp:connectedDebugAndroidTest with a Nexus6P API 28

@davigonz
Copy link
Contributor

davigonz commented Dec 2, 2019

@jesmrec thanks for this detailed report, the work done here is enough imho. We can not guarantee the tests passing in all emulators for now, Bitrise was the blocker here and the tests are passing there now and also in at least, a local emulator. There seems to be a problem with Nexus 6P emulators.

@jesmrec jesmrec force-pushed the fix/settings_tests_flakiness branch from f9f75c7 to b535e51 Compare December 3, 2019 07:52
@jesmrec jesmrec dismissed hannesa2’s stale review December 3, 2019 13:00

Ugly code of the review was removed from the PR, and conversation was resolved.

@davigonz davigonz merged commit 4c420ab into master Dec 3, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix/settings_tests_flakiness branch December 3, 2019 13:02
@davigonz
Copy link
Contributor

davigonz commented Dec 3, 2019

Tests are properly passing on Bitrise

@hannesa2
Copy link
Contributor

hannesa2 commented Dec 4, 2019

image

For the record: I can't confirm to work properly on an Emulator

image

@jesmrec
Copy link
Collaborator Author

jesmrec commented Dec 4, 2019

which emulator are you using? Pixel? Nexus? as i have written above, in different emulators i got different results. Also, it'd be helpful to know which tests are failing, since there are other PRs with fixed tests.

@hannesa2
Copy link
Contributor

hannesa2 commented Dec 5, 2019

Ohh, I my idea was a independency from hardware profile, just a dependency from system-image. That's why I only wrote in previous mesage just system info, here is the complete info.
But maybe I'm wrong

image

@jesmrec
Copy link
Collaborator Author

jesmrec commented Dec 5, 2019

my idea is the same, but... when things do not work, you have to know where the problem is (in order to fix it... ). Thanks for the additional info, i will take a look.

@jesmrec jesmrec added QA and removed Testing labels Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants