Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: google/EarlGrey
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.2.0
Choose a base ref
...
head repository: google/EarlGrey
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Oct 20, 2018

  1. Use Old Build System

    st3fan authored and tirodkar committed Oct 20, 2018
    Copy the full SHA
    37367f8 View commit details

Commits on Oct 31, 2018

  1. Adding support for WKWebView

    jeromelebel authored and tirodkar committed Oct 31, 2018
    Copy the full SHA
    b1ab378 View commit details

Commits on Dec 21, 2018

  1. Update RVM to 2.3.0 as it's failing to update (#780)

    * Update RVM to 2.3.0 as it's failing to update
    
    https://travis-ci.org/google/EarlGrey/jobs/471151306:
    ```
    Updating rubygems-update
    ERROR:  Error installing rubygems-update:
    	rubygems-update requires Ruby version >= 2.3.0.
    ERROR:  While executing gem ... (NoMethodError)
        undefined method `version' for nil:NilClass
    The command "gem update --system" failed and exited with 1 during .
    ```
    
    * Forgot to update it everywhere.
    
    Also using the most latest stable version 2.5.3
    
    * remove --no-rdoc option as it's unavailable
    
    ```
    $ gem install xcpretty --no-rdoc --no-ri --no-document --quiet
    ERROR:  While executing gem ... (OptionParser::InvalidOption)
        invalid option: --no-rdoc
    The command "gem install xcpretty --no-rdoc --no-ri --no-document --quiet" failed and exited with 1 during .
    ```
    
    * Remove --no-ri option
    khandpur authored and tirodkar committed Dec 21, 2018
    Copy the full SHA
    570908f View commit details

Commits on Dec 22, 2018

  1. Replace call to unavailable initializer with internal initializer (#779)

    * Replace call to unavailable initializer with internal initializer #779
    
    * Update comment
    khandpur authored and wuhao5 committed Dec 22, 2018
    Copy the full SHA
    25fc49c View commit details

Commits on Mar 27, 2019

  1. Fix for EG Accessibility break on 12.2

    tirodkar authored and wuhao5 committed Mar 27, 2019
    Copy the full SHA
    87ffa7a View commit details

Commits on May 13, 2019

  1. Fix compilation under Swift 5

    KirkSpaziani authored and tirodkar committed May 13, 2019
    Copy the full SHA
    79cead1 View commit details

Commits on May 17, 2019

  1. Fix TrustKit swizzling issues in Earl Grey (#710)

    * Fix TrustKit swizzling issues in dataTaskWithRequest:
    
    * There is an issue with EarlGrey swizzling and proxy objects. It surfaces when using TrustKit. The solution is to attempt getting the forwarding target class, if any, or use the actual class of the delegate as before.
    LeoNatan authored and khandpur committed May 17, 2019
    Copy the full SHA
    b15a131 View commit details

Commits on May 18, 2019

  1. Copy the full SHA
    4a544a8 View commit details

Commits on May 29, 2019

  1. Corrected typos in comments, strings, and docs

    Non-comment code changes are limited to:
      * local variable rename in `Scripts/rename-ochamcrestIOS.py`.
      * string value change in `Tests/FunctionalTests/Sources/FTRPinchViewTest.m`
    cbracken authored and tirodkar committed May 29, 2019
    Copy the full SHA
    9a90d21 View commit details

Commits on Jun 5, 2019

  1. Fix further NSURLSession swizzling woes (#840)

    * Fix further NSURLSession swizzling woes
    
    Following #710, a new issue was discovered when Earl Grey is linked together with New Relic. This PR fixes the bug by actually selecting the correct `delegate` object and querying correctly if that object responds to the original selector.
    
    Closes #839
    
    * Style
    
    * More style woes
    LeoNatan authored and khandpur committed Jun 5, 2019
    Copy the full SHA
    e2ef73e View commit details

Commits on Jun 6, 2019

  1. Fix greyswizzled_viewWillAppear for iOS13.

    Justin Cohen authored and khandpur committed Jun 6, 2019
    Copy the full SHA
    e66062b View commit details
  2. Set DidShowContinuousPathIntroduction to dismiss keyboard promo on iO…

    …S13.
    Justin Cohen authored and khandpur committed Jun 6, 2019
    Copy the full SHA
    ec3f715 View commit details

Commits on Oct 30, 2019

  1. Temporary workaround for iOS13 double accessibility id bug.

    Justin Cohen authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    8ae8b20 View commit details
  2. iOS 13 Keyboard key fix.

    Cherry-picked from e86ac63.
    
    PiperOrigin-RevId: 252922617
    tirodkar authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    2210263 View commit details
  3. iOS 13 Keyboard 'letters' key fix.

    Justin Cohen authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    3be0cab View commit details
  4. Use a runtime check when swizzling viewWillAppear.

    The swizzled implementation ignores a specific keyboard-related class,
    and the exact class to ignore changed in iOS 13.  Use a runtime test to
    choose which class to ignore, rather than a compile-time guard.
    
    This fixes EG1 tests when compiling against the iOS 12 SDK but running
    on iOS 13 (or when compiling with the iOS 13 SDK and running on iOS 12).
    rohit-rao authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    a2c16ad View commit details
  5. Update iOS 13 fix for tutorial on iPads

    tirodkar authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    6fed5c1 View commit details
  6. Add docs for 1.16.0 release

    tirodkar authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    5a6f2ec View commit details
  7. Fix steppers

    tirodkar authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    ae67c74 View commit details
  8. Update CHANGELOG with stepper fix.

    tirodkar authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    7c7ecca View commit details
  9. UIWebView deprecation.

    rohit-rao authored and khandpur committed Oct 30, 2019
    Copy the full SHA
    3d51df2 View commit details

Commits on Nov 5, 2019

  1. Add Podspec information for 1.16.0

    tirodkar authored and khandpur committed Nov 5, 2019
    Copy the full SHA
    d1a1b54 View commit details

Commits on Dec 13, 2019

  1. Add link to EarlGrey2

    chan-park authored Dec 13, 2019
    Copy the full SHA
    251b06c View commit details

Commits on Apr 3, 2020

  1. [#1256] - Add quotes to use of PROJECT_DIR variable in the build phas…

    …e that runs the setup-earlgrey.sh script, enabling paths that contain spaces to be valid
    Stephen Barker authored and tirodkar committed Apr 3, 2020
    Copy the full SHA
    935df45 View commit details

Commits on Sep 29, 2020

  1. Update README.md

    tirodkar committed Sep 29, 2020
    Copy the full SHA
    52d1bf2 View commit details

Commits on Oct 23, 2020

  1. Copy the full SHA
    85c8876 View commit details
  2. Copy the full SHA
    3dea313 View commit details

Commits on Aug 31, 2021

  1. Delete travis config.

    jjh committed Aug 31, 2021
    Copy the full SHA
    c3732d1 View commit details

Commits on Sep 9, 2023

  1. Tag -selectElementWithMatcher: with NS_WARN_UNUSED_RESULT

    We often run into a human error, when an element is selected by not asserted on or acted upon. With the unused result attribute, the person writing a test would get a nag that no action was performed on the element.
    sigito authored and tirodkar committed Sep 9, 2023
    Copy the full SHA
    aea2d32 View commit details
Showing with 311 additions and 225 deletions.
  1. +0 −87 .travis.yml
  2. +26 −0 CHANGELOG.md
  3. +4 −2 EarlGrey-Info.plist
  4. +2 −2 EarlGrey.podspec.json
  5. +5 −1 EarlGrey.xcodeproj/project.pbxproj
  6. +8 −0 EarlGrey.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  7. +1 −1 EarlGrey/Action/GREYActions+Internal.h
  8. +5 −5 EarlGrey/Action/GREYActions.h
  9. +60 −16 EarlGrey/Action/GREYActions.m
  10. +10 −15 EarlGrey/Action/GREYChangeStepperAction.m
  11. +1 −1 EarlGrey/Action/GREYPathGestureUtils.m
  12. +14 −6 EarlGrey/Action/GREYScrollAction.m
  13. +14 −7 EarlGrey/Action/GREYScrollToContentEdgeAction.m
  14. +2 −2 EarlGrey/Action/GREYTapAction.h
  15. +3 −0 EarlGrey/Additions/NSObject+GREYAdditions.m
  16. +18 −16 EarlGrey/Additions/NSURLSession+GREYAdditions.m
  17. +9 −5 EarlGrey/Additions/UIViewController+GREYAdditions.m
  18. +4 −0 EarlGrey/Additions/UIWebView+GREYAdditions.h
  19. +4 −0 EarlGrey/Additions/UIWebView+GREYAdditions.m
  20. +2 −2 EarlGrey/Additions/XCTestCase+GREYAdditions.h
  21. +1 −1 EarlGrey/Common/GREYAnalytics.m
  22. +2 −2 EarlGrey/Common/GREYAppleInternals.h
  23. +2 −2 EarlGrey/Common/GREYConfiguration.m
  24. +1 −0 EarlGrey/Common/GREYDefines.h
  25. +1 −1 EarlGrey/Core/EarlGreyImpl.h
  26. +15 −2 EarlGrey/Core/GREYAutomationSetup.m
  27. +11 −2 EarlGrey/Core/GREYElementInteraction.m
  28. +13 −9 EarlGrey/Core/GREYKeyboard.m
  29. +10 −2 EarlGrey/Delegate/GREYCAAnimationDelegate.m
  30. +4 −0 EarlGrey/Delegate/GREYUIWebViewDelegate.h
  31. +4 −0 EarlGrey/Delegate/GREYUIWebViewDelegate.m
  32. +1 −1 EarlGrey/Event/GREYTouchInjector.h
  33. +9 −5 EarlGrey/Event/GREYTouchInjector.m
  34. +1 −1 EarlGrey/Provider/GREYUIWindowProvider.h
  35. +6 −6 EarlGrey/Synchronization/GREYDispatchQueueTracker.m
  36. +2 −2 EarlGrey/Synchronization/GREYRunLoopSpinner.m
  37. +1 −1 EarlGrey/Synchronization/GREYUIThreadExecutor.h
  38. +4 −0 EarlGrey/Synchronization/GREYUIWebViewIdlingResource.h
  39. +4 −0 EarlGrey/Synchronization/GREYUIWebViewIdlingResource.m
  40. +1 −1 EarlGrey/Traversal/GREYTraversalDFS.h
  41. +4 −0 README.md
  42. +2 −2 Scripts/rename-ochamcrestIOS.py
  43. +1 −1 Scripts/travis.sh
  44. +1 −1 Tests/FunctionalTests/Sources/FTRBaseAnalyticsTest.m
  45. +1 −1 Tests/FunctionalTests/Sources/FTRPinchViewTest.m
  46. +1 −1 Tests/FunctionalTests/Sources/FTRUIWebViewTest.m
  47. +1 −1 Tests/FunctionalTests/TestRig/Sources/FTRCollectionViewLayout.m
  48. +2 −2 Tests/FunctionalTests/TestRig/Sources/FTRNetworkProxy.h
  49. +1 −1 Tests/FunctionalTests/TestRig/Sources/FTRNetworkProxy.m
  50. +1 −1 Tests/FunctionalTests/TestRig/Sources/FTRSliderViewController.h
  51. +1 −1 Tests/UnitTests/Sources/CALayer+GREYAdditionsTest.m
  52. +1 −1 Tests/UnitTests/Sources/CGGeometry+GREYAdditionsTest.m
  53. +2 −2 Tests/UnitTests/Sources/NSObject+GREYAdditionsTest.m
  54. +2 −1 docs/backward-compatibility.md
  55. +1 −1 docs/install-and-run.md
  56. +2 −0 docs/versions.md
  57. +1 −1 gem/lib/earlgrey/files/Swift-4.0/EarlGrey.swift
  58. +1 −1 gem/lib/earlgrey/version.rb
87 changes: 0 additions & 87 deletions .travis.yml

This file was deleted.

26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,32 @@

Details changes in each release of EarlGrey. EarlGrey follows [semantic versioning](http://semver.org/).

## [1.16.0](https://github.com/google/EarlGrey/tree/1.16.0) (10/26/2019)
```
Baseline: [09f4abc]
+ [09f4abc]: Fix steppers
```

### Enhancements
* Fixed runtime breakage on iOS 13.

### Compatibility
* EarlGrey has been tested for working till Xcode version 10.1 and Swift 5.

## [1.15.1](https://github.com/google/EarlGrey/tree/1.15.1) (05/17/2019)
```
Baseline: [b15a131]
+ [b15a131]: Fix TrustKit swizzling issues in Earl Grey
```

### Bug Fixes
* Accessibility fix added for device tests on 12.1.
* Fix TrustKit swizzling with proxy delegates for NSURlSession.
* Fixed Swift 5.0 wrappers.

### Compatibility
* EarlGrey has now been tested for working till Xcode version 10.1 and Swift 5.

## [1.15.0](https://github.com/google/EarlGrey/tree/1.15.0) (08/03/2018)
```
Baseline: [59ce3b6c]
6 changes: 4 additions & 2 deletions EarlGrey-Info.plist
Original file line number Diff line number Diff line change
@@ -13,9 +13,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.15.0</string>
<string>1.16.0</string>
<key>CFBundleVersion</key>
<string>1.15.0</string>
<string>1.16.0</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>license</key>
<string>
4 changes: 2 additions & 2 deletions EarlGrey.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "EarlGrey",
"version": "1.15.0",
"version": "1.16.0",
"summary": "iOS UI Automation Test Framework",
"description": "EarlGrey is a native iOS UI automation test framework that enables you to write clear, concise tests.\\n\\nWith the EarlGrey framework, you have access to enhanced synchronization features. EarlGrey automatically synchronizes with the UI, network requests, and various queues, but still allows you to manually implement customized timings, if needed.\\n\\nEarlGrey’s synchronization features help ensure that the UI is in a steady state before actions are performed. This greatly increases test stability and makes tests highly repeatable.\\n\\nEarlGrey works in conjunction with the XCTest framework and integrates with Xcode’s Test Navigator so you can run tests directly from Xcode or the command line (using xcodebuild).",
"homepage": "http://google.github.io/EarlGrey",
@@ -16,7 +16,7 @@
},
"requires_arc": true,
"source": {
"http": "https://www.github.com/google/EarlGrey/releases/download/1.15.0/EarlGrey.zip"
"http": "https://www.github.com/google/EarlGrey/releases/download/1.16.0/EarlGrey.zip"
},
"frameworks": [
"CoreData",
6 changes: 5 additions & 1 deletion EarlGrey.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
02559E992147133F0087CD4F /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02559E982147133F0087CD4F /* WebKit.framework */; };
3F38EF201F20269700EBDFFC /* GREYObjectDeallocationTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F38EF1E1F20269700EBDFFC /* GREYObjectDeallocationTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
3F38EF211F20269700EBDFFC /* GREYObjectDeallocationTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F38EF1F1F20269700EBDFFC /* GREYObjectDeallocationTracker.m */; };
3F5122141EE1D37E0000CC56 /* GREYTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F51220E1EE1D37E0000CC56 /* GREYTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -252,6 +253,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
02559E982147133F0087CD4F /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
3F38EF1E1F20269700EBDFFC /* GREYObjectDeallocationTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GREYObjectDeallocationTracker.h; sourceTree = "<group>"; };
3F38EF1F1F20269700EBDFFC /* GREYObjectDeallocationTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GREYObjectDeallocationTracker.m; sourceTree = "<group>"; };
3F51220E1EE1D37E0000CC56 /* GREYTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GREYTraversal.h; path = EarlGrey/Traversal/GREYTraversal.h; sourceTree = SOURCE_ROOT; };
@@ -497,6 +499,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
02559E992147133F0087CD4F /* WebKit.framework in Frameworks */,
61CBDE801D4CD85200206BF7 /* CoreData.framework in Frameworks */,
FD10025B1C5B473400B2DB0A /* OCHamcrest.framework in Frameworks */,
FD10025A1C5B472C00B2DB0A /* IOKit.framework in Frameworks */,
@@ -527,6 +530,7 @@
FD06C6751BECAE6A009032A5 /* Frameworks */ = {
isa = PBXGroup;
children = (
02559E982147133F0087CD4F /* WebKit.framework */,
61CBDE7F1D4CD85200206BF7 /* CoreData.framework */,
FD1002591C5B472C00B2DB0A /* IOKit.framework */,
FD6160601BF2C97800722593 /* OCHamcrest.framework */,
@@ -1121,7 +1125,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd ${PROJECT_DIR}\n./Scripts/setup-earlgrey.sh";
shellScript = "cd \"${PROJECT_DIR}\"\n./Scripts/setup-earlgrey.sh\n";
};
/* End PBXShellScriptBuildPhase section */

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion EarlGrey/Action/GREYActions+Internal.h
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return @c YES if the action succeeded, else @c NO. If an action returns @c NO, it does not
* mean that the action was not performed at all but somewhere during the action execution
* the error occured and so the UI may be in an unrecoverable state.
* the error occurred and so the UI may be in an unrecoverable state.
*
* @remark This is available only for internal testing purposes.
*/
10 changes: 5 additions & 5 deletions EarlGrey/Action/GREYActions.h
Original file line number Diff line number Diff line change
@@ -317,8 +317,8 @@ NS_ASSUME_NONNULL_BEGIN
*
* @param text The text to be typed. For Objective-C, backspace is supported by using "\b" in the
* string and "\u{8}" in Swift strings. Return key is supported with "\n".
* For Example: @"Helpo\b\bloWorld" will type HelloWorld in Objective-C.
* "Helpo\u{8}\u{8}loWorld" will type HelloWorld in Swift.
* For Example: @code @"Helpo\b\bloWorld" @endcode will type HelloWorld in Objective-C.
* @code "Helpo\u{8}\u{8}loWorld" @endcode will type HelloWorld in Swift.
*
* @return A GREYAction to type a specific text string in a text field.
*/
@@ -368,13 +368,13 @@ NS_ASSUME_NONNULL_BEGIN
+ (id<GREYAction>)actionForSetPickerColumn:(NSInteger)column toValue:(NSString *)value;

/**
* Returns an action that executes JavaScript against a UIWebView and sets the return value to
* @c outResult if provided.
* Returns an action that executes JavaScript against a UIWebView or WKWebView and sets the return
* value to @c outResult if provided.
*
* @param js The Javascript code to be executed.
* @param[out] outResult The result of the code execution.
*
* @return A GREYAction that executes JavaScript code against a UIWebView.
* @return A GREYAction that executes JavaScript code against a UIWebView or WKWebView.
*/
+ (id<GREYAction>)actionForJavaScriptExecution:(NSString *)js
output:(__strong NSString *_Nullable *_Nullable)outResult;
76 changes: 60 additions & 16 deletions EarlGrey/Action/GREYActions.m
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@

#import "Action/GREYActions.h"

#import <WebKit/WebKit.h>

#import "Action/GREYAction.h"
#import "Action/GREYActionBlock.h"
#import "Action/GREYChangeStepperAction.h"
@@ -48,6 +50,8 @@

static Class gWebAccessibilityObjectWrapperClass;
static Class gAccessibilityTextFieldElementClass;
// Timeout for JavaScript execution using WKWebView.
static const CFTimeInterval kJavaScriptTimeoutSeconds = 60;

@implementation GREYActions

@@ -236,8 +240,12 @@ + (void)initialize {
performBlock:^BOOL (id element, __strong NSError **errorOrNil) {
NSString *textStr;
if ([element grey_isWebAccessibilityElement]) {
#if !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
[GREYActions grey_setText:@"" onWebElement:element];
return YES;
#else
return NO;
#endif // !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
} else if ([element isKindOfClass:gAccessibilityTextFieldElementClass]) {
element = [element textField];
} else if ([element respondsToSelector:@selector(text)]) {
@@ -292,22 +300,54 @@ + (void)initialize {
+ (id<GREYAction>)actionForJavaScriptExecution:(NSString *)js
output:(__strong NSString **)outResult {
// TODO: JS Errors should be propagated up.
id<GREYMatcher> constraints = grey_allOf(grey_not(grey_systemAlertViewShown()),
grey_kindOfClass([UIWebView class]),
nil);
id<GREYMatcher> constraints =
grey_allOf(grey_not(grey_systemAlertViewShown()),
#if !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
grey_anyOf(
grey_kindOfClass([UIWebView class]),
grey_kindOfClass([WKWebView class]), nil),
#else
grey_kindOfClass([WKWebView class]),
#endif // !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
nil);
BOOL (^performBlock)(id webView, __strong NSError **errorOrNil) = ^(
id webView, __strong NSError **errorOrNil) {
if ([webView isKindOfClass:[WKWebView class]]) {
WKWebView *wkWebView = webView;
__block NSString *resultString = nil;
__block BOOL completionDone = NO;
[wkWebView evaluateJavaScript:js
completionHandler:^(id result, NSError *error) {
resultString = [result description];
completionDone = YES;
}];
NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:kJavaScriptTimeoutSeconds];
while (!completionDone && timeoutDate.timeIntervalSinceNow > 0) {
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
}
if (completionDone && outResult) {
*outResult = resultString;
}
return completionDone;
}
#if !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
else if ([webView isKindOfClass:[UIWebView class]]) {
UIWebView *uiWebView = webView;
if (outResult) {
*outResult = [uiWebView stringByEvaluatingJavaScriptFromString:js];
} else {
[uiWebView stringByEvaluatingJavaScriptFromString:js];
}
// TODO: Delay should be removed once webview sync is stable.
[[GREYUIThreadExecutor sharedInstance] drainForTime:0.5]; // Wait for actions to register.
return YES;
}
#endif // !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
return NO;
};
return [[GREYActionBlock alloc] initWithName:@"Execute JavaScript"
constraints:constraints
performBlock:^BOOL (UIWebView *webView,
__strong NSError **errorOrNil) {
if (outResult) {
*outResult = [webView stringByEvaluatingJavaScriptFromString:js];
} else {
[webView stringByEvaluatingJavaScriptFromString:js];
}
// TODO: Delay should be removed once webview sync is stable.
[[GREYUIThreadExecutor sharedInstance] drainForTime:0.5]; // Wait for actions to register.
return YES;
}];
performBlock:performBlock];
}

+ (id<GREYAction>)actionForSnapshot:(__strong UIImage **)outImage {
@@ -332,6 +372,7 @@ + (void)initialize {

#pragma mark - Private

#if !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
/**
* Sets WebView input text value.
*
@@ -360,6 +401,7 @@ + (void)grey_setText:(NSString *)text onWebElement:(id)element {
UIWebView *parentWebView = (UIWebView *)[element grey_viewContainingSelf];
[parentWebView stringByEvaluatingJavaScriptFromString:jsForTitle];
}
#endif // !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0

/**
* Set the UITextField text value directly, bypassing the iOS keyboard.
@@ -368,7 +410,7 @@ + (void)grey_setText:(NSString *)text onWebElement:(id)element {
*
* @return @c YES if the action succeeded, else @c NO. If an action returns @c NO, it does not
* mean that the action was not performed at all but somewhere during the action execution
* the error occured and so the UI may be in an unrecoverable state.
* the error occurred and so the UI may be in an unrecoverable state.
*/
+ (id<GREYAction>)grey_actionForReplaceText:(NSString *)text {
SEL setTextSelector = NSSelectorFromString(@"setText:");
@@ -382,7 +424,9 @@ + (void)grey_setText:(NSString *)text onWebElement:(id)element {
constraints:constraints
performBlock:^BOOL (id element, __strong NSError **errorOrNil) {
if ([element grey_isWebAccessibilityElement]) {
#if !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
[GREYActions grey_setText:text onWebElement:element];
#endif // !defined(__IPHONE_12_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_12_0
} else {
if ([element isKindOfClass:gAccessibilityTextFieldElementClass]) {
element = [element textField];
@@ -446,7 +490,7 @@ + (void)grey_setText:(NSString *)text onWebElement:(id)element {
*
* @return @c YES if the action succeeded, else @c NO. If an action returns @c NO, it does not
* mean that the action was not performed at all but somewhere during the action execution
* the error occured and so the UI may be in an unrecoverable state.
* the error occurred and so the UI may be in an unrecoverable state.
*/
+ (BOOL)grey_disableAutoCorrectForDelegateAndTypeText:(NSString *)text
inFirstResponder:(id)firstResponder
Loading