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

Fix logout for connected tests and re-enable Slack notifications #11850

Merged
merged 3 commits into from
May 7, 2020

Conversation

oguzkocer
Copy link
Contributor

This PR adds an extra visibility matcher to me_item menu button in the "My Site" screen so the tests can logout. I couldn't figure out what caused the matcher to stop working since there doesn't seem to be a change to the MySiteFragment when the tests started to fail. Regardless, this matcher change is working locally, so hopefully it'll fix the ones in Firebase as well.

I've also re-enabled to Slack notifications since the tests were consistently passing before this issue, so assuming this PR fixes the issue, I don't think we need to keep that disabled anymore.

To test:

  • Run the optional connected tests and verify all of them passes

PR submission checklist:

  • I have considered adding unit tests where possible.
  • 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.

@oguzkocer oguzkocer added this to the 14.9 milestone May 7, 2020
@oguzkocer oguzkocer requested a review from rachelmcr May 7, 2020 14:19
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented May 7, 2020

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

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented May 7, 2020

You can test the changes on this Pull Request by downloading the APK here.

@@ -33,7 +35,7 @@ public MePage go() {
// Using the settings button as a marker for successfully navigating to the page
while (!isElementDisplayed(appSettings)) {
clickOn(R.id.nav_sites);
clickOn(R.id.me_item);
clickOn(onView(allOf(withId(R.id.me_item), withEffectiveVisibility(Visibility.VISIBLE))));
Copy link
Member

Choose a reason for hiding this comment

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

Given that clickOn is our own custom click action, I don't love modifying the element we're passing it here. It feels cleaner to update the clickOn method itself to better handle scenarios like this. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's give it a shot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rachelmcr I've changed the onView(withId($elementId)) instances with a helper that also checks for visibility. This covers most of the matchers, but there are still some that checks for text or a specific child. I am not sure if we are doing the right thing by having the visibility matcher everywhere. That probably is due to my unfamiliarity with Espresso, so if you think we should change those as well, I can.

Copy link
Member

Choose a reason for hiding this comment

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

I am not sure if we are doing the right thing by having the visibility matcher everywhere.

Agreed. That helper feels off especially when combining withEffectiveVisibility and isDisplayed when it's used in various methods. I don't have as much experience with Espresso but my understanding is that those matchers are meant to be alternatives to each other, not additive checks (as explained in the withEffectiveVisibility documentation.

I'm going to backtrack and suggest that we use your first approach, to limit how much we're using withEffectiveVisibility (only using it with elements that strictly require it). Sorry for going back and forth on that.

I'm also making a note to take another look at this behavior when I have time, to see if there's some other solution that I'm missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rachelmcr That's fine by me, but do you mind if we merge this PR and then change it back in a subsequent PR so the tests would work again? I don't have time to follow up with this today and might not be able to do it tomorrow either, so I don't want to postpone fixing the tests for too long.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I just went back and approved the PR before seeing this comment. I'll go ahead and merge it for now. 👍

Copy link
Member

@rachelmcr rachelmcr left a comment

Choose a reason for hiding this comment

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

As I mentioned in my comment, I think it might be better to go back to a simpler fix that doesn't add all the checks for visibility with the helper method. (Now that I see it, I think that wasn't the right recommendation on my part.) That said, I'm ok with merging this fix as-is to fix the tests and then taking more time to consider the approach we use here.

I'm not going to merge the PR for now, in case you want to make changes, but please feel free to merge it if you feel comfortable with it as is.

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.

2 participants