Disabling waiting for idle state in UI testing of iOS apps

后端 未结 5 1125
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-04 12:37

Basically the problem is the same as this one: XCTestCase: Wait for app to idle

I am using perpetually repeating \"background animations\" in my views. The !@#$#$&@

5条回答
  •  逝去的感伤
    2021-02-04 13:03

    I used gh123man answer in Objective-C in case anyone needs it:

    - (void)disableWaitForIdle {
    
        SEL originalSelector = NSSelectorFromString(@"waitForQuiescenceIncludingAnimationsIdle:");
        SEL swizzledSelector = @selector(doNothing);
    
        Method originalMethod = class_getInstanceMethod(objc_getClass("XCUIApplicationProcess"), originalSelector);
        Method swizzledMethod = class_getInstanceMethod([self class], swizzledSelector);
    
        method_exchangeImplementations(originalMethod, swizzledMethod);
    }
    
    
    - (void)doNothing {
        // no-op
    }
    

提交回复
热议问题