Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

tvOS: screenshot generated before focus processing? #220

Open
dcordero opened this issue Mar 29, 2017 · 2 comments
Open

tvOS: screenshot generated before focus processing? #220

dcordero opened this issue Mar 29, 2017 · 2 comments

Comments

@dcordero
Copy link

dcordero commented Mar 29, 2017

Hi, I am trying to make use of this awesome library in a tvOS project. As result of which I am getting a really weird result.

It seems that the screenshots that I am getting from the tests are being generated right before the focus manager assign the focus to one of the views on the screen.

I created this simple project as an example with a couple of previews on the README to make it easier to understand and reproduce the problem:
https://github.com/dcordero/tvOS-SnapshotTesting

Attending to the fact, that assigning the focus to a specific view also implies a sort of animation, this issue would be related with #52

I tried to workaround this issue adding the following code to my test...

let date = Date(timeIntervalSinceNow: 1.0)
RunLoop.current.run(until: date)

... but no success at all, I got exactly the same result.

@Grubas7
Copy link
Contributor

Grubas7 commented May 30, 2017

@dcordero You could try to disable animation on start of your tests:

override class func setUp() {
    super.setUp()
    UIView.setAnimationsEnabled(false)
}

Remember to enable back again after you finish.

If problem still occur drop me a line, and I'll try to check your sample.

@dcordero
Copy link
Author

@Grubas7 thanks for the feedback, that was a really great idea to disable the animation. On the other hand I gave it a try and it did not work. Still getting the same result.

I wonder if it could be an issue more related to the Focus Manager itself, which might be assigning the focus to the button after the screenshot is generated.

testviewcontroller

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants