Fix/screenshot ui tests - #13031
Conversation
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
|
You can test the changes on this Pull Request by downloading the APK here. |
jkmassel
left a comment
There was a problem hiding this comment.
I can't compile this branch for some reason – I think I need to sort out a bunch of Android Studio stuff, but I left one comment for your consideration in the mean time.
| private static RecyclerView getRecyclerView() { | ||
| ViewPager pager = getCurrentActivity().findViewById(R.id.postPager); | ||
| return (RecyclerView) pager.getChildAt(pager.getCurrentItem()).findViewById(R.id.recycler_view); | ||
| return (RecyclerView) ((ViewGroup) ((ViewGroup) (pager.getChildAt(pager.getCurrentItem())) |
There was a problem hiding this comment.
This looks tricky – could we add an ID to the RecyclerView in order to be able to fetch it by ID instead? 😅
If not, that's ok, just wanted to check
There was a problem hiding this comment.
@jkmassel There's an ID on the RecyclerView see
but for some reason at runtime it's disappearing and causing us to crash, I spent quite a while investigating this but decided to table figuring that out for later and implemented this workaround. I can make a comment of that here, unless you have some ideas on what could be the root cause for this?
There was a problem hiding this comment.
After switching to the fix/screenshot-ui-tests branch (and learning that I need to cd into the libs/gutenberg-mobile directory and git checkout . to clean up any dirty files every time), I was able to run WPScreenshotTest to completion with the workaround in this PR.
In my case, I ran the test several times and one test keeps failing for me with some strange looking wiremock error that starts with:
com.github.tomakehurst.wiremock.client.VerificationException: 18 requests were unmatched by any stub mapping. Shown with closest stub mappings:
Click to see the whole wiremock error
com.github.tomakehurst.wiremock.client.VerificationException: 6 requests were unmatched by any stub mapping. Shown with closest stub mappings:
expected:<
GET
/rest/v1.1/sites/106707880/stats/visits/?unit=week&quantity=15&date=2020-10-08&locale=en_US
Query: unit = year
quantity: 15
date: 2020-10-08
locale: en_US
> but was:<
GET
/rest/v1.1/sites/106707880/stats/visits/?unit=week&quantity=15&date=2020-10-08&locale=en_US
unit: week
quantity: 15
date: 2020-10-08
locale: en_US
>
expected:<
GET
/rest/v1.1/sites/106707880/stats/visits/?unit=week&quantity=15&date=2020-10-08&locale=en_US
Query: unit = day
quantity: 15
date: 2020-10-08
locale: en_US
> but was:<
GET
/rest/v1.1/sites/106707880/stats/visits/?unit=week&quantity=15&date=2020-10-08&locale=en_US
unit: week
quantity: 15
date: 2020-10-08
locale: en_US
>
expected:<
GET
/rest/v1.1/sites/106707880/stats/visits/?unit=week&quantity=15&date=2020-10-08&locale=en_US
Query: unit = day
quantity: 15
date: 2020-10-08
locale: en_US
> but was:<
GET
/rest/v1.1/sites/106707880/stats/visits/?unit=week&quantity=15&date=2020-10-08&locale=en_US
unit: week
quantity: 15
date: 2020-10-08
locale: en_US
>
expected:<
GET
/wpcom/v2/read/interests
> but was:<
GET
/wpcom/v2/read/tags/cards?refresh=0&locale=en_US&tags=photography
>
expected:<
GET
/wpcom/v2/plans/mobile
> but was:<
GET
/wpcom/v2/read/tags/cards?refresh=0&locale=en_US&tags=photography
>
expected:<
GET
/wpcom/v2/mobile/feature-announcements/
> but was:<
GET
/wpcom/v2/read/tags/cards?refresh=0&locale=en_US&tags=photography
>
at com.github.tomakehurst.wiremock.junit.WireMockRule.checkForUnmatchedRequests(WireMockRule.java:92)
at com.github.tomakehurst.wiremock.junit.WireMockRule.access$000(WireMockRule.java:34)
at com.github.tomakehurst.wiremock.junit.WireMockRule$1.evaluate(WireMockRule.java:74)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.wordpress.android.ui.screenshots.WPLocaleTestRule$1.evaluate(WPLocaleTestRule.java:39)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:104)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:392)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2145)
Tests ran to completion.
Is it okay to assume this issue will be resolved with the mock data updates we're about to complete and this PR should go through because the important thing is that the tests run without error so we can move forward?
Generated by 🚫 dangerJS |
Fixes issue finding RecyclerView on posts list page
To test: Screenshot tests should pass
PR submission checklist:
RELEASE-NOTES.txtif necessary.