-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Test] Added UI test for the new stats traffic tab. #20422
Conversation
This is necessary to allow for testing specific features.
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
|
092ab81
to
7fa14b2
Compare
WordPress/src/androidTest/java/org/wordpress/android/e2e/StatsNewTests.kt
Outdated
Show resolved
Hide resolved
WordPress/src/androidTest/resources/new-stats-feature-response.json
Outdated
Show resolved
Hide resolved
WordPress/src/androidTest/java/org/wordpress/android/support/BaseTest.java
Outdated
Show resolved
Hide resolved
WordPress/src/androidTest/java/org/wordpress/android/e2e/StatsNewTests.kt
Outdated
Show resolved
Hide resolved
Ok @irfano I kept it simple and added a simple new class, |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the feature alternative endpoint responses. It will help enhance our UI tests.
LGTM! 👍🏻
* | ||
* @param wireMockStubs the wiremock stubs to use for this specific test. | ||
*/ | ||
public BaseTest(@Nullable final List<WireMockStub> wireMockStubs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also send a list. Nice!
@notandyvee, I noticed that |
Thank you @irfano . I am aware of that. I created an issue to add retry mechanism since the bug seems to be a card loading issues. Retrying would help mitigate some of it since i was not able to reproduce it that often locally. But good call out. |
Fixes #20001
This PR adds a new UI test,
StatsNewTests
. It tests simply that we can reach to the new stats traffic tabs and that there are the two default tabs.In order to get it working I needed a way to toggle feature flags in UI tests. At first I tried using Wiremock options. But required some workarounds. I found a better way,
WireMockServer.stubFor
. You can find more documentation here. Apparently you can match against a specific url (/wpcom/v2/mobile/feature-flags/
) and force return specific responses.I tried making it a
TestRule
, but I needed access toWireMockRule
. But it wouldn't work in a separateTestRule
. The documentation isn't very large for android specifically. So for now I opted to simply pass in the feature file inBaseTest
constructor.To Test:
StatsNewTests
on any emulator. Should pass.StatsTests
on any emulator. Should pass.Regression Notes
Potential unintended areas of impact
N/A
What I did to test those areas of impact (or what existing automated tests I relied on)
Ran UI tests.
What automated tests I added (or what prevented me from doing so)
Added new simple UI test,
StatsNewTests
.PR Submission Checklist:
RELEASE-NOTES.txt
if necessary.