How to use grey_tapAtPoint method of performAction class

Best EarlGrey code snippet using performAction.grey_tapAtPoint

AccessibilityTest.m

Source:AccessibilityTest.m Github

copy

Full Screen

...68 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]69 assertWithMatcher:grey_sufficientlyVisible()];70 // Square element rect is {50, 150, 100, 100}71 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]72 performAction:grey_tapAtPoint(CGPointMake(50, 50))];73 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]74 assertWithMatcher:grey_text(@"Square Tapped")];75}76- (void)testSquareTappedAtEndBoundsSuccessfully {77 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]78 assertWithMatcher:grey_sufficientlyVisible()];79 // Square element rect is {50, 150, 100, 100}80 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]81 performAction:grey_tapAtPoint(CGPointMake(99, 99))];82 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]83 assertWithMatcher:grey_text(@"Square Tapped")];84}85- (void)testSquareTappedOutsideBoundsDoesNothing {86 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]87 assertWithMatcher:grey_sufficientlyVisible()];88 // Square element rect is {50, 150, 100, 100}89 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]90 performAction:grey_tapAtPoint(CGPointMake(151, 251))];91 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]92 assertWithMatcher:grey_not(grey_text(@"Square Tapped"))];93 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]94 performAction:grey_tapAtPoint(CGPointMake(49, 150))];95 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]96 assertWithMatcher:grey_not(grey_text(@"Square Tapped"))];97 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]98 performAction:grey_tapAtPoint(CGPointMake(50, 149))];99 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]100 assertWithMatcher:grey_not(grey_text(@"Square Tapped"))];101}102- (void)testSquareTappedOutsideWindowBoundsFails {103 [NSThread currentThread].threadDictionary[GREYFailureHandlerKey] = [[FailureHandler alloc] init];104 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]105 assertWithMatcher:grey_sufficientlyVisible()];106 @try {107 // Square element rect is {50, 150, 100, 100}108 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]109 performAction:grey_tapAtPoint(CGPointMake(-51, -151))];110 GREYFail(@"Should throw an exception");111 } @catch (NSException *exception) {112 NSRange exceptionRange = [[exception reason] rangeOfString:@"Cannot perform tap"];113 GREYAssertNotEqual(exceptionRange.location, NSNotFound, @"should not be equal");114 }115}116- (void)testCircleTappedSuccessfully {117 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CircleElementIdentifier")]118 assertWithMatcher:grey_sufficientlyVisible()];119 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CircleElementIdentifier")]120 performAction:[GREYActions actionForTap]];121 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]122 assertWithMatcher:grey_text(@"Circle Tapped")];123}...

Full Screen

Full Screen

FTRAccessibilityTest.m

Source:FTRAccessibilityTest.m Github

copy

Full Screen

...68 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]69 assertWithMatcher:grey_sufficientlyVisible()];70 // Square element rect is {50, 150, 100, 100}71 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]72 performAction:grey_tapAtPoint(CGPointMake(50, 50))];73 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]74 assertWithMatcher:grey_text(@"Square Tapped")];75}76- (void)testSquareTappedAtEndBoundsSuccessfully {77 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]78 assertWithMatcher:grey_sufficientlyVisible()];79 // Square element rect is {50, 150, 100, 100}80 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]81 performAction:grey_tapAtPoint(CGPointMake(99, 99))];82 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]83 assertWithMatcher:grey_text(@"Square Tapped")];84}85- (void)testSquareTappedOutsideBoundsDoesNothing {86 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]87 assertWithMatcher:grey_sufficientlyVisible()];88 // Square element rect is {50, 150, 100, 100}89 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]90 performAction:grey_tapAtPoint(CGPointMake(151, 251))];91 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]92 assertWithMatcher:grey_not(grey_text(@"Square Tapped"))];93 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]94 performAction:grey_tapAtPoint(CGPointMake(49, 150))];95 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]96 assertWithMatcher:grey_not(grey_text(@"Square Tapped"))];97 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]98 performAction:grey_tapAtPoint(CGPointMake(50, 149))];99 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]100 assertWithMatcher:grey_not(grey_text(@"Square Tapped"))];101}102- (void)testSquareTappedOutsideWindowBoundsFails {103 [EarlGrey setFailureHandler:[[FTRFailureHandler alloc] init]];104 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]105 assertWithMatcher:grey_sufficientlyVisible()];106 @try {107 // Square element rect is {50, 150, 100, 100}108 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"SquareElementLabel")]109 performAction:grey_tapAtPoint(CGPointMake(-51, -151))];110 GREYFail(@"Should throw an exception");111 } @catch (NSException *exception) {112 NSRange exceptionRange = [[exception reason] rangeOfString:@"Cannot perform tap"];113 GREYAssertNotEqual(exceptionRange.location, NSNotFound, @"should not be equal");114 }115}116- (void)testCircleTappedSuccessfully {117 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CircleElementIdentifier")]118 assertWithMatcher:grey_sufficientlyVisible()];119 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CircleElementIdentifier")]120 performAction:[GREYActions actionForTap]];121 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"AccessibilityElementStatus")]122 assertWithMatcher:grey_text(@"Circle Tapped")];123}...

Full Screen

Full Screen

FTRActionSheetTest.m

Source:FTRActionSheetTest.m Github

copy

Full Screen

...23 [[EarlGrey selectElementWithMatcher:grey_text(@"Cancel")]24 performAction:grey_tap()];25 } else {26 [[EarlGrey selectElementWithMatcher:grey_keyWindow()]27 performAction:grey_tapAtPoint(CGPointMake(50, 50))];28 }29 [[EarlGrey selectElementWithMatcher:grey_text(@"Actions Verified Here")]30 assertWithMatcher:grey_sufficientlyVisible()];31}32- (void)testMultipleActionSheet {33 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"multipleActionSheetButton")]34 performAction:grey_tap()];35 [[EarlGrey selectElementWithMatcher:grey_text(@"Action Sheet")]36 assertWithMatcher:grey_sufficientlyVisible()];37 [[EarlGrey selectElementWithMatcher:grey_text(@"Simple Button")]38 performAction:grey_tap()];39 [[EarlGrey selectElementWithMatcher:grey_text(@"Action Sheet Button Pressed")]40 assertWithMatcher:grey_sufficientlyVisible()];41 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"multipleActionSheetButton")]42 performAction:grey_tap()];43 [[EarlGrey selectElementWithMatcher:grey_text(@"Action Sheet")]44 assertWithMatcher:grey_sufficientlyVisible()];45 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {46 [[EarlGrey selectElementWithMatcher:grey_text(@"Cancel")]47 performAction:grey_tap()];48 } else {49 [[EarlGrey selectElementWithMatcher:grey_keyWindow()]50 performAction:grey_tapAtPoint(CGPointMake(50, 50))];51 }52 [[EarlGrey selectElementWithMatcher:grey_text(@"Actions Verified Here")]53 assertWithMatcher:grey_sufficientlyVisible()];54 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"multipleActionSheetButton")]55 performAction:grey_tap()];56 [[EarlGrey selectElementWithMatcher:grey_text(@"Action Sheet")]57 assertWithMatcher:grey_sufficientlyVisible()];58 [[EarlGrey selectElementWithMatcher:grey_text(@"Hide Button")]59 performAction:grey_tap()];60 [[EarlGrey selectElementWithMatcher:grey_text(@"")]61 assertWithMatcher:grey_sufficientlyVisible()];62 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"multipleActionSheetButton")]63 assertWithMatcher:grey_notVisible()];64}...

Full Screen

Full Screen

GSCXScannerSettingsViewControllerTests.m

Source:GSCXScannerSettingsViewControllerTests.m Github

copy

Full Screen

...36 // If that happens, that element would receive the touch instead of the background, which would37 // not trigger dismissal.38 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(39 kGSCXScannerSettingsTableAccessibilityIdentifier)]40 performAction:grey_tapAtPoint(CGPointZero)];41 [GSCXScannerTestUtils assertSettingsButtonIsInteractable:YES];42}43- (void)testTappingSettingsOutsideBackgroundDismissesSettings {44 [GSCXScannerTestUtils tapSettingsButton];45 [[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_tapAtPoint(CGPointZero)];46 [GSCXScannerTestUtils assertSettingsButtonIsInteractable:YES];47}48@end...

Full Screen

Full Screen

grey_tapAtPoint

Using AI Code Generation

copy

Full Screen

1[[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_tapAtPoint(CGPointMake(100, 100))];2[[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_tapAtPoint(CGPointMake(100, 100))];3[[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_tapAtPoint(CGPointMake(100, 100))];4[[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_tapAtPoint(CGPointMake(100, 100))];5[[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_tapAtPoint(CGPointMake(100, 100))];6[[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_tapAtPoint(CGPointMake(100, 100))];7[[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_tapAtPoint(CGPointMake(100, 100))];

Full Screen

Full Screen

grey_tapAtPoint

Using AI Code Generation

copy

Full Screen

1performAction *action = [[performAction alloc] init];2[action grey_tapAtPoint:grey_pointMake(100, 100)];3- (void)grey_tapAtPoint:(CGPoint)point;4- (void)grey_tapAtPoint:(CGPoint)point {5 GREYPerformBlockInBackground(^{6 [EarlGrey selectElementWithMatcher:grey_accessibilityID(@"button")]7 performAction:grey_tapAtPoint(point)];8 });9}10performAction *action = [[performAction alloc] init];11[action grey_tapAtPoint:grey_pointMake(100, 100)];12- (void)grey_tapAtPoint:(CGPoint)point;13- (void)grey_tapAtPoint:(CGPoint)point {14 GREYPerformBlockInBackground(^{15 [EarlGrey selectElementWithMatcher:grey_accessibilityID(@"button")]16 performAction:grey_tapAtPoint(point)];17 });18}19performAction *action = [[performAction alloc] init];20[action grey_tapAtPoint:grey_pointMake(100, 100)];21- (void

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful