Skip to content

Conversation

@pachlava
Copy link
Contributor

@pachlava pachlava commented Jun 5, 2023

Description

Following the maximum similarity to its iOS counterpart, this PR adds a UI test for the "Pages" dashboard card:

Screenshot 2023-06-05 at 22 50 36

What the test does:

@Test
fun e2ePagesCardNavigation() {
    MySitesPage()
        .scrollToPagesCard()
        .assertPagesCard()
        .assertPagesCardHasPage("Blog")
        .assertPagesCardHasPage("Cart")
        .assertPagesCardHasPage("Shop")
        .tapPagesCard()
        .assertPagesScreenLoaded()
        .assertPagesScreenHasPage("Blog")
        .assertPagesScreenHasPage("Cart")
        .assertPagesScreenHasPage("Shop")
}

There is some noise because I moved 3 dashboard-related mock files to a dashboard folder, and also renamed them.

To test

  • All tests are green on CI, including the new e2ePagesCardNavigation

Regression Notes

I'm not filling the regression notes since the PR adds a UI test, it does not change the app behaviour in any way.

@pachlava pachlava requested a review from a team as a code owner June 5, 2023 19:20
@pachlava pachlava marked this pull request as draft June 5, 2023 19:20
@pachlava pachlava added the UI Tests Anything related to automated UI Tests. label Jun 5, 2023
@pachlava pachlava added this to the Future milestone Jun 5, 2023
@pachlava pachlava force-pushed the add-pages-card-ui-test branch from 5942bb3 to e618135 Compare June 5, 2023 19:21
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 5, 2023

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr18578-691f307
Commit691f307
Direct Downloadjetpack-prototype-build-pr18578-691f307.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 5, 2023

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr18578-691f307
Commit691f307
Direct Downloadwordpress-prototype-build-pr18578-691f307.apk
Note: Google Login is not supported on these builds.

@pachlava pachlava force-pushed the add-pages-card-ui-test branch from e618135 to 691f307 Compare June 5, 2023 19:44
}

private fun scrollToCard(elementID: Int): MySitesPage {
WPSupportUtils.waitForElementToBeDisplayed(elementID)
Copy link
Contributor Author

@pachlava pachlava Jun 5, 2023

Choose a reason for hiding this comment

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

I added this function with #18345, this I have no idea why this line was here, it makes no sense 😕. This worked only because the Domains card was already on-screen, and did not require scrolling.

Comment on lines -293 to -296
fun scrollToDomainsCard(): MySitesPage {
return scrollToCard(R.id.dashboard_card_domain_cta)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just moved it a few lines below, so that it belongs to the same card-related functions.

@pachlava pachlava marked this pull request as ready for review June 5, 2023 20:14
@pachlava pachlava requested a review from startuptester June 5, 2023 20:15
Copy link
Contributor

@jostnes jostnes left a comment

Choose a reason for hiding this comment

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

added one non-blocking question related to , but other than that test works well locally and CI and is similar to the iOS implementation (which is approved) so it's a ✅ for me!

ViewMatchers.hasDescendant(
Matchers.allOf(
ViewMatchers.withText(R.string.dashboard_pages_card_title),
ViewMatchers.withId(R.id.my_site_card_toolbar_title),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ViewMatchers.withId(R.id.my_site_card_toolbar_title),
ViewMatchers.withId(R.id.my_site_card_toolbar_title)

i noticed that for multiple matches, the last matcher ends with a , which looks odd to me since it's the last one. is this intentional or is it a kotlin thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this particular case, this is most probably a result of me moving things around. Such a comma in the end, even if it's not followed by another line, is not considered a code style violation. I saw cases when people deliberately kept commas at the end of a line, to avoid extra noise in the future PRs when they add a next line (I left once a nitpick about this here in a PR of yours).

@pachlava pachlava merged commit dfd5f09 into trunk Jun 6, 2023
@pachlava pachlava deleted the add-pages-card-ui-test branch June 6, 2023 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI Tests Anything related to automated UI Tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants