KIF无法强制应用到后台

时间:2017-03-08 04:16:58

标签: ios xcode-ui-testing kif

当app推送到后台并恢复应用时,我遇到了问题。 当应用程序推送到后台时,它无法强制接地以恢复我的应用程序 这是我的代码:

   - (void)testResumingEditProfile {
    self.methodName = NSStringFromSelector(_cmd);

    user = [TestUser sharedInstance].defaultNextUser;
    user.username = @"347";
    [tester doLoginSuccessfully:user];

    app = [UITestApp sharedInstance];
    screen = [tester navigateToOverviewPage];

    employee = [[TestEmployee alloc] init].profileEmployee;

    [self openEditProfile];
    [tester catpureScreen:[self getCaptureScreenName:@"afterOpenEditProfile"]];

    [system deactivateAppForDuration:5]; //Code to deactive and resume app
    [tester catpureScreen:[self getCaptureScreenName:@"afterResumeEditProfile"]];

    [tester waitForView:@"text-first-name" in:screen];
    [tester waitForView:@"text-last-name" in:screen];

    [tester tap:@"label-show-detail" in:screen];
    [tester catpureScreen:[self getCaptureScreenName:@"afterOpenDetail"]];

    [system deactivateAppForDuration:5]; //Code to deactive and resume app
    [tester catpureScreen:[self getCaptureScreenName:@"afterResumeEditProfileDetail"]];
    [tester waitForView:@"label-personal-infomation" in:screen];
    [tester waitForView:@"label-contact-infomation" in:screen];
}

有人请帮我解决这个问题。感谢。

1 个答案:

答案 0 :(得分:0)

不幸的是,不支持此功能。但是有一些解决方法。请参阅此github问题https://github.com/kif-framework/KIF/issues/183