Comments (16)
I'm seeing this on UIView based tests. The issue can lie in four places.
- FBSnapshots (unlikely)
- Quick (unlikely)
- Our Nimble Extension (highest chance imo)
- Swift ( sigh )
from eidolon.
Yeah could be. We also don't have the same robust supporting framework that we do in eigen to ensure that view controllers are presented with a frame, for example.
from eidolon.
OK, seeing some more consistent behaviour. If you have a test that's failing (for me it's usually ConfirmYourBidArtsyLoginViewControllerTests
), you can force the view to load:
expect(sut.view) != nil
That alone won't help the test pass. Instead, pause the tests in the debugger just before the sut is tested. Quick look its view (it's empty). Close the quick look window and quick look it again (it's no longer empty). And the test will pass from now on.
Not sure what to make of these findings but will continue looking.
from eidolon.
Interestingly, using an asynchronous matcher solves the problem:
expect(sut).toEventually(haveValidSnapshot(named:"default"), timeout: 1.0, pollInterval: 0.05)
The timeouts are interesting. Anything less than 0.3
and they fail frequently. Anything over that and it never fails. So I'm thinking there's some part of this that thinks it's being animated maybe? Not sure.
from eidolon.
@orta Good hunch to test the FBSnapshotTest case individually. I used this code on a failing test:
let result = FBSnapshotTest.compareSnapshot(sut, snapshot: "ConfirmYourBidEnterYourEmailViewControllerTests_swift_default", testCase: sut, record: false, referenceDirectory: "//Users/ash/Dropbox (Personal)/bin/eidolon/KioskTests/ReferenceImages")
expect(result) == true
And it never failed. So the problem is almost certainly in the Nimble-Snapshots matchers (note that the method I'm calling above belongs to FBSnapshotTest
, a class in Nimble-Snapshots).
from eidolon.
Actually I may have spoken too soon...
from eidolon.
Yeah so this is happening without using anything from Nimble-Snapshots.
var snapshotController: FBSnapshotTestController = FBSnapshotTestController(testClass: sut.dynamicType)
snapshotController.recordMode = false
snapshotController.referenceImagesDirectory = "//Users/ash/Dropbox (Personal)/bin/eidolon/KioskTests/ReferenceImages"
let result = snapshotController.compareSnapshotOfView(sut.snapshotObject, selector: Selector("ConfirmYourBidEnterYourEmailViewControllerTests_swift_default"), identifier: nil, error: nil)
expect(result) == true // failed
So my gut says that it's either in iOS 8 or storyboards. Going to try and reproduce in a fresh project.
from eidolon.
Unless it's snapshotObject
...
@objc protocol Snapshotable {
var snapshotObject: UIView? { get }
}
extension UIViewController : Snapshotable {
var snapshotObject: UIView? {
self.beginAppearanceTransition(true, animated: false)
self.endAppearanceTransition()
return self.view
}
}
Maybe Swift doesn't like side-effects in computed properties in protocols?
from eidolon.
from eidolon.
Ha.
Yeah sorry for all the chitchat here. Kind of rubber-ducking I guess.
from eidolon.
Nope, this is something with Facebook's lib and iOS 8 / Swift.
let sut = ConfirmYourBidEnterYourEmailViewController.instantiateFromStoryboard()
sut.beginAppearanceTransition(true, animated: false)
sut.endAppearanceTransition()
var snapshotController: FBSnapshotTestController = FBSnapshotTestController(testClass: sut.dynamicType)
snapshotController.recordMode = false
snapshotController.referenceImagesDirectory = "//Users/ash/Dropbox (Personal)/bin/eidolon/KioskTests/ReferenceImages"
let result = snapshotController.compareSnapshotOfView(sut.view, selector: Selector("ConfirmYourBidEnterYourEmailViewControllerTests_swift_default"), identifier: nil, error: nil)
expect(result) == true // fails
from eidolon.
OK, so I can't reproduce the error with Storyboards and FBSnapshotTestController. So I think it might be Quick.
from eidolon.
I can't get it to reproduce with a plain XCTestCase
, so I think it's something with Quick. Going to look at it again in the morning.
from eidolon.
This is a problem with either iOS 8, Xcode 6.x, or Storyboards, as the issue occurs with vanilla Xcode projects. I've opened a Stack Overflow question with more details.
from eidolon.
@ashfurrow given that 0.3
seconds is the default CoreAnimation implicit animation timing, my guess is that there's a so sort of animation going on.
from eidolon.
@segiddins Nah, this is a problem with the iOS API. This issue was actually closed by #80 – @orta, feel free to reopen if you're still experiencing intermittent failures.
from eidolon.
Related Issues (20)
- Can not run project using Xcode 8.2.1 HOT 4
- App crashes during registration in Staging (version 5.6.1)
- Grid layout reacts abnormally when switching filters (version 5.6.1)
- Help HOT 6
- Old comment? HOT 2
- App unable to connect to newer card readers HOT 2
- Remove Mixpanel integration (in favor of Segment) HOT 3
- [!] The 'Pods-Kiosk' target has frameworks with conflicting names: artsy_uifonts. HOT 1
- Someone should watch this WWDC HOT 2
- Add a link to this in the README?
- Adopt iOS 11 Kiosk API
- Issue in doing bundle install HOT 2
- Issue with 'bundle exec fastlane oss' HOT 7
- question about newTokenRequest HOT 2
- CI is failing HOT 1
- bundle exec fastlane oss fails HOT 4
- Dimming buttons when popover / child controller is presented HOT 6
- bundle exec fastlane oss Fails HOT 5
- Can't build in xCode. It's searching for a Pods folder that doesn't exist HOT 8
- Adopt inclusive language
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eidolon.