Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions DeviceKitTests/Categories/XCUIApplicationProcess+FBQuiescence.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ static void swizzledWaitForQuiescenceIncludingAnimationsIdlePreEvent(
}
}

// WDA PR #664: C function used to replace XCTIssue.shouldInterruptTest via IMP swap.
static BOOL dk_swizzledShouldInterruptTest(id __unused self, SEL __unused _cmd)
{
return NO;
}

#pragma mark - Category Implementation

@implementation XCUIApplicationProcess (FBQuiescence)
Expand All @@ -161,6 +167,14 @@ @implementation XCUIApplicationProcess (FBQuiescence)
* version.
*/
+ (void)load {
// WDA PR #664 (XCTIssue+FBPatcher): swizzle shouldInterruptTest → NO so that
// internal XCTest failures during testmanagerd startup don't kill the runner.
SEL shouldInterruptTest = NSSelectorFromString(@"shouldInterruptTest");
Method m = class_getInstanceMethod(NSClassFromString(@"XCTIssue"), shouldInterruptTest);
if (m) {
method_setImplementation(m, (IMP)dk_swizzledShouldInterruptTest);
}

Method waitForQuiescenceIncludingAnimationsIdleMethod =
class_getInstanceMethod(self.class, @selector
(waitForQuiescenceIncludingAnimationsIdle:));
Expand Down
21 changes: 15 additions & 6 deletions DeviceKitTests/devicekit_iosUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@ final class DeviceKitUITests: XCTestCase {
category: "DeviceKitUITests"
)

private static var swizzledOutIdle = false

override func setUpWithError() throws {
// XCTest internals sometimes use XCTAssert* instead of exceptions.
// Setting `continueAfterFailure` so that the xctest runner does not stop
// when an XCTest internal error happens (eg: when using .allElementsBoundByIndex
// on a ReactNative app)
continueAfterFailure = true

// WDA PR #664 (FBFailureProofTestCase): prevent the runner from halting
// when testmanagerd is slow to connect on startup (random ~20s timeout).
// shouldHaltWhenReceivesControl is a private XCTestCase BOOL property.
let sel = NSSelectorFromString("setShouldHaltWhenReceivesControl:")
if responds(to: sel) {
setValue(NSNumber(value: false), forKey: "shouldHaltWhenReceivesControl")
}
}

// WDA PR #664: swallow XCTest issues instead of propagating them up.
// The XCTIssue+FBPatcher +load swizzle handles shouldInterruptTest → NO;
// this override prevents issues from reaching XCTest's failure machinery.
override func record(_ issue: XCTIssue) {
Self.logger.warning("XCTest issue (swallowed): \(issue.compactDescription)")
}

override class func setUp() {
Expand Down
Loading