Skip to content
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

Not able to capture Image when present UIAlertViewController as action sheet. #118

Open
vineetkhoticonvo opened this issue Feb 10, 2020 · 1 comment

Comments

@vineetkhoticonvo
Copy link

I am present UIAlertViewController as actionsheet and want to capture reference images for this. But action sheet not getting display on reference image. Please below code which I am using:

  • (void)testUIAlertView {
    XCTestExpectation *expectation = [self expectationWithDescription:@"Alert Action"];
    __block UIViewController *alertViewController = [[UIApplication sharedApplication] keyWindow].rootViewController;
    [alertViewController.view setBackgroundColor:[UIColor blackColor]];
    [self loadAlertViewOn:alertViewController Withhandler:^{
    if ([[alertViewController presentedViewController] isKindOfClass:[UIAlertController class]]) {
    [expectation fulfill];
    }
    }];
    [self waitForExpectationsWithTimeout:10.0 handler:^(NSError *error) {
    if (error) {
    XCTFail(@"^^ Fail due to timeout Error");
    }
    }];
    FBSnapshotVerifyView(alertViewController.view, nil);
    }

-(void)loadAlertViewOn:(UIViewController *)baseViewCtrl Withhandler:(void(^)(void))completionHandler {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Demo" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {
//action when pressed button
}];

UIAlertAction * okAction = [UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
    //action when pressed button
}];

UIAlertAction *doneAction = [UIAlertAction actionWithTitle:@"Done" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
    //action when pressed button
}];
[alertController addAction:cancelAction];
[alertController addAction:okAction];
[alertController addAction:doneAction];
[baseViewCtrl presentViewController:alertController animated:NO completion:nil];
completionHandler();

}

Please let me know what wrong I am doing here?

@jhon-gomez-fivestars
Copy link

any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants