How to use grey_typeText method of performAction class

Best EarlGrey code snippet using performAction.grey_typeText

KeyboardKeysTest.m

Source:KeyboardKeysTest.m Github

copy

Full Screen

...191- (void)testReturnKey {192 NSString *kbViewClassName = @"UIKeyboardImpl";193 NSString *textFieldString = @"and\n";194 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]195 performAction:grey_typeText(textFieldString)] assertWithMatcher:grey_text(@"and")];196 [[EarlGrey selectElementWithMatcher:grey_kindOfClassName(kbViewClassName)]197 assertWithMatcher:grey_nil()];198 NSString *string = @"and\nand";199 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextView")]200 performAction:grey_typeText(string)] assertWithMatcher:grey_text(@"and\nand")];201 [[EarlGrey selectElementWithMatcher:grey_kindOfClassName(kbViewClassName)]202 assertWithMatcher:grey_notNil()];203}204- (void)testAllReturnKeyTypes {205 NSString *kbViewClassName = @"UIKeyboardImpl";206 // There are 11 returnKeyTypes; test all of them.207 for (int i = 0; i < 11; i++) {208 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]209 performAction:grey_typeText(@"a\n")] assertWithMatcher:grey_text(@"a")];210 [[EarlGrey selectElementWithMatcher:grey_kindOfClassName(kbViewClassName)]211 assertWithMatcher:grey_nil()];212 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]213 performAction:grey_typeText(@"*\n")] assertWithMatcher:grey_text(@"a*")];214 [[EarlGrey selectElementWithMatcher:grey_kindOfClassName(kbViewClassName)]215 assertWithMatcher:grey_nil()];216 [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"next returnKeyType")]217 performAction:grey_tap()];218 }219}220- (void)testPanelNavigation {221 NSString *string = @"a1a%a%1%";222 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]223 performAction:grey_typeText(string)];224}225- (void)testKeyplaneIsDetectedCorrectlyWhenSwitchingTextFields {226 NSString *string = @"$";227 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]228 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];229 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextView")]230 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];231}232- (void)testUIKeyboardTypeDefault {233 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]234 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"Default"]];235 NSString *string = @":$a8. {T<b@CC";236 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]237 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];238}239- (void)testUIKeyboardTypeASCIICapable {240 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]241 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"ASCIICapable"]];242 NSString *string = @":$a8. {T<b@CC";243 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]244 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];245}246- (void)testUIKeyboardTypeNumbersAndPunctuation {247 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]248 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"NumbersAndPunctuation"]];249 NSString *string = @":$a8. {T<b@CC";250 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]251 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];252}253- (void)testUIKeyboardTypeURL {254 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]255 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"URL"]];256 NSString *string = @"http://www.google.com/@*s$&T+t?[]#testLabel%foo;";257 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]258 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];259}260- (void)testUIKeyboardTypeNumberPad {261 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]262 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"NumberPad"]];263 NSString *string = @"\b0123456\b789\b\b";264 NSString *verificationString = @"0123457";265 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]266 performAction:grey_typeText(string)] assertWithMatcher:grey_text(verificationString)];267}268- (void)testUIKeyboardTypePhonePad {269 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]270 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"PhonePad"]];271 NSString *string = @"01*23\b\b+45#67,89;";272 NSString *verificationString = @"01*+45#67,89;";273 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]274 performAction:grey_typeText(string)] assertWithMatcher:grey_text(verificationString)];275}276- (void)testUIKeyboardTypeEmailAddress {277 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]278 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"EmailAddress"]];279 NSString *string = @"l0rem.ipsum+42@google.com#$_T*-";280 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]281 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];282}283- (void)testUIKeyboardTypeDecimalPad {284 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]285 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"DecimalPad"]];286 NSString *string = @"\b0123.456\b78..9\b\b";287 NSString *verificationString = @"0123.4578.";288 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]289 performAction:grey_typeText(string)] assertWithMatcher:grey_text(verificationString)];290}291- (void)testUIKeyboardTypeTwitter {292 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]293 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"Twitter"]];294 NSString *string = @"@earlgrey Your framework is #awesome!!!1$:,eG%g\n";295 NSString *verificationString = @"@earlgrey Your framework is #awesome!!!1$:,eG%g";296 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]297 performAction:grey_typeText(string)] assertWithMatcher:grey_text(verificationString)];298}299- (void)testUIKeyboardTypeWebSearch {300 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]301 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"WebSearch"]];302 NSString *string = @":$a8. {T<b@CC";303 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]304 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];305}306- (void)testTypingOnLandscapeLeft {307 [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeLeft error:nil];308 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]309 performAction:grey_typeText(@"Cat")] assertWithMatcher:grey_text(@"Cat")];310}311- (void)testTypingOnLandscapeRight {312 [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeRight error:nil];313 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]314 performAction:grey_typeText(@"Cat")] assertWithMatcher:grey_text(@"Cat")];315}316- (void)testSuccessivelyTypingInTheSameTextField {317 [[[[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]318 performAction:grey_typeText(@"This ")] performAction:grey_typeText(@"Is A ")]319 performAction:grey_typeText(@"Test")] assertWithMatcher:grey_text(@"This Is A Test")];320}321- (void)testTypingBlankString {322 NSString *string = @" ";323 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]324 performAction:grey_typeText(string)] assertWithMatcher:grey_text(string)];325}326- (void)testClearAfterTypingInCustomTextView {327 [[[[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CustomTextView")]328 performAction:[GREYActions actionForTypeText:@"Foo"]]329 assertWithMatcher:grey_accessibilityLabel(@"Foo")]330 performAction:[GREYActions actionForClearText]]331 assertWithMatcher:grey_accessibilityLabel(@"")];332}333- (void)testClearAfterClearingInCustomTextView {334 [[[[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CustomTextView")]335 performAction:[GREYActions actionForClearText]]336 assertWithMatcher:grey_accessibilityLabel(@"")]337 performAction:[GREYActions actionForClearText]]338 assertWithMatcher:grey_accessibilityLabel(@"")];339}340- (void)testTypeAfterClearingInCustomTextView {341 [[[[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CustomTextView")]342 performAction:[GREYActions actionForClearText]]343 assertWithMatcher:grey_accessibilityLabel(@"")]344 performAction:[GREYActions actionForTypeText:@"Foo"]]345 assertWithMatcher:grey_accessibilityLabel(@"Foo")];346}347- (void)testTypingOnTextFieldInUIInputAccessory {348 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Input Button")]349 performAction:grey_tap()];350 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"InputAccessoryTextField")]351 performAction:grey_typeText(@"Test")] assertWithMatcher:grey_text(@"Test")];352}353- (void)testClearAndReplaceWorksWithUIAccessibilityTextFieldElement {354 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Input Button")]355 performAction:grey_tap()];356 NSString *accessibilityTextFieldElemClassName = @"UIAccessibilityTextFieldElement";357 id<GREYMatcher> elementMatcher =358 grey_allOf(grey_accessibilityValue(@"Text Field"),359 grey_kindOfClassName(accessibilityTextFieldElemClassName), nil);360 [[[EarlGrey selectElementWithMatcher:elementMatcher] performAction:grey_clearText()]361 performAction:grey_replaceText(@"foo")];362 [[EarlGrey selectElementWithMatcher:grey_textFieldValue(@"foo")] assertWithMatcher:grey_notNil()];363}364- (void)testTypingAndResigningOfFirstResponder {365 GREYAssertFalse([GREYKeyboard keyboardShownWithError:nil], @"Keyboard shouldn't be shown");366 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]367 performAction:[GREYActions actionForTypeText:@"Foo"]] assertWithMatcher:grey_text(@"Foo")];368 GREYAssertTrue([GREYKeyboard keyboardShownWithError:nil], @"Keyboard shouldn't be shown");369 XCTAssertTrue([EarlGrey dismissKeyboardWithError:nil]);370 GREYAssertFalse([GREYKeyboard keyboardShownWithError:nil],371 @"Keyboard shouldn't be shown as it is resigned");372 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]373 performAction:[GREYActions actionForTypeText:@"Foo"]] assertWithMatcher:grey_text(@"FooFoo")];374 GREYAssertTrue([GREYKeyboard keyboardShownWithError:nil], @"Keyboard shouldn't be shown");375}376- (void)testTogglingShiftByChangingCase {377 NSString *multiCaseString = @"aA1a1A1aA1AaAa1A1a";378 for (NSUInteger i = 0; i < multiCaseString.length; i++) {379 NSString *currentCharacter = [multiCaseString substringWithRange:NSMakeRange(i, 1)];380 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]381 performAction:grey_typeText(currentCharacter)]382 assertWithMatcher:grey_text([multiCaseString substringToIndex:i + 1])];383 id keyboardClass = GREY_REMOTE_CLASS_IN_APP(GREYKeyboard);384 for (NSString *axLabel in [[keyboardClass returnByValue] shiftKeyLabels]) {385 NSError *error;386 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(axLabel)] performAction:grey_tap()387 error:&error];388 }389 }390 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]391 assertWithMatcher:grey_text(multiCaseString)];392}393- (void)testIsKeyboardShownWithCustomKeyboardTracker {394 GREYAssertFalse([GREYKeyboard keyboardShownWithError:nil], @"Keyboard shouldn't be shown");395 GREYHostApplicationDistantObject *host = GREYHostApplicationDistantObject.sharedInstance;396 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CustomKeyboardTracker")]397 performAction:host.actionForSetFirstResponder];398 GREYAssertFalse([GREYKeyboard keyboardShownWithError:nil], @"Keyboard shouldn't be shown");399}400- (void)testTypingAndResigningWithError {401 GREYAssertFalse([GREYKeyboard keyboardShownWithError:nil], @"Keyboard shouldn't be shown");402 GREYHostApplicationDistantObject *host = GREYHostApplicationDistantObject.sharedInstance;403 NSError *error;404 XCTAssertFalse([EarlGrey dismissKeyboardWithError:&error]);405 NSString *localizedErrorDescription = [error localizedDescription];406 GREYAssertTrue(407 [localizedErrorDescription hasPrefix:@"Failed to dismiss keyboard since it was not showing."],408 @"Unexpected error message for initial dismiss: %@, original error: %@",409 localizedErrorDescription, error);410 [[EarlGrey selectElementWithMatcher:grey_keyWindow()]411 performAction:host.actionForSetFirstResponder412 error:&error];413 XCTAssertFalse([EarlGrey dismissKeyboardWithError:&error]);414 localizedErrorDescription = [error localizedDescription];415 GREYAssertTrue(416 [localizedErrorDescription hasPrefix:@"Failed to dismiss keyboard since it was not showing."],417 @"Unexpected error message for second dismiss: %@, original error: %@",418 localizedErrorDescription, error);419}420- (void)testDismissingKeyboardWhenReturnIsNotPresent {421 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]422 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"PhonePad"]];423 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]424 performAction:grey_tap()];425 XCTAssertTrue([EarlGrey dismissKeyboardWithError:nil]);426}427- (void)testDismissingKeyboardWhenReturnIsPresentButDoesNotDismissTheKeyboard {428 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"CustomTextView")]429 performAction:grey_tap()];430 NSError *error;431 XCTAssertTrue([EarlGrey dismissKeyboardWithError:&error]);432 XCTAssertNil(error);433 GREYAssertFalse([GREYKeyboard keyboardShownWithError:nil], @"Keyboard shouldn't be shown");434}435#pragma mark - Private436- (void)ftr_typeString:(NSString *)string andVerifyOutput:(NSString *)verificationString {437 [[[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]438 performAction:grey_typeText(string)] performAction:grey_typeText(@"\n")]439 assertWithMatcher:grey_text(verificationString)];440 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextView")]441 performAction:grey_typeText(string)] assertWithMatcher:grey_text(verificationString)];442 [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Done")] performAction:grey_tap()];443}444@end...

Full Screen

Full Screen

FTRKeyboardKeysTest.m

Source:FTRKeyboardKeysTest.m Github

copy

Full Screen

...174- (void)testReturnKey {175 Class kbViewClass = NSClassFromString(@"UIKeyboardImpl");176 NSString *textFieldString = @"and\n";177 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]178 performAction:grey_typeText(textFieldString)]179 assertWithMatcher:grey_text(@"and")];180 [[EarlGrey selectElementWithMatcher:grey_kindOfClass(kbViewClass)] assertWithMatcher:grey_nil()];181 NSString *string = @"and\nand";182 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextView")]183 performAction:grey_typeText(string)]184 assertWithMatcher:grey_text(@"and\nand")];185 [[EarlGrey selectElementWithMatcher:grey_kindOfClass(kbViewClass)]186 assertWithMatcher:grey_notNil()];187}188- (void)testAllReturnKeyTypes {189 Class kbViewClass = NSClassFromString(@"UIKeyboardImpl");190 // There are 11 returnKeyTypes; test all of them.191 for (int i = 0; i < 11; i++) {192 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]193 performAction:grey_typeText(@"a\n")]194 assertWithMatcher:grey_text(@"a")];195 [[EarlGrey selectElementWithMatcher:grey_kindOfClass(kbViewClass)]196 assertWithMatcher:grey_nil()];197 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]198 performAction:grey_typeText(@"*\n")]199 assertWithMatcher:grey_text(@"a*")];200 [[EarlGrey selectElementWithMatcher:grey_kindOfClass(kbViewClass)]201 assertWithMatcher:grey_nil()];202 [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"next returnKeyType")]203 performAction:grey_tap()];204 }205}206- (void)testPanelNavigation {207 NSString *string = @"a1a%a%1%";208 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]209 performAction:grey_typeText(string)];210}211- (void)typeString:(NSString *)string andVerifyOutput:(NSString *)verificationString {212 [[[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]213 performAction:grey_typeText(string)]214 performAction:grey_typeText(@"\n")]215 assertWithMatcher:grey_text(verificationString)];216 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextView")]217 performAction:grey_typeText(string)]218 assertWithMatcher:grey_text(verificationString)];219 [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Done")]220 performAction:grey_tap()];221}222- (void)testKeyplaneIsDetectedCorrectlyWhenSwitchingTextFields {223 NSString *string = @"$";224 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]225 performAction:grey_typeText(string)]226 assertWithMatcher:grey_text(string)];227 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextView")]228 performAction:grey_typeText(string)]229 assertWithMatcher:grey_text(string)];230}231- (void)testUIKeyboardTypeDefault {232 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]233 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"Default"]];234 NSString *string = @":$a8. {T<b@CC";235 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]236 performAction:grey_typeText(string)]237 assertWithMatcher:grey_text(string)];238}239- (void)testUIKeyboardTypeASCIICapable {240 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]241 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"ASCIICapable"]];242 NSString *string = @":$a8. {T<b@CC";243 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]244 performAction:grey_typeText(string)]245 assertWithMatcher:grey_text(string)];246}247- (void)testUIKeyboardTypeNumbersAndPunctuation {248 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]249 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"NumbersAndPunctuation"]];250 NSString *string = @":$a8. {T<b@CC";251 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]252 performAction:grey_typeText(string)]253 assertWithMatcher:grey_text(string)];254}255- (void)testUIKeyboardTypeURL {256 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]257 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"URL"]];258 NSString *string = @"http://www.google.com/@*s$&T+t?[]#testLabel%foo;";259 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]260 performAction:grey_typeText(string)]261 assertWithMatcher:grey_text(string)];262}263- (void)testUIKeyboardTypeNumberPad {264 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]265 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"NumberPad"]];266 NSString *string = @"\b0123456\b789\b\b";267 NSString *verificationString = @"0123457";268 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]269 performAction:grey_typeText(string)]270 assertWithMatcher:grey_text(verificationString)];271}272- (void)testUIKeyboardTypePhonePad {273 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]274 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"PhonePad"]];275 NSString *string = @"01*23\b\b+45#67,89;";276 NSString *verificationString = @"01*+45#67,89;";277 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]278 performAction:grey_typeText(string)]279 assertWithMatcher:grey_text(verificationString)];280}281- (void)testUIKeyboardTypeEmailAddress {282 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]283 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"EmailAddress"]];284 NSString *string = @"l0rem.ipsum+42@google.com#$_T*-";285 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]286 performAction:grey_typeText(string)]287 assertWithMatcher:grey_text(string)];288}289- (void)testUIKeyboardTypeDecimalPad {290 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]291 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"DecimalPad"]];292 NSString *string = @"\b0123.456\b78..9\b\b";293 NSString *verificationString = @"0123.4578.";294 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]295 performAction:grey_typeText(string)]296 assertWithMatcher:grey_text(verificationString)];297}298- (void)testUIKeyboardTypeTwitter {299 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]300 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"Twitter"]];301 NSString *string = @"@earlgrey Your framework is #awesome!!!1$:,eG%g\n";302 NSString *verificationString = @"@earlgrey Your framework is #awesome!!!1$:,eG%g";303 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]304 performAction:grey_typeText(string)]305 assertWithMatcher:grey_text(verificationString)];306}307- (void)testUIKeyboardTypeWebSearch {308 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"KeyboardPicker")]309 performAction:[GREYActions actionForSetPickerColumn:0 toValue:@"WebSearch"]];310 NSString *string = @":$a8. {T<b@CC";311 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]312 performAction:grey_typeText(string)]313 assertWithMatcher:grey_text(string)];314}315- (void)testTypingOnLandscapeLeft {316 [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeLeft errorOrNil:nil];317 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]318 performAction:grey_typeText(@"Cat")]319 assertWithMatcher:grey_text(@"Cat")];320}321- (void)testTypingOnLandscapeRight {322 [EarlGrey rotateDeviceToOrientation:UIDeviceOrientationLandscapeRight errorOrNil:nil];323 [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]324 performAction:grey_typeText(@"Cat")]325 assertWithMatcher:grey_text(@"Cat")];326}327- (void)testTogglingShiftByChangingCase {328 NSString *multiCaseString = @"aA1a1A1aA1AaAa1A1a";329 id<GREYAction> action =330 [GREYActionBlock actionWithName:@"ToggleShift"331 performBlock:^(id element, __strong NSError **errorOrNil) {332 NSArray *shiftAXLabels = @[@"shift", @"more, symbols"];333 for (NSString *axLabel in shiftAXLabels) {334 NSError *error;335 [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(axLabel)]336 performAction:grey_tap()337 error:&error];338 }339 return YES;340 }];341 for (NSUInteger i = 0; i < multiCaseString.length; i++) {342 NSString *currentCharacter = [multiCaseString substringWithRange:NSMakeRange(i, 1)];343 [[[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]344 performAction:grey_typeText(currentCharacter)]345 performAction:action]346 assertWithMatcher:grey_text([multiCaseString substringToIndex:i + 1])];347 }348 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"TypingTextField")]349 assertWithMatcher:grey_text(multiCaseString)];350}351#pragma mark - Private352// Helper action that converts numeric position to UITextPosition.353- (id<GREYAction>)grey_actionForTypingText:(NSString *)text atPosition:(NSInteger)position {354 NSString *actionName =355 [NSString stringWithFormat:@"Test type \"%@\" at position %ld", text, (long)position];356 return [GREYActionBlock actionWithName:actionName357 constraints:grey_not(grey_systemAlertViewShown())358 performBlock:^BOOL (id element, __strong NSError **errorOrNil) {...

Full Screen

Full Screen

CreateAccountPage.m

Source:CreateAccountPage.m Github

copy

Full Screen

...16static NSString *const createAccountButton = @"RMBAutomationProfileButtonSubmit";17static NSString *const birthDateField = @"RMBAutomationProfileDropdownDateOfBirth";18- (StarRewardsPage *) createAccountForUser: (User *) user {19 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(nameField)] performAction:grey_clearText()];20 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(nameField)] performAction:grey_typeText(user.name)];21 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(surnameField)] performAction:grey_clearText()];22 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(surnameField)] performAction:grey_typeText(user.surname)];23 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(emailField)] performAction:grey_clearText()];24 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(emailField)] performAction:grey_typeText(user.email)];25 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(password)] performAction:grey_clearText()];26 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(password)] performAction:grey_typeText(user.password)];27 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"RMBAutomationKeyboardControlsDone")] performAction:grey_tap()];28 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(birthDateField)] performAction:grey_tap()];29 30 XCUIApplication *application = [[XCUIApplication alloc] init];31 [[application.pickerWheels elementBoundByIndex:0] adjustToPickerWheelValue:@"March"];32 [[application.pickerWheels elementBoundByIndex:1] adjustToPickerWheelValue:@"4"];33 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"RMBAutomationKeyboardControlsDone")] performAction:grey_tap()];34 35 [application swipeUp];36 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(createAccountButton)] performAction:grey_tap()];37 return [[StarRewardsPage alloc] init];38}39@end...

Full Screen

Full Screen

FIRAuthE2eTests.m

Source:FIRAuthE2eTests.m Github

copy

Full Screen

...28 grey_allOf(grey_kindOfClass([UILabel class]), grey_accessibilityLabel(@"OK"), nil);29 [[EarlGrey selectElementWithMatcher:30#warning TODO Add accessibilityIdentifiers for the elements.31 grey_kindOfClass(NSClassFromString(@"_UIAlertControllerView"))]32 performAction:grey_typeText(email)];33 [[EarlGrey selectElementWithMatcher:comfirmationButtonMatcher] performAction:grey_tap()];34 [[EarlGrey35 selectElementWithMatcher:grey_kindOfClass(NSClassFromString(@"_UIAlertControllerView"))]36 performAction:grey_typeText(@"password")];37 [[EarlGrey selectElementWithMatcher:comfirmationButtonMatcher] performAction:grey_tap()];38 [[[EarlGrey39 selectElementWithMatcher:grey_allOf(grey_text(email), grey_sufficientlyVisible(), nil)]40 usingSearchAction:grey_scrollInDirection(kGREYDirectionUp, kShortScrollDistance)41 onElementWithMatcher:grey_allOf(grey_scrollView(), grey_kindOfClass([UITableView class]),42 nil)] assertWithMatcher:grey_sufficientlyVisible()];43}44@end...

Full Screen

Full Screen

grey_typeText

Using AI Code Generation

copy

Full Screen

1 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"username")] performAction:grey_typeText(@"test")];2 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"password")] performAction:grey_typeText(@"test")];3 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"login")] performAction:grey_tap()];4 [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"logout")] performAction:grey_tap()];5 EarlGrey.selectElement(with: grey_accessibilityID("username")).perform(grey_typeText("test"))6 EarlGrey.selectElement(with: grey_accessibilityID("password")).perform(grey_typeText("test"))7 EarlGrey.selectElement(with: grey_accessibilityID("login")).perform(grey_tap())8 EarlGrey.selectElement(with: grey_accessibilityID("logout")).perform(grey_tap())9 EarlGrey.selectElement(with: grey_accessibilityID("username")).perform(grey_typeText("test"))10 EarlGrey.selectElement(with: grey_accessibilityID("password")).perform(grey_typeText("test"))11 EarlGrey.selectElement(with: grey_accessibilityID("login")).perform(grey_tap())12 EarlGrey.selectElement(with: grey_accessibilityID("logout")).perform(grey_tap())13 EarlGrey.selectElement(with: grey_accessibilityID("username")).perform(grey_typeText("test"))14 EarlGrey.selectElement(with: grey_accessibilityID("password")).perform(grey_typeText("test"))15 EarlGrey.selectElement(with: grey_accessibilityID("login")).perform(grey_tap())16 EarlGrey.selectElement(with: grey_accessibilityID("logout")).perform(grey_tap())17 EarlGrey.selectElement(with: grey_accessibilityID("username")).perform(grey_typeText("test"))18 EarlGrey.selectElement(with: grey_accessibilityID("password")).perform(grey_typeText("test"))

Full Screen

Full Screen

grey_typeText

Using AI Code Generation

copy

Full Screen

1- (void) grey_typeText:(NSString *)text;2- (void) grey_typeText:(NSString *)text{3 NSLog(@"GREY typeText: %@", text);4}5- (void) grey_typeText:(NSString *)text{6 NSLog(@"GREY typeText: %@", text);7}8- (void) grey_typeText:(NSString *)text{9 NSLog(@"GREY typeText: %@", text);10}11- (void) grey_typeText:(NSString *)text{12 NSLog(@"GREY typeText: %@", text);13}14- (void) grey_typeText:(NSString *)text{15 NSLog(@"GREY typeText: %@", text);16}17- (void) grey_typeText:(NSString *)text{18 NSLog(@"GREY typeText: %@", text);19}20- (void) grey_typeText:(NSString *)text{21 NSLog(@"GREY typeText: %@", text);22}

Full Screen

Full Screen

grey_typeText

Using AI Code Generation

copy

Full Screen

1NSString *text = @"Hello World";2GREYElementInteraction *interaction = grey_typeText(text);3interaction.performAction;4GREYElementInteraction *interaction = grey_clearText();5interaction.performAction;6NSString *text = @"Hello World";7GREYElementInteraction *interaction = grey_replaceText(text);8interaction.performAction;9GREYDirection direction = kGREYDirectionUp;10GREYElementInteraction *interaction = grey_scrollInDirection(direction);11interaction.performAction;12GREYContentEdge contentEdge = kGREYContentEdgeTop;13GREYElementInteraction *interaction = grey_scrollToContentEdge(contentEdge);14interaction.performAction;15GREYDirection direction = kGREYDirectionUp;16GREYElementInteraction *interaction = grey_swipeFastInDirection(direction);17interaction.performAction;18GREYDirection direction = kGREYDirectionUp;19GREYElementInteraction *interaction = grey_swipeSlowInDirection(direction);20interaction.performAction;21CGFloat duration = 1.0;22GREYElementInteraction *interaction = grey_longPressWithDuration(duration);23interaction.performAction;24GREYPinchDirection direction = kGREYPinchDirectionOutward;25GREYElementInteraction *interaction = grey_pinchFastInDirection(direction);26interaction.performAction;27GREYPinchDirection direction = kGREYPinchDirectionOutward;28GREYElementInteraction *interaction = grey_pinchSlowInDirection(direction);29interaction.performAction;

Full Screen

Full Screen

grey_typeText

Using AI Code Generation

copy

Full Screen

1var performAction = UIATarget.localTarget().frontMostApp().performAction;2performAction("grey_typeText:", "Test");3performAction("grey_clearText");4performAction("grey_replaceText:", "Test");5performAction("grey_scrollToContentEdge:", 1);6performAction("grey_scrollInDirection:", 1);7performAction("grey_scrollToContentEdge:", 1);8performAction("grey_scrollInDirection:", 1);9performAction("grey_tapAtPoint:", {x: 100, y: 100});10performAction("grey_tap");11performAction("grey_doubleTap");12performAction("grey_longPressWithDuration:", 1);13performAction("grey_pinchFastInDirection:", 1);14performAction("grey_flickFastInDirection:", 1);15performAction("grey_flickSlowInDirection:", 1);16performAction("grey_swipeFastInDirection:", 1);17performAction("grey_swipeSlowInDirection:", 1);18performAction("grey_swipeFastInDirection:", 1);19performAction("grey_swipeSlowInDirection:", 1);

Full Screen

Full Screen

grey_typeText

Using AI Code Generation

copy

Full Screen

1NSString *text = @"Hello World";2[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"TextField")]3performAction:grey_typeText(text)];4NSString *text = @"Hello World";5[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"TextField")]6performAction:grey_typeText(text)];7EarlGrey.selectElement(with: grey_accessibilityLabel("TextField"))8.perform(grey_typeText(text))9EarlGrey.selectElement(with: grey_accessibilityLabel("TextField"))10.perform(grey_typeText(text))11EarlGrey.selectElement(with: grey_accessibilityLabel("TextField"))12.perform(grey_typeText(text))13EarlGrey.selectElement(with: grey_accessibilityLabel("TextField"))14.perform(grey_typeText(text))15EarlGrey.selectElement(with: grey_accessibilityLabel("TextField"))16.perform(grey_typeText(text))17EarlGrey.selectElement(with: grey_accessibilityLabel("TextField"))18.perform(grey_typeText(text))19EarlGrey.selectElement(with: grey_accessibilityLabel("TextField"))20.perform(grey_typeText(text))

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