-
Notifications
You must be signed in to change notification settings - Fork 918
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
Broken tests with Xcode 16-RC / iOS 18 #1303
Comments
We ran into a similar issue with KIF. It manually calls the
If this doesn't work there were couple other threads on Apple forums that suggest a different fix. |
This is also happening when using SwiftUI lists that are long enough to dequeue new cells when scrolling to a label. |
I think probably the best fix here is to implement the same logic that we have for UITableViews for UICollectionViews. Instead of enumerating and popping elements programmatically, instead scroll the view so that the elements is on screen, then use the cell on the screen. I'll take a crack at this today, as we have a need for this for other reasons (setting properties and child views on willAppear instead of on cell init). |
Hi @justinseanmartin! Were you able to test your solution? Any insights? Thanks! |
Hey, sorry, had a team offsite last week and didn't get to dig in. I'm working on #1300 today. Once that's green again, I'll start working on the fix for this. |
Fix was posted in #1307. Please take a look and give that a test locally to make sure it doesn't cause other issue. Thanks! |
Hey! Thanks for looking into this! I've tried that version out with out KIF tests and I'm seeing a lot of The majority of our tests are passing but unfortunately I'm not able to figure out the use case for the failure yet. I see this on both iOS17.5 and iOS18. The previous version (3.9.0) wasn't causing issues on iOS17.5. |
I also tried out another variant where I replaced
with
Weirdly, I see that some tests that failed with the 1st variant now pass with the 2nd, but it doesn't seem to fix every case. |
I spent some time this morning trying to reproduce our more complex |
One other thing to note: I tried removing this |
I'm actually hitting the same |
That's great. Thanks so much. Yes - our cases are regularly with collection views within other collections views so I suspect the issue you're working on will fix it for us. I'll keep an eye out for the fix and test as soon as it's ready. Thanks again! |
Could you try out the fix that is a WIP here: https://github.com/justinseanmartin/KIF/tree/jmartin/collection-view-cell-spin-runloop and see if that fully addresses it for you? |
I've tried that branch out. Initially, I was seeing that it fixed a lot of the issues, but then I noticed that a lot of the tests aren't passing consistently - if I run a test repeatedly in Xcode, some of the tests have a ~65% failure rate for example. Is there some debug information I can capture that will help show the difference between the passing and failing cases? |
Do you have any tests that are consistently failing or is it only flakiness now? We could try increasing it to 100 iterations of the runloop being spun instead of 10. Maybe we should make it explicitly time based, like spin for up to 1s (maybe a configurable value). It is probably better to give more time to avoid tests having flakiness from race conditions, but it also could lead to tests running really slow if they're spending a lot of time scrolling through collection views (especially ones with lots of elements in them). If you wanted to experiment in your own branch to see what seems to work for you, that'd help. I'm seeing some tests still failing on this assertion locally, so I'm still iterating on that fix myself as well. |
I am seeing some tests that are constently failing, but these are more related to accessibility identifiers not being found during the run of a block predicate... I'm still investigating those, but it's likely not related as there's no collection view in the UI. We've seen a few failures that are related to changes in UIKit under the hood so it may be another case of that. There is another consistent failure where a label in a collection view cell is being updated but the ui changes never get reflected in the UI. That's a strange one but I'll look into that some more and get back to you. In the meantime, I'll have a play around with the number of iterations in that while loop and see if it changes anything. Thanks again for the support! 🙌 |
I've spent a couple of days testing the version at https://github.com/justinseanmartin/KIF/tree/jmartin/collection-view-cell-spin-runloop with an iteration count of 100 and things definitely seem more stable. This has allowed me to dig into the actually failures we were seeing and update the tests accordingly. At this stage, we're running tests using iOS17.5 against this new version of KIF to make sure we have no regressions. We'll address the iOS18 issues (and anything that brings up) once we're happy with the iOS17.5 runs. There's one category of failure I'm seeing and after digging into this a little, I realise that things will run slightly differently with the changes made recently to KIF. Technically, some tests that would pass in the Some tests are triggering a scroll operation in a collection view and waiting for a In some tests, the label will appear on-screen before the In the old KIF, this was fine as the collection view would continue to scroll to where it was originally heading and eventually the page control would update and the test would pass. A simple |
We are experiencing failures in tests written with
KIF
, and we aren't sure if it's related to the framework and the new versions of Xcode & iOS, or it is a more general problem.In our project we have both
UITests
running withXCUITest
andKIF
. However the first ones are working as they were withXcode 15.4
, but not so much when running KIF-based ones.The most common error we're finding is the following:
From our initial investigations, we have some screens in which we have a basic implementation, returning just one cell type, which is registered, while in some others we have a guard clause returning
UICollectionViewTableViewCell()
in the else clause, in which we have placed a breakpoint and wasn't hit while running tests and failing.Furthermore, not running the app in a device, nor running
XCUITest
based tests we experience similar failures. Similarly, if I runKIF tests
targetingiOS 17.x
in the sameXcode 16-RC
they don't fail, so the problem seems to be related to iOS 18.Any help or guidance would be much appreciated.
The text was updated successfully, but these errors were encountered: