SwiftMonkey icon indicating copy to clipboard operation
SwiftMonkey copied to clipboard

Xcode 10 removes internal class used for event generation and causes crash

Open codyd51 opened this issue 6 years ago • 6 comments

When Xcode 10 packages the <App Name>UITests-Runner.app, it includes a different XCTest.framework from the one it packaged with Xcode 9. This new version does not contain the XCEventGenerator class that SwiftMonkey expects, and causes a crash when the library user uses addDefaultXCTestPrivateActions.

The crash occurs when Monkey tries to force-unwrap +[XCEventGenerator sharedGenerator, which is nil because the class doesn't exist.

Are there any plans to update this library to use components present in the Xcode 10 XCTest framework?

Additionally, I was unable to send events when using addDefaultUIAutomationActions (UIAutomation.framework). Is this also known to be a broken approach on iOS 12?

Thanks!

codyd51 avatar Feb 18 '19 17:02 codyd51

Hey there @codyd51 ! Which version of Xcode are you using exactly? I just tested SwiftMonkey with addDefaultXCTestPrivateActions() and addDefaultUIAutomationActions() and both work fine (Xcode 10.1 and iOS 12.1 simulator). Also, are you testing on a device or simulator?

wojciechczerski avatar Feb 18 '19 18:02 wojciechczerski

Thanks for the prompt response! I'm using Xcode 10.2 beta 2 (10P91b).

I'm testing on an iOS 12 device. I can upload the new XCTest.framework if you'd like.

codyd51 avatar Feb 18 '19 18:02 codyd51

I will install Xcode Beta and try it myself. When I can see the error you described, I'll try finding a workaround for it. Thanks for reporting the issue! I'll keep you informed about any progress.

wojciechczerski avatar Feb 18 '19 19:02 wojciechczerski

@codyd51 I've checked 10.2 beta 3 (10P99q) on a Simulator, and here's what I observed:

  • using addDefaultUIAutomationActions() works fine
  • using addDefaultXCTestPrivateActions() does not crash, but it looks like it "freezes" the test runner and the tests are not executed

I'll try to investigate why is this happening, however it might just be a "beta" thing. Have you tried reproducing the crash on the latest beta?

wojciechczerski avatar Mar 03 '19 09:03 wojciechczerski

This still exists on public Xcode 10.2. Any further help here?

kaustubhkabra avatar Jun 25 '19 03:06 kaustubhkabra

I meet the same problem as kaustubhkabra described, I tested the demo at Xcode 10.2 but it seems frezzed when run into addDefaultXCTestPrivateActions(), any idea about it?

sky-weihao avatar Aug 13 '19 00:08 sky-weihao