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

Adds untracking for state kGREYPendingViewsToDisappear in greyswizzled_viewDidAppear #750

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevenreinisch
Copy link

@stevenreinisch stevenreinisch commented Sep 21, 2018

Adds untracking for state kGREYPendingViewsToDisappear if a UIViewController's viewDidAppear has been called.

This is neccessary if the user triggers an incomplete transition between UIViewControllers e.g. in the context of a UIPageViewController. See this example for an explanation:

We show a UIPageViewController with three UIViewControllers VC1, VC2, and VC3.
This is the series of events:

  • VC1.viewWillAppear
  • VC1.viewDidAppear
  • VC1.view is shown to the user
  • User performs swipe left
  • VC2.viewWillAppear
  • VC1.viewWillDisappear
  • VC2.viewDidAppear
  • VC1.viewDidDisappear
  • VC2.view is shown to the user
  • User performs swipe left (This swipe does not go far enough to show VC3.view at the end of the swipe)
  • VC3.viewWillAppear
  • VC2.viewWillDisappear
  • VC2.viewWillAppear
  • VC2.viewDidAppear
  • VC3.viewWillDisappear
  • VC3.viewDidDisappear
  • VC2.view is shown to the user again

Without this patch, EarlGrey waits for viewDidDisappear: call on VC2 and app state does not become kGREYIdle.
With this patch, at the call of VC2.viewDidAppear state kGREYPendingViewsToDisappear is untracked and app state becomes kGREYIdle.

…troller's viewDidAppear has been called.

This is neccessary if the user triggers a transition between UIViewControllers e.g. in the context of a
UIPageViewController. See this example for an explanation:

We show a UIPageViewController with three UIViewControllers <VC1>, <VC2>, and <VC3>.
This is the series of events:

* <VC1>.viewWillAppear
* <VC1>.viewDidAppear
* <VC1>.view is shown to the user
* User performs swipe left
* <VC2>.viewWillAppear
* <VC1>.viewWillDisappear
* <VC2>.viewDidAppear
* <VC1>.viewDidDisappear
* <VC2>.view is shown to the user
* User performs swipe left (This swipe does not go far enough to show <VC3>.view at the end of the swipe)
* <VC3>.viewWillAppear
* <VC2>.viewWillDisappear
* <VC2>.viewWillAppear
* <VC2>.viewDidAppear
* <VC3>.viewWillDisappear
* <VC3>.viewDidDisappear
* <VC2>.view is shown to the user again

Without this patch, EarlGrey waits for viewDidDisappear: call on <VC2> and app state does not become kGREYIdle.
With this patch, at the call of <VC2>.viewDidAppear state kGREYPendingViewsToDisappear is untracked and app state becomes kGREYIdle.
@tirodkar
Copy link
Collaborator

Is this seen in a Page View Controller only? Would be great if we added a test for this as well so we can reproduce this.

@stevenreinisch
Copy link
Author

Can you give me hint, at which existing test I can look at to have a starting point?

@tirodkar
Copy link
Collaborator

Take a look at one of our view controller specific tests like the UITableView one. You can create a new xib with a Page View Controller and then add some tests that reproduce your issue. To do so,

  1. Create the view controller in the TestRig Sources using a xib.
  2. Add the view controller to the MainViewController here.
  3. Create a test that subclasses FTRBaseIntegrationTest and use the openTestViewNamed: to navigate to your newly created view controller class.
  4. In the class, perform the swipes you've mentioned to reproduce the issue.

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.

3 participants