Skip to content

Update espresso and AndroidX test dependencies#16170

Merged
AliSoftware merged 13 commits intotrunkfrom
update-test-libraries
Apr 4, 2022
Merged

Update espresso and AndroidX test dependencies#16170
AliSoftware merged 13 commits intotrunkfrom
update-test-libraries

Conversation

@malinajirka
Copy link
Copy Markdown
Contributor

@malinajirka malinajirka commented Mar 25, 2022

Updates Espresso, AndroidX Test and Robolectric dependencies. The main reason for this change is to "unblock" drop jetifier PR -> these changes are actually not necessary for us to be able to drop jetifier since it seems we are not using the parts of espresso that actually use the support dependencies, however, it's cleaner to update them since we can.

Diff of dependencies changes for wordpressVanillaReleaseRuntimeClasspath is empty.

I checked the release notes and haven't noticed any changes which should affect us - https://github.com/android/android-test/releases?page=4.

The changelist for Robolectric is extremely long with no info about behavioral changes vs new apis etc. Since it's a testing dependency I think if our tests are passing it's a good enough check, wdyt?

To test:
Green CI should be enough + I manually started the optional UI tests.

Regression Notes

  1. Potential unintended areas of impact
    Tests

  2. What I did to test those areas of impact (or what existing automated tests I relied on)

  3. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Mar 25, 2022

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Mar 25, 2022

You can test the changes on this Pull Request by downloading the APKs:

@malinajirka malinajirka requested a review from ParaskP7 March 25, 2022 07:46
@malinajirka malinajirka marked this pull request as ready for review March 25, 2022 07:46
@malinajirka
Copy link
Copy Markdown
Contributor Author

Marking it as ready for review. However, the optional connected tests have failed -> I tried running them on the "drop jetifier" PR and they failed there too with the same error. Asked about it on Slack p1648194352405879-slack-CC7L49W13

@malinajirka malinajirka added this to the 19.6 milestone Mar 25, 2022
@malinajirka malinajirka mentioned this pull request Mar 25, 2022
3 tasks
@ParaskP7 ParaskP7 self-assigned this Mar 28, 2022
@ParaskP7
Copy link
Copy Markdown
Contributor

👋 @malinajirka !

Thank you lots for opening this PR and making the effort to update some of the testing dependencies! 🙇

Updates Espresso, AndroidX Test and Robolectric dependencies. The main reason for this change is to "unblock" drop jetifier PR -> these changes are actually not necessary for us to be able to drop jetifier since it seems we are not using the parts of espresso that actually use the support dependencies, however, it's cleaner to update them since we can.

🥇

Diff of dependencies changes for wordpressVanillaReleaseRuntimeClasspath is empty.

I checked the release notes and haven't noticed any changes which should affect us - https://github.com/android/android-test/releases?page=4.

The only interesting diff I am seeing that we might consider updating in this or a subsequent PR is the API Changes for 1.3.0. I am seeing that the ActivityTestRule is deprecated in favor of ActivityScenario/ActivityScenarioRule and that us still using ActivityTestRule for our UI tests. Wdyt?

The changelist for Robolectric is extremely long with no info about behavioral changes vs new apis etc. Since it's a testing dependency I think if our tests are passing it's a good enough check, wdyt?

Yeap, a very long changelist indeed. 😅

What if take this opportunity and step back here. We can remove Robolectric altogether from the WordPress module as it is only used on this single ReactNativeRequestHandlerTest test suite. Instead of supporting Robolectric for this main module or ours, we could just drop support by just sacrificing this one test suite, which includes just a handful or tests anyway. Wdyt? This RobolectricSetupTest setup test class can be also removed. 🤔

PS.1: As for the libs/editor and its WordPressEditor related module that is also Robolectric, I am in favor of this changes and I think we should keep Robolectric there since it is used on lots of test suites. 👍
PS.2: I am also seeing that WCAndroid is not using Robolectric at all, which makes me think that we don't need to be using Robolectric for WPAndroid as well.

@malinajirka
Copy link
Copy Markdown
Contributor Author

malinajirka commented Mar 29, 2022

Thanks so much for the review @ParaskP7! I'm not a fan of Robolectric so I'll be more than happy to remove it from the app module. The other proposed change regarding deprecation of ActivityTestRule also sounds good to me. I'll implement these changes in this PR tomorrow or on Thursday. In case you'd prefer me to implement these changes in another PR, just let me know - both works for me.

@ParaskP7
Copy link
Copy Markdown
Contributor

👋 @malinajirka !

I'm not a fan of Robolectric so I'll be more than happy to remove it from the app module.

😅 Yea, let's do it then! 💯

The other proposed change regarding deprecation of ActivityTestRule also sounds good to me. I'll implement these changes in this PR tomorrow or on Thursday.

Great, thank you! 🙇

In case you'd prefer me to implement these changes in another PR, just let me know - both works for me.

Doing those changes in this PR sounds reasonable, so I am good if you implement these changes in this PR, if you are okay with that too. 👍

@malinajirka
Copy link
Copy Markdown
Contributor Author

@ParaskP7 I've made the changes we agreed on. One thing to note is that the documentation recommends wrapping ActivityScenario.launch(..) with try with resources or manually stopping the activity at the end of the test. This would require a bigger change to the structure of our tests so I decided not to do that now unless we find a need for it. Wdyt?

@ParaskP7
Copy link
Copy Markdown
Contributor

👋 @malinajirka !

@ParaskP7 I've made the changes we agreed on.

👍 I did check on the changes and everything looks good, thank you so much for applying those changes! 🙇

PS: One minor suggestion (💡) from my part would be to move the mActivityScenarioRule, wireMockRule fields and the field block initialization of wireMockRule on top of the setup() function within the BaseTest test class. Those are fields and having them in the middle seems a bit off to me. 😊

One thing to note is that the documentation recommends wrapping ActivityScenario.launch(..) with try with resources or manually stopping the activity at the end of the test. This would require a bigger change to the structure of our tests so I decided not to do that now unless we find a need for it. Wdyt?

Yes, I agree, it might be just okay for the time being to not do this try with resources change. Maybe we can create an issue on doing that at some point in the future and that's could be the extend of it for now. Wdyt about creating an accompanying issue?

@malinajirka
Copy link
Copy Markdown
Contributor Author

@ParaskP7 It seems all the tests are green now. It's ready for another round, thanks!

Copy link
Copy Markdown
Contributor

@ParaskP7 ParaskP7 left a comment

Choose a reason for hiding this comment

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

👋 @malinajirka !

Thank you so much for working on this and all the improvements you did, including fixing the ReaderTests, all LGTM, I re-triggered CI because it was failing on the dependency tree diff job and as soon as it gets 🟢 we can merge this!

🎉 🙇 🥇

@AliSoftware AliSoftware merged commit 605c5ed into trunk Apr 4, 2022
@AliSoftware AliSoftware deleted the update-test-libraries branch April 4, 2022 10:21
@AliSoftware
Copy link
Copy Markdown
Contributor

all LGTM, I re-triggered CI because it was failing on the dependency tree diff job and as soon as it gets 🟢 we can merge this!

Merged 🎉

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.

3 participants