@@ -141,6 +141,7 @@ task:
|
||||
- tests-macos
|
||||
- tool_tests-macos
|
||||
- build_tests-macos
|
||||
- add2app-macos
|
||||
env:
|
||||
# Name the SDK directory to include a space so that we constantly
|
||||
# test path names with spaces in them.
|
||||
@@ -168,11 +169,12 @@ task:
|
||||
task:
|
||||
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
|
||||
osx_instance:
|
||||
image: high-sierra-xcode-9.4.1
|
||||
image: mojave-xcode-10.1
|
||||
depends_on:
|
||||
- analyze
|
||||
env:
|
||||
CIRRUS_WORKING_DIR: "/tmp/flutter sdk"
|
||||
COCOAPODS_DISABLE_STATS: true
|
||||
install_cocoapods_script:
|
||||
- sudo gem install cocoapods
|
||||
git_fetch_script:
|
||||
@@ -208,7 +210,9 @@ task:
|
||||
container:
|
||||
cpu: 4
|
||||
memory: 12G
|
||||
|
||||
- name: add2app-macos
|
||||
env:
|
||||
SHARD: add2app_test
|
||||
|
||||
docker_builder:
|
||||
# Only build a new docker image when we tag a release (for dev, beta, or release.)
|
||||
|
||||
@@ -23,6 +23,7 @@ const Map<String, ShardRunner> _kShards = <String, ShardRunner>{
|
||||
'tool_tests': _runToolTests,
|
||||
'build_tests': _runBuildTests,
|
||||
'coverage': _runCoverage,
|
||||
'add2app_test': _runAdd2AppTest,
|
||||
};
|
||||
|
||||
const Duration _kLongTimeout = Duration(minutes: 45);
|
||||
@@ -236,6 +237,21 @@ Future<void> _flutterBuildIpa(String relativePathToApplication) async {
|
||||
print('Done.');
|
||||
}
|
||||
|
||||
Future<void> _runAdd2AppTest() async {
|
||||
if (!Platform.isMacOS) {
|
||||
return;
|
||||
}
|
||||
print('Running Add2App iOS integration tests...');
|
||||
final String add2AppDir = path.join(flutterRoot, 'dev', 'integration_tests', 'ios_add2app');
|
||||
await runCommand('./build_and_test.sh',
|
||||
<String>[],
|
||||
workingDirectory: add2AppDir,
|
||||
expectNonZeroExit: false,
|
||||
timeout: _kShortTimeout,
|
||||
);
|
||||
print('Done.');
|
||||
}
|
||||
|
||||
Future<void> _runTests() async {
|
||||
await _runSmokeTests();
|
||||
|
||||
|
||||
68
dev/integration_tests/ios_add2app/.gitignore
vendored
Normal file
68
dev/integration_tests/ios_add2app/.gitignore
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
.DS_Store
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata/
|
||||
|
||||
## Other
|
||||
*.moved-aside
|
||||
*.xccheckout
|
||||
*.xcscmblueprint
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
# Pods/
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from the Xcode workspace
|
||||
# *.xcworkspace
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://docs.fastlane.tools/best-practices/source-control/#source-control
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots/**/*.png
|
||||
fastlane/test_output
|
||||
|
||||
# Code Injection
|
||||
#
|
||||
# After new code Injection tools there's a generated folder /iOSInjectionProject
|
||||
# https://github.com/johnno1962/injectionforxcode
|
||||
|
||||
iOSInjectionProject/
|
||||
27
dev/integration_tests/ios_add2app/LICENSE
Normal file
27
dev/integration_tests/ios_add2app/LICENSE
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
23
dev/integration_tests/ios_add2app/Podfile
Normal file
23
dev/integration_tests/ios_add2app/Podfile
Normal file
@@ -0,0 +1,23 @@
|
||||
platform :ios, '12.0'
|
||||
|
||||
flutter_application_path = 'flutterapp/'
|
||||
framework_dir = File.join(flutter_application_path, '.ios', 'Flutter')
|
||||
|
||||
engine_dir = File.join(framework_dir, 'engine')
|
||||
if !File.exist?(engine_dir)
|
||||
# Copy the debug engine to have something to link against if the xcode backend script has not run yet.
|
||||
debug_framework_dir = File.join(flutter_root(flutter_application_path), 'bin', 'cache', 'artifacts', 'engine', 'ios')
|
||||
FileUtils.mkdir_p(engine_dir)
|
||||
FileUtils.cp_r(File.join(debug_framework_dir, 'Flutter.framework'), engine_dir)
|
||||
FileUtils.cp(File.join(debug_framework_dir, 'Flutter.podspec'), engine_dir)
|
||||
end
|
||||
|
||||
target 'ios_add2app' do
|
||||
eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding)
|
||||
end
|
||||
|
||||
target 'ios_add2appTests' do
|
||||
pod 'Flutter', :path => engine_dir
|
||||
inherit! :search_paths
|
||||
pod 'EarlGrey'
|
||||
end
|
||||
673
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/CHANGELOG.md
generated
Normal file
673
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/CHANGELOG.md
generated
Normal file
@@ -0,0 +1,673 @@
|
||||
# Change Log
|
||||
|
||||
Details changes in each release of EarlGrey. EarlGrey follows [semantic versioning](http://semver.org/).
|
||||
|
||||
## [1.15.0](https://github.com/google/EarlGrey/tree/1.15.0) (08/03/2018)
|
||||
```
|
||||
Baseline: [59ce3b6c]
|
||||
+ [59ce3b6c]: Fix default Swift version in EarlGreyExampleSwiftTests xcode project
|
||||
```
|
||||
|
||||
### Enhancements
|
||||
* Added support for accessibility in iOS 12.
|
||||
* Updated the visibility checker to support keyboards in iOS 12.
|
||||
* Updated Analytics Configurations.
|
||||
* Fixed Formatting Issues.
|
||||
* Updated invalid api and compatibility docs.
|
||||
|
||||
### Compatibility
|
||||
* EarlGrey has now been tested for working till Xcode version 10.0 beta 2.
|
||||
* Some of the internal unit tests break on Xcode 9.3+ due to change in exception name thrown by XCTest. Those are still being investigated.
|
||||
|
||||
## [1.14.0](https://github.com/google/EarlGrey/tree/1.14.0) (06/04/2018)
|
||||
```
|
||||
Baseline: [c201f58]
|
||||
+ [c201f58]: Fix default Swift version in EarlGreyExampleSwiftTests xcode project
|
||||
```
|
||||
|
||||
### Enhancements
|
||||
* Add Swift 4 support in the gem.
|
||||
* Update block declarations to support strict prototypes.
|
||||
* Add support for PDF display for `UIWebViewIdlingResource`.
|
||||
* Remove Swift 2 in the gem since Xcode 7.x is not supported anymore.
|
||||
|
||||
### Bug Fixes
|
||||
* Fix `FTRLocalUIWebViewTest` by updating `testAJAXLoad` to detect proper web view elements.
|
||||
|
||||
### Compatibility
|
||||
* EarlGrey has now been tested for working till Xcode version 9.4. Any small test breakages with Xcode 9.4 are being tested.
|
||||
|
||||
### Contributors
|
||||
Thanks to [adam-b](https://github.com/adam-b) and [keefertaylor](https://github.com/keefertaylor)!
|
||||
|
||||
## [1.13.0](https://github.com/google/EarlGrey/tree/1.13.0) (04/03/2018)
|
||||
```
|
||||
Baseline: [2b3939a]
|
||||
+ [2b3939a]: Fix Swift file issues with the updated EarlGrey code for release 1.13.0.
|
||||
```
|
||||
|
||||
### Enhancements
|
||||
* Add nullability to EarlGrey Headers. [Issue #449](https://github.com/google/EarlGrey/issues/449)
|
||||
* Remove `notNil` method and add explicit check in the matcher itself.
|
||||
* Update the Swift wrapper to use refined methods to prevent discardable result warnings.
|
||||
* Update EarlGrey assert(with:) calls to assert(_:).
|
||||
* Move the GREYRunLoopSpinner to spin on the thread passed to it instead of the main thread.
|
||||
* Add tests for disabled buttons, fix visibility test and add iOS 11 support to tests.
|
||||
* Move `EarlGreyImpl` interface out of EarlGrey.h.
|
||||
* Add shake motion support to EarlGrey.
|
||||
|
||||
### Bug Fixes
|
||||
* Use `TIPreferencesController` to change the keyboard settings so it will not load `TIUserWordsManager`, which can cause occasional crashes on iOS 11.0+.
|
||||
* Tell the preferences not to show keyboard tutorial as it interferes with typing.
|
||||
* Close MVC unconditionally to prevent erroneous scenarios where it fails to execute the completion block, leaving it resident on the screen forever.
|
||||
|
||||
### Compatibility
|
||||
* EarlGrey has now been tested for working till Xcode version 9.3. Any small test breakages with Xcode 9.3 are being tested.
|
||||
|
||||
## [1.12.1](https://github.com/google/EarlGrey/tree/1.12.1) (09/01/2017)
|
||||
```
|
||||
Baseline: [405008e]
|
||||
+ [405008e]: Release 1.12.1 to fix incorrect podspec release in 1.12.0.
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Correct podspec to point to the version 1.12.1
|
||||
|
||||
## [1.12.0](https://github.com/google/EarlGrey/tree/1.12.0) (08/22/2017)
|
||||
```
|
||||
Baseline: [ae61a45]
|
||||
+ [ae61a45]: Fix Main thread violation: UIView setHidden called from non-main thread.
|
||||
```
|
||||
|
||||
### Enhancements
|
||||
* More robust synchronization with `NSURLSession`. This fixes many flakiness seen with EarlGrey not waiting for the completion of callback methods after network response has been received.
|
||||
* Performance improvements in GREYAppStateTracker. It uses a deallocation tracker in place of NSString to free up memory sooner.
|
||||
* Fallback to `EarlGrey.swift` v3 when gem cannot find the correct file for the current swift version.
|
||||
* Added `-Wdocumentation` for all EarlGrey projects.
|
||||
* Use static constructor in place of initialize method for one-time setup.
|
||||
* Remove extra parentheses added around failed assertion expressions.
|
||||
* Updated error messages on failure of layout contraints.
|
||||
* Improved Visibility checker's shifted pixel image redraw logic.
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed floating point issue in layout constraint matchers. [Issue #594](https://github.com/google/EarlGrey/issues/594)
|
||||
* Fixed an issue where an exception is thrown when `-[UIWebDocumentView text]` is called in the middle of loading.
|
||||
* Fixed a bug in `isKeyboardShown` with zero sized input accessory views.
|
||||
* Fixed `CGAffineTransformInvert: singular matrix` message that appears during Pinch tests.
|
||||
|
||||
### Compatibility
|
||||
* EarlGrey now supports Xcode version 9.0 up to 9.0 beta 6. All EarlGrey project tests pass with these versions.
|
||||
|
||||
## [1.11.0](https://github.com/google/EarlGrey/tree/1.11.0) (07/21/2017)
|
||||
|
||||
```
|
||||
Baseline: [0d1086d]
|
||||
+ [0d1086d]: Modify 1.10.2 -> 1.11.0 and update the CHANGELOG
|
||||
```
|
||||
|
||||
### Enhancements
|
||||
* Added support for iOS 11 & Xcode 9.0.
|
||||
* Added the `grey_textFieldValue()` matcher for updates to UITextFields with iOS11.
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed Minor issue that was causing infinitely long touch paths for zero sized areas.
|
||||
* Grammatical and Language Fixes.
|
||||
* Refactored FunctionalTests tests for adding iOS 11 support.
|
||||
|
||||
## [1.10.1](https://github.com/google/EarlGrey/tree/1.10.1) (07/14/2017)
|
||||
|
||||
```
|
||||
Baseline: [2abda72]
|
||||
+ [2abda72]: Modified GREYElementInteraction.m to drain the thread for a timeout.
|
||||
```
|
||||
|
||||
### Enhancements
|
||||
* Improved `GREYAssert` macros to not wait until idle as it can cause it to never return.
|
||||
* Improved Search action to not wait until idle as it can cause it to never return.
|
||||
|
||||
## [1.10.0](https://github.com/google/EarlGrey/tree/1.10.0) (07/05/2017)
|
||||
|
||||
```
|
||||
Baseline: [a386cb2]
|
||||
+ [a386cb2]: Update Changelog for the 1.10.0 release for the Screenshot Docs change.
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Resolved visibility checker overlapping view issue. [Issue #532](https://github.com/google/EarlGrey/issues/532)
|
||||
* Use accessibility ID in place of accessibility label for keyboard modifier keys. [Issue #539](https://github.com/google/EarlGrey/issues/539)
|
||||
|
||||
### Enhancements
|
||||
* Removed `kGREYConfigKeyScreenshotDirLocation` in favor of `kGREYConfigKeyArtifactsDirLocation`.
|
||||
* Fixed all issues reported by Xcode's static analysis.
|
||||
* Fixed long press test failures on travis.
|
||||
* Improved interaction error logging by adding more information about failure to the out error parameter.
|
||||
* Added more error details to timeout failures.
|
||||
* Add explicit 1st and 2nd param to grey_allOf and grey_anyOf to prevent redundant uses.
|
||||
* Update jazzy copyright year.
|
||||
|
||||
### Compatibility
|
||||
* Adding xcode version to backwards compatibility doc.
|
||||
|
||||
## [1.9.4](https://github.com/google/EarlGrey/tree/1.9.4) (06/09/2017)
|
||||
|
||||
```
|
||||
Baseline: [76a6d65]
|
||||
+ [76a6d65]: Updated Hierarchy traversal to use common traversal logic with DFS/BF.
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed a bug in scroll action that can sometimes cause a tap at the end of scroll.
|
||||
|
||||
### New Features
|
||||
* Added `kGREYConfigKeyArtifactsDirLocation` configuration key for setting a custom folder to store artifacts.
|
||||
|
||||
### Enhancements
|
||||
* Improved CI execution on travis.
|
||||
* Updated test app with better AutoLayout support.
|
||||
* Improved docs for earlgrey gem, contributors guide, etc.
|
||||
* Fixed all asserts to use internal implementation instead of NSAssert which
|
||||
can be disabled.
|
||||
* Updated cheatsheet render script to use Chrome 59.
|
||||
* Consolidated DFS and BFS hierarchy traversals.
|
||||
* Renamed `GREYExposed.h` to `GREYAppleInternals.h`
|
||||
* Removed redundant categories and moved methods to private headers.
|
||||
|
||||
### Contributors
|
||||
* [bootstraponline](https://github.com/bootstraponline)
|
||||
|
||||
## [1.9.3](https://github.com/google/EarlGrey/tree/1.9.3) (05/26/2017)
|
||||
|
||||
```
|
||||
Baseline: [a3ba675]
|
||||
+ [a3ba675]: Fix breaking test with Long Press
|
||||
```
|
||||
|
||||
### Improvements
|
||||
* Revaming of Swipe Touch Path Gestures to make them more like a real-user.
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed breaking tests for Long Press Gestures.
|
||||
* Fix source_tree and relative path for the EarlGrey gem to prevent Carthage breakages.
|
||||
|
||||
## [1.9.2](https://github.com/google/EarlGrey/tree/1.9.2) (04/21/2017)
|
||||
|
||||
```
|
||||
Baseline: [b9d7a7c]
|
||||
+ [b9d7a7c]: Update OS=10.3 for travis CI
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed timeout related failures from being reported as assertion failures.
|
||||
* Fixed to wait for rotation to complete before verifying that it changed.
|
||||
* Fixed Swift breaks by correcting issue with Gem adding EarlGrey.swift for
|
||||
Objective C targets.
|
||||
* Fixed race condition with reading and writing to state tracker elementID.
|
||||
|
||||
## [1.9.1](https://github.com/google/EarlGrey/tree/1.9.1) (04/14/2017)
|
||||
|
||||
```
|
||||
Baseline: [932c3f6]
|
||||
+ [932c3f6]: Doc updates
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed a bug in interaction point calculation for cases where activation point
|
||||
and the center of visible area is hidden.
|
||||
|
||||
### Enhancements
|
||||
* Updated documentation for GREYCondition and ruby setup.
|
||||
* Minor improvements to formatting of failure messages.
|
||||
* Updated travis to run tests on iOS 10.3 and Xcode 8.3.
|
||||
* Deleted .arcconfig file.
|
||||
|
||||
### Contributors
|
||||
* [bootstraponline](https://github.com/bootstraponline)
|
||||
|
||||
## [1.9.0](https://github.com/google/EarlGrey/tree/1.9.0) (03/31/2017)
|
||||
|
||||
```
|
||||
Baseline: [6bceffc]
|
||||
+ [6bceffc]: Sync 1.9.0
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* Supports Xcode 8.3 and iOS 10.3 on devices and simulators.
|
||||
* The EarlGrey gem runs out of the box for Swift 3.0 and Swift 2.3.
|
||||
|
||||
### New Features
|
||||
* Add `-[GREYKeyboard dismissKeyboardWithError:]` API to dismiss the keyboard.
|
||||
|
||||
### Enhancements
|
||||
* Improved earlgrey gem by removing post_install and letting pod update
|
||||
the project.
|
||||
* Improved swift support for `grey_allOf` and `grey_anyOf`.
|
||||
* Several documentation updates including installation steps improvements.
|
||||
* Added gem badge to `README.md`.
|
||||
|
||||
### Contributors
|
||||
* [bootstraponline](https://github.com/bootstraponline)
|
||||
* [Felix Krause](https://github.com/KrauseFx)<br/>
|
||||
|
||||
## [1.8.0](https://github.com/google/EarlGrey/tree/1.8.0) (03/17/2017)
|
||||
|
||||
```
|
||||
Baseline: [0dc7c18]
|
||||
+ [0dc7c18]: 1.8.0 Release
|
||||
```
|
||||
|
||||
### New Features
|
||||
* Added multi-finger swipe action API's:
|
||||
* grey_multiFingerSwipeFastInDirection
|
||||
* grey_multiFingerSwipeSlowInDirection
|
||||
* grey_multiFingerSwipeFastInDirectionWithStartPoint
|
||||
* grey_multiFingerSwipeSlowInDirectionWithStartPoint
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed issue with accessibility spamming "Remote service does not respond to _accessibilityMachPort" message on iOS 9.1 device.
|
||||
* Fixed issues with EarlGrey working with a `UIAccessibilityTextFieldElement`.
|
||||
* Fixed typing by blacklisting `UICompatibilityInputViewController` in UIViewController tracking.
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* Supports Xcode 8.3 beta 4 and iOS 10.3 on devices and simulators.
|
||||
* The EarlGrey gem runs out of the box for Swift 3.0 and Swift 2.3.
|
||||
|
||||
### Enhancements
|
||||
* Improvements to the EarlGrey FunctionalTests TestRig.
|
||||
* All `GREYAssertXXX` macros now wait for the app to idle before being evaluated.
|
||||
* Unified the `Copy Files` modification script for Carthage and CocoaPods support.
|
||||
|
||||
### Contributors
|
||||
[bootstraponline](https://github.com/bootstraponline)<br/>
|
||||
[petaren](https://github.com/petaren)
|
||||
|
||||
## [1.7.2](https://github.com/google/EarlGrey/tree/1.7.2) (02/17/2017)
|
||||
|
||||
```
|
||||
Baseline: [6d55af5]
|
||||
+ [6d55af5]: 1.7.2 Release
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed Swizzler to properly reset swizzled selectors.
|
||||
* Fixed typing by blacklisting UICompatibilityInputViewController in UIViewController tracking.
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* Supports Xcode 8.2.1 and iOS 10.2.1 on devices and simulators.
|
||||
* The EarlGrey gem runs out of the box for Swift 3.0 and Swift 2.3.
|
||||
|
||||
### Enhancements
|
||||
* Updated analytics to use an client ID instead of user ID.
|
||||
|
||||
### Contributors
|
||||
[mbaxley](https://github.com/mbaxley), thank you!
|
||||
|
||||
## [1.7.1](https://github.com/google/EarlGrey/tree/1.7.1) (02/03/2017)
|
||||
|
||||
```
|
||||
Baseline: [e026773]
|
||||
+ [e026773]: Change version numbers for EarlGrey 1.7.1
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed an issue with constraint failure details not being logged in the error trace.
|
||||
* Updated nullability for GREYMatchers to improve Swift support.
|
||||
* Minor changes to logging strings and docs.
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* Supports Xcode 8.2.1 and iOS 10.2.1 on devices and simulators.
|
||||
* The EarlGrey gem runs out of the box for Swift 3.0 and Swift 2.3.
|
||||
|
||||
### Enhancements
|
||||
* Updated analytics to use an md5 hashed uid.
|
||||
|
||||
## [1.7.0](https://github.com/google/EarlGrey/tree/1.7.0) (01/25/2017)
|
||||
|
||||
```
|
||||
Baseline: [f823ff2]
|
||||
+ [f823ff2]: Removing JSON escape in reported errors.
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed a flake in testTrackingZombieQueue.
|
||||
* Fixed CGRectIntegralInside to handle negative rectangles.
|
||||
* Improved memory handling by moving autorelease pool inside loops.
|
||||
* Fixed the bundle id to be consistent across all the test projects.
|
||||
* Minor CI and other bug fixes.
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* Supports Xcode 8.2.1 and iOS 10.2.1 on devices and simulators.
|
||||
|
||||
### New Features
|
||||
* Updated analytics to include *hash* of test class name and *hash* of test case names to better estimate the volume of EarlGrey usage.
|
||||
* Updated the readme to explain these changes.
|
||||
* Updated tests for analytics to test new features.
|
||||
|
||||
### Enhancements
|
||||
* Improved EarlGrey error logging for better post processing [Issue #392](https://github.com/google/EarlGrey/issues/392).
|
||||
* Removed the deprecated methods and cleaned up private headers.
|
||||
* The EarlGrey gem runs out of the box for Swift 3.0 and Swift 2.3.
|
||||
|
||||
### Deprecations
|
||||
* Removed deprecated methods `grey_pinchFastInDirection` and `grey_pinchSlowInDirection` in favor of `grey_pinchFastInDirectionAndAngle` and `grey_pinchSlowInDirectionAndAngle` respectively.
|
||||
|
||||
### Contributors
|
||||
[bootstraponline](https://github.com/bootstraponline), [stkhapugin](https://github.com/stkhapugin) and [kebernet](https://github.com/kebernet)
|
||||
|
||||
## [1.6.2](https://github.com/google/EarlGrey/tree/1.6.2) (01/06/2017)
|
||||
|
||||
```
|
||||
Baseline: [0cdda9c]
|
||||
+ [0cdda9c]: EarlGrey Sync for 1.6.2
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Updated the EarlGrey API for Swift 3.0 as per the latest guidelines.
|
||||
* Improved web tests to work with current google.com UI.
|
||||
* Fixed a bug in the visibility checker for 32bit platform.
|
||||
* Fixed flakiness caused by NSDate issues in EarlGreyExampleSwiftTests.
|
||||
|
||||
### Enhancements
|
||||
* Added a travis hook to stop CI runs for docs-only changes.
|
||||
|
||||
### Contributors
|
||||
Thanks to [bootstraponline](https://github.com/bootstraponline)
|
||||
and the rest of the contributors!
|
||||
|
||||
## [1.6.1](https://github.com/google/EarlGrey/tree/1.6.1) (12/20/2016)
|
||||
|
||||
```
|
||||
Baseline: [9e04024]
|
||||
+ [9e04024]: Release 1.6.1
|
||||
```
|
||||
|
||||
### Bug Fixes
|
||||
* Add a test for long pressing the link in the UI webview.
|
||||
* Fix issue with xcodeproj gem in travis runs.
|
||||
|
||||
### Enhancements
|
||||
* Update travis run to use Xcode 8.2
|
||||
|
||||
## [1.6.0](https://github.com/google/EarlGrey/tree/1.6.0) (12/06/2016)
|
||||
|
||||
```
|
||||
Baseline: [5080a21]
|
||||
+ [5080a21]: Updated changelog info.plist pod spec and gem version for 1.6.0 release.
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* The EarlGrey gem runs out of the box for Swift 3.0 and Swift 2.3.
|
||||
* Has been tested for support till iOS 10.1 on devices and simulator.
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed CocoaPods issue with using EarlGrey as a module in Swift projects.
|
||||
* Fixed issue with Accessibility service not enabled for simulators and devices.
|
||||
* Minor documentation and syntax fixes.
|
||||
|
||||
### Enhancements
|
||||
* Moved failure handler from a global variable to a thread local storage, like NSAssertionHandlers.
|
||||
* Exposed the angle for pinch action in GREYPinchAction.
|
||||
* Added EarlGreyExample CocoaPods project to travis.
|
||||
|
||||
### Deprecations
|
||||
* Deprecated `grey_pinchSlowInDirection` and `grey_pinchFastInDirection` in favor of
|
||||
`grey_pinchFastInDirectionAndAngle` and `grey_pinchSlowInDirectionAndAngle`.
|
||||
|
||||
## [1.5.3](https://github.com/google/EarlGrey/tree/1.5.3) (11/14/2016)
|
||||
|
||||
```
|
||||
Baseline: [690eaa2]
|
||||
+ [690eaa2]: Updated ChangeLog and pod spec for 1.5.3 release
|
||||
```
|
||||
|
||||
### Enhancements
|
||||
* Resolve CocoaPods rating [Github issue](https://github.com/CocoaPods/CocoaPods/issues/6175)
|
||||
|
||||
## [1.5.2](https://github.com/google/EarlGrey/tree/1.5.2) (11/11/2016)
|
||||
|
||||
```
|
||||
Baseline: [f3ee931]
|
||||
+ [f3ee931]: Updated ChangeLog and pod spec for 1.5.2 release
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* The EarlGrey gem runs out of the box for Swift 3.0 and Swift 2.3.
|
||||
* Has been tested for support till iOS 10.1 on devices and simulator.
|
||||
|
||||
### Enhancements
|
||||
* Enhance precision of timer used for touch injection
|
||||
* Removed requirement for bridging header for Swift and EarlGrey
|
||||
|
||||
## [1.5.1](https://github.com/google/EarlGrey/tree/1.5.1) (11/07/2016)
|
||||
|
||||
```
|
||||
Baseline: [d9eb1bc]
|
||||
+ [d9eb1bc]: Updated ChangeLog and pod spec for 1.5.1 release
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* The EarlGrey gem runs out of the box for Swift 3.0 and Swift 2.3.
|
||||
* Has been tested for support till iOS 10.01 on devices and simulator.
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed CI Ruby test for Carthage.
|
||||
|
||||
### Enhancements
|
||||
* Improved touch injection speed by making it work independent of the screen refresh rate.
|
||||
* Added synchronization for `NSURLConnection::sendSynchronousRequest`.
|
||||
* Exclude URLs that start with `data` scheme from being synchronized.
|
||||
* Updated `grey_clearText` action to accept elements conforming to UITextInput protocol.
|
||||
|
||||
## [1.5.0](https://github.com/google/EarlGrey/tree/1.5.0) (10/31/2016)
|
||||
|
||||
```
|
||||
Baseline: [55d42a4]
|
||||
+ [55d42a4]: Updated ChangeLog and pod spec for 1.5 release
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* The EarlGrey gem runs out of the box for [Swift 3.0](https://docs.google.com/document/d/1AeleXccp35EUX4ILa6CT3CwlxLSZq1YLrco9JF27p9k/edit) and Swift 2.3.
|
||||
* Has been tested for support till iOS 10.01 on devices and simulator.
|
||||
|
||||
### Bug Fixes
|
||||
* Failing analytics tests fixes.
|
||||
* Fixed flaky Travis Stopwatch Test.
|
||||
* Fixed rspec tests broken by ruby update and changing the directory.
|
||||
|
||||
### Enhancements
|
||||
* Improved UIAppStateTracker APIs to allow for ignoring states.
|
||||
* Improved failure handlers for multiple invocations within context of a valid test case.
|
||||
|
||||
### Deprecations
|
||||
* Swift 2.2 is no longer supported.
|
||||
|
||||
## [1.4.0](https://github.com/google/EarlGrey/tree/1.4.0) (10/07/2016)
|
||||
|
||||
```
|
||||
Baseline: [b5e34db]
|
||||
+ [b5e34db]: Update Info.plist / Podspec / Cheatsheet for EarlGrey 1.4.0
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* EarlGrey.gem runs out of the box for Swift 2.2.x. For Swift 3.0, please
|
||||
use the [Swift Migration Guide](https://swift.org/migration-guide/) to
|
||||
add the `Use Legacy Swift` build setting to your test target until we
|
||||
provide support.
|
||||
* Has been tested for support till iOS 10.01 on devices and simulator.
|
||||
|
||||
### Enhancements
|
||||
* A better way to blacklist URL's in GREYConfiguration by adding them to an NSArray.
|
||||
* A verbose logger to provide more descriptive EarlGrey logs that can be enabled by
|
||||
setting the `kGREYAllowVerboseLogging` key in NSUserDefaults to `YES`. Verbose
|
||||
logging also measures the performance of interactions and the thread executor by
|
||||
using a stopwatch class.
|
||||
* Improvements to `-[XCTestCase greyStatus]` to better reflect the status of a test.
|
||||
|
||||
### Bug Fixes
|
||||
* Corrected selection of `UIPickerView`s even when they were disabled.
|
||||
* Minor documentation and syntax fixes.
|
||||
|
||||
### Deprecations
|
||||
* Deprecated `GREYFail` in favor of `GREYFailWithDetails`.
|
||||
|
||||
## [1.3.1](https://github.com/google/EarlGrey/tree/1.3.1) (09/19/2016)
|
||||
|
||||
```
|
||||
Baseline: [c4913b]
|
||||
+ [c4913b]: Update compatibility doc to include iOS 10.
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* Has been tested for support till iOS 10.01 on devices and simulator.
|
||||
|
||||
### Enhancements
|
||||
* Add autolayout to `FTRTypingViewController`
|
||||
|
||||
### Bug Fixes
|
||||
* Minor documentation and syntax fixes.
|
||||
* Fixed Functional Test Project scheme preventing it to be run on devices.
|
||||
* Add a temporary hold on the xcodeproj gem dependency to unblock tests.
|
||||
|
||||
## [1.3.0](https://github.com/google/EarlGrey/tree/1.3.0) (09/09/2016)
|
||||
|
||||
```
|
||||
Baseline: [6b2f329]
|
||||
+ [6b2f329]: Add fixes for documentation.
|
||||
```
|
||||
|
||||
### Compatibility
|
||||
* Requires iOS 8 as the minimum deployment target.
|
||||
* Has been tested for support till iOS 10 beta 4.
|
||||
|
||||
### New Features
|
||||
|
||||
* The following new matchers were added EarlGrey:
|
||||
* `grey_selected`: Checks if a UIControl is selected.
|
||||
* `grey_accessibilityFocused`: Checks if a UI element is focused by accessibility technologies
|
||||
like Voiceover or Switch Control.
|
||||
|
||||
### Enhancements
|
||||
* Added an API to find the `XCTestCase` status through an EarlGrey test run.
|
||||
* Improved the failure description in the failure handler.
|
||||
* Made the `EarlGrey.swift` file syntax swiftier.
|
||||
* Improved Unit and Functional test coverage.
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed Travis issue with the Ruby version.
|
||||
* Minor documentation and syntax fixes.
|
||||
|
||||
### Deprecations
|
||||
* `grey_elementAtIndex` has been removed in favor of the `atIndex:` interaction API. For migrating
|
||||
your tests, please follow the announcement
|
||||
[here](https://groups.google.com/forum/#!topic/earlgrey-discuss/Q6RhxRhtRvo).
|
||||
|
||||
### Contributors
|
||||
Special thanks to [axi0mX](https://github.com/axi0mX),
|
||||
[bootstraponline](https://github.com/bootstraponline),
|
||||
[KazuCocoa](https://github.com/KazuCocoa) and the rest of our contributors.
|
||||
|
||||
## [1.2.0](https://github.com/google/EarlGrey/tree/1.2.0) (08/31/2016)
|
||||
|
||||
```
|
||||
Baseline: [7070e1a]
|
||||
+ [7070e1a]: Updated cheatsheet and podspec for 1.2.0 release
|
||||
```
|
||||
|
||||
### New Features
|
||||
|
||||
* EarlGrey now supports multi-touch gestures! Following pinch actions have been added:
|
||||
* `grey_pinchFastInDirection`
|
||||
* `grey_pinchSlowInDirection`
|
||||
* Added `atIndex:` interaction API to select from multiple element matches.
|
||||
|
||||
### Enhancements
|
||||
* Updated Swift Macros in EarlGrey gem.
|
||||
* Implemented matcher for UIScrollView scrolled to content edge.
|
||||
|
||||
### Bug Fixes
|
||||
* Fixed several typos and cleaned up many project files with proper error messages.
|
||||
* Added carthage `xcodebuild` command to Travis CI.
|
||||
* Fixed issue with action{Did,Will}PerformAction notification and its userInfo.
|
||||
* Updated protocol signatures.
|
||||
|
||||
### Contributors
|
||||
Special thanks to [axi0mX](https://github.com/axi0mX) and the rest of our contributors.
|
||||
|
||||
## [1.1.0](https://github.com/google/EarlGrey/tree/1.1.0) (08/18/2016)
|
||||
|
||||
```
|
||||
Baseline: [107dba5]
|
||||
+ [107dba5]: Update podspec for 1.1.0 release [ci skip]
|
||||
```
|
||||
|
||||
### New Features
|
||||
|
||||
* API reference documentation generated via [Jazzy](https://rubygems.org/gems/jazzy/)
|
||||
* Cheatsheet for EarlGrey
|
||||
* Carthage support
|
||||
* Easier CocoaPods setup using [EarlGrey gem](https://rubygems.org/gems/earlgrey)
|
||||
which replaces manually copying over `configure_earlgrey_pods.rb` and `EarlGrey.swift` file.
|
||||
|
||||
### Enhancements
|
||||
|
||||
* For demonstration purposes added Swift demo app and tests
|
||||
* Update documentation for Swift usage
|
||||
* Update contribution guidelines
|
||||
* Added `grey_allOfMatchers` and `grey_anyOfMatchers` to EarlGrey.swift
|
||||
* Use XCTest's mechanism of halting test execution instead of throwing arbitrary exception
|
||||
* Helper method to speed up animation
|
||||
* Added `grey_replaceText` action to directly replace text (without using keyboard) on a field
|
||||
* Created `grey_atIndex` matcher for matching a single element from a list of matched elements
|
||||
* Updated FAQs with questions and examples
|
||||
* Update install guide with Cocoapods 0.39 support
|
||||
* Added Badge for License, Cocoapod, and Travis
|
||||
* Efficiency improvement in `GREYAppStateTracker` reducing O(n) to constant amortized time
|
||||
* Improved webview synchronization
|
||||
* Added tracking for `dispatch_async_f` and `dispatch_sync_f` methods
|
||||
* Reduce throttling of CPU by allowing runloops to sleep when idle
|
||||
* Removed unnecessary runloop drains improving overall speed and reliability
|
||||
* Introduced trackers for `NSManagedObjectContext`
|
||||
* Signal handlers and uncaught exception handler invoke previously installed handlers
|
||||
* Improved accessibility logic to support beta versions of iOS 10
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Race conditions in `GREYOperationQueueIdlingResourceTest`
|
||||
* Race conditions in `GREYDispatchQueueIdlingResourceTest`
|
||||
* Addressed Swift 3 related warnings in `EarlGrey.swift`
|
||||
* Resigning first responder for autocorrect-enabled fields causes keyboard track to mistrack
|
||||
keyboard disappearance events
|
||||
* EarlGrey.xcodeproj fails to build for device because code signing identities aren't set
|
||||
correctly
|
||||
* Assertion failure in `-[GREYElementProvider dataEnumerator]` due to nil accessibility element
|
||||
* Rubocop warnings in configure_earlgrey_pods.rb script and Podfile
|
||||
* EarlGreyFunctionalTests `testSwipeOnWindow` always fails on iPhone 4S
|
||||
* If parent directory has spaces, `setup-earlgrey.sh` will fail and exit
|
||||
* Retain cycle in `GREYElementInteraction`
|
||||
* Retain cycle in `UIApplication` mock in test suite
|
||||
* Changed CFBundlePackageType in EarlGrey-Info.plist to FMWK
|
||||
|
||||
### Contributors
|
||||
Special thanks to [bootstraponline](https://github.com/bootstraponline),
|
||||
[axi0mX](https://github.com/axi0mX), and the rest of our contributors.
|
||||
|
||||
## [1.0.0](https://github.com/google/EarlGrey/tree/1.0.0) (02/16/2016)
|
||||
|
||||
First cup of EarlGrey.
|
||||
|
||||
```
|
||||
Baseline: [7099484]
|
||||
+ [7099484]: First version of EarlGrey.
|
||||
```
|
||||
|
||||
Initial release.
|
||||
BIN
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/EarlGrey
generated
Executable file
BIN
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/EarlGrey
generated
Executable file
Binary file not shown.
73
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/EarlGrey.h
generated
Normal file
73
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/EarlGrey.h
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* Umbrella public header for the EarlGrey framework.
|
||||
*
|
||||
* Instead of importing individual headers, import this header using:
|
||||
* @code
|
||||
* @import EarlGrey; // if your project uses modules
|
||||
* @endcode
|
||||
* OR if your project doesn't use modules:
|
||||
* @code
|
||||
* #import <EarlGrey/EarlGrey.h>
|
||||
* @endcode
|
||||
*
|
||||
* To learn more, check out: http://github.com/google/EarlGrey
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYAction.h>
|
||||
#import <EarlGrey/GREYActionBlock.h>
|
||||
#import <EarlGrey/GREYActions.h>
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
#import <EarlGrey/GREYScrollActionError.h>
|
||||
#import <EarlGrey/GREYIdlingResource.h>
|
||||
#import <EarlGrey/GREYAssertion.h>
|
||||
#import <EarlGrey/GREYAssertionBlock.h>
|
||||
#import <EarlGrey/GREYAssertionDefines.h>
|
||||
#import <EarlGrey/GREYAssertions.h>
|
||||
#import <EarlGrey/GREYConfiguration.h>
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
#import <EarlGrey/GREYElementHierarchy.h>
|
||||
#import <EarlGrey/GREYScreenshotUtil.h>
|
||||
#import <EarlGrey/GREYTestHelper.h>
|
||||
#import <EarlGrey/EarlGreyImpl.h>
|
||||
#import <EarlGrey/GREYElementFinder.h>
|
||||
#import <EarlGrey/GREYElementInteraction.h>
|
||||
#import <EarlGrey/GREYInteraction.h>
|
||||
#import <EarlGrey/GREYFailureHandler.h>
|
||||
#import <EarlGrey/GREYFrameworkException.h>
|
||||
#import <EarlGrey/GREYAllOf.h>
|
||||
#import <EarlGrey/GREYAnyOf.h>
|
||||
#import <EarlGrey/GREYBaseMatcher.h>
|
||||
#import <EarlGrey/GREYDescription.h>
|
||||
#import <EarlGrey/GREYElementMatcherBlock.h>
|
||||
#import <EarlGrey/GREYLayoutConstraint.h>
|
||||
#import <EarlGrey/GREYMatcher.h>
|
||||
#import <EarlGrey/GREYMatchers.h>
|
||||
#import <EarlGrey/GREYNot.h>
|
||||
#import <EarlGrey/GREYDataEnumerator.h>
|
||||
#import <EarlGrey/GREYProvider.h>
|
||||
#import <EarlGrey/GREYCondition.h>
|
||||
#import <EarlGrey/GREYDispatchQueueIdlingResource.h>
|
||||
#import <EarlGrey/GREYManagedObjectContextIdlingResource.h>
|
||||
#import <EarlGrey/GREYNSTimerIdlingResource.h>
|
||||
#import <EarlGrey/GREYOperationQueueIdlingResource.h>
|
||||
#import <EarlGrey/GREYSyncAPI.h>
|
||||
#import <EarlGrey/GREYUIThreadExecutor.h>
|
||||
173
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/EarlGreyImpl.h
generated
Normal file
173
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/EarlGreyImpl.h
generated
Normal file
@@ -0,0 +1,173 @@
|
||||
//
|
||||
// Copyright 2018 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
@class GREYElementInteraction, GREYFrameworkException;
|
||||
@protocol GREYMatcher, GREYFailureHandler;
|
||||
|
||||
/**
|
||||
* Convenience replacement for every EarlGrey method call with
|
||||
* EarlGreyImpl::invokedFromFile:lineNumber: so it can get the invocation file and line to
|
||||
* report to XCTest on failure.
|
||||
*/
|
||||
#define EarlGrey \
|
||||
[EarlGreyImpl invokedFromFile:[NSString stringWithUTF8String:__FILE__] ?: @"UNKNOWN FILE" \
|
||||
lineNumber:__LINE__]
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Key for currently set failure handler for EarlGrey in thread's local storage dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYFailureHandlerKey;
|
||||
|
||||
/**
|
||||
* Error domain for keyboard dismissal.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYKeyboardDismissalErrorDomain;
|
||||
|
||||
/**
|
||||
* Error code for keyboard dismissal actions.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYKeyboardDismissalErrorCode) {
|
||||
/**
|
||||
* The keyboard dismissal failed.
|
||||
*/
|
||||
GREYKeyboardDismissalFailedErrorCode = 0, // Keyboard Dismissal failed.
|
||||
};
|
||||
|
||||
/**
|
||||
* Entrypoint to the EarlGrey framework.
|
||||
* Use methods of this class to initiate interaction with any UI element on the screen.
|
||||
*/
|
||||
@interface EarlGreyImpl : NSObject
|
||||
|
||||
/**
|
||||
* Provides the file name and line number of the code that is calling into EarlGrey.
|
||||
* In case of a failure, the information is used to tell XCTest the exact line which caused
|
||||
* the failure so it can be highlighted in the IDE.
|
||||
*
|
||||
* @param fileName The name of the file where the failing code exists.
|
||||
* @param lineNumber The line number of the failing code.
|
||||
*
|
||||
* @return An EarlGreyImpl instance, with details of the code invoking EarlGrey.
|
||||
*/
|
||||
+ (instancetype)invokedFromFile:(NSString *)fileName lineNumber:(NSUInteger)lineNumber;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the <b>EarlGrey</b> macro to start an
|
||||
* interaction.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Creates a pending interaction with a single UI element on the screen.
|
||||
*
|
||||
* In this step, a matcher is supplied to EarlGrey which is later used to sift through the elements
|
||||
* in the UI Hierarchy. This method only denotes that you have an intent to perform an action and
|
||||
* packages a GREYElementInteraction object to do so.
|
||||
* The interaction is *actually* started when it's performed with a @c GREYAction or
|
||||
* @c GREYAssertion.
|
||||
*
|
||||
* An interaction will fail when multiple elements are matched. In that case, you will have to
|
||||
* refine the @c elementMatcher to match a single element or use GREYInteraction::atIndex: to
|
||||
* specify the index of the element in the list of elements matched.
|
||||
*
|
||||
* By default, EarlGrey looks at all the windows from front to back and
|
||||
* searches for the UI element. To focus on a specific window or container, use
|
||||
* GREYElementInteraction::inRoot: method.
|
||||
*
|
||||
* For example, this code will match a UI element with accessibility identifier "foo"
|
||||
* inside a custom UIWindow of type MyCustomWindow:
|
||||
* @code
|
||||
* [[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"foo")]
|
||||
* inRoot:grey_kindOfClass([MyCustomWindow class])]
|
||||
* @endcode
|
||||
*
|
||||
* @param elementMatcher The matcher specifying the UI element that will be targeted by the
|
||||
* interaction.
|
||||
*
|
||||
* @return A GREYElementInteraction instance, initialized with an appropriate matcher.
|
||||
*/
|
||||
- (GREYElementInteraction *)selectElementWithMatcher:(id<GREYMatcher>)elementMatcher;
|
||||
|
||||
/**
|
||||
* Sets the global failure handler for all framework related failures.
|
||||
*
|
||||
* A default failure handler is provided by the framework and it is @b strongly advised to use
|
||||
* that if you don't need to customize error handling in your test. Passing in @c nil will revert
|
||||
* the failure handler to default framework provided failure handler.
|
||||
*
|
||||
* @param handler The failure handler to be used for all test failures.
|
||||
*/
|
||||
- (void)setFailureHandler:(_Nullable id<GREYFailureHandler>)handler;
|
||||
|
||||
/**
|
||||
* Convenience wrapper to invoke GREYFailureHandler::handleException:details: on the global
|
||||
* failure handler.
|
||||
*
|
||||
* @param exception The exception to be handled.
|
||||
* @param details Any extra details about the failure.
|
||||
*/
|
||||
- (void)handleException:(GREYFrameworkException *)exception details:(NSString *)details;
|
||||
|
||||
/**
|
||||
* Rotate the device to a given @c deviceOrientation. All device orientations except for
|
||||
* @c UIDeviceOrientationUnknown are supported. If a non-nil @c errorOrNil is provided, it will
|
||||
* be populated with the failure reason if the orientation change fails, otherwise a test failure
|
||||
* will be registered.
|
||||
*
|
||||
* @param deviceOrientation The desired orientation of the device.
|
||||
* @param[out] errorOrNil Error that will be populated on failure. If @c nil, a test
|
||||
* failure will be reported if the rotation attempt fails.
|
||||
*
|
||||
* @return @c YES if the rotation was successful, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)rotateDeviceToOrientation:(UIDeviceOrientation)deviceOrientation
|
||||
errorOrNil:(__strong NSError **)errorOrNil;
|
||||
|
||||
/**
|
||||
* Shakes the device. If a non-nil @c errorOrNil is provided, it will
|
||||
* be populated with the failure reason if the orientation change fails, otherwise a test failure
|
||||
* will be registered.
|
||||
*
|
||||
* @param[out] errorOrNil Error that will be populated on failure. If @c nil, the a test
|
||||
* failure will be reported if the shake attempt fails.
|
||||
*
|
||||
* @throws GREYFrameworkException if the action fails and @c errorOrNil is @c nil.
|
||||
* @return @c YES if the shake was successful, @c NO otherwise. If @c errorOrNil is @c nil and
|
||||
* the operation fails, it will throw an exception.
|
||||
*/
|
||||
- (BOOL)shakeDeviceWithError:(__strong NSError **)errorOrNil;
|
||||
|
||||
/**
|
||||
* Dismisses the keyboard by resigning the first responder, if any. Will populate the provided
|
||||
* error if the first responder is not present or if the keyboard is not visible.
|
||||
*
|
||||
* @param[out] errorOrNil Error that will be populated on failure. If @c nil, a test
|
||||
* failure will be reported if the dismissing fails.
|
||||
*
|
||||
* @return @c YES if the dismissing of the keyboard was successful, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)dismissKeyboardWithError:(__strong NSError **)errorOrNil;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
51
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAction.h
generated
Normal file
51
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAction.h
generated
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A protocol for actions that are performed on accessibility elements.
|
||||
*/
|
||||
@protocol GREYAction<NSObject>
|
||||
|
||||
/**
|
||||
* Perform the action specified by the GREYAction object on an @c element if and only if the
|
||||
* @c element matches the constraints of the action.
|
||||
*
|
||||
* @param element The element the action is to be performed on. This must not be @c nil.
|
||||
* @param[out] errorOrNil Error that will be populated on failure. The implementing class should
|
||||
* handle the behavior when it is @c nil by, for example, logging the error
|
||||
* or throwing an exception.
|
||||
*
|
||||
* @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 occurred and so the UI may be in an unrecoverable state.
|
||||
*/
|
||||
- (BOOL)perform:(id)element error:(__strong NSError *_Nullable *)errorOrNil;
|
||||
|
||||
/**
|
||||
* A method to get the name of this action.
|
||||
*
|
||||
* @return The name of the action. If the action fails, then the name is printed along with all
|
||||
* other relevant information.
|
||||
*/
|
||||
- (NSString *)name;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
|
||||
@protocol GREYMatcher;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Block type for defining the action's 'perform' code.
|
||||
*
|
||||
* @param element The element on which the block is going to be performed.
|
||||
* @param[out] errorOrNil The error set on failure. The error returned can be @c nil, signifying
|
||||
* that the action succeeded.
|
||||
*
|
||||
* @throws NSException when there is a failure and @c errorOrNil is not provided
|
||||
* (i.e. it is @c nil).
|
||||
*
|
||||
* @return @c YES if the action performed succeeded, else @c NO.
|
||||
*/
|
||||
typedef BOOL (^GREYPerformBlock)(id element, __strong NSError *_Nullable *errorOrNil);
|
||||
|
||||
/**
|
||||
* A class for creating block based GREYAction.
|
||||
*/
|
||||
@interface GREYActionBlock : GREYBaseAction
|
||||
|
||||
/**
|
||||
* Creates a GREYAction that performs the action in the provided @c block.
|
||||
*
|
||||
* @param name The name of the action
|
||||
* @param block A block that contains the action to execute.
|
||||
*
|
||||
* @return A GREYActionBlock instance with the given name.
|
||||
*/
|
||||
+ (instancetype)actionWithName:(NSString *)name performBlock:(GREYPerformBlock)block;
|
||||
|
||||
/**
|
||||
* Creates a GREYAction that performs the action in the provided @c block subject to the
|
||||
* provided @c constraints.
|
||||
*
|
||||
* @param name The name of the action.
|
||||
* @param constraints Constraints that must be satisfied before the action is performed
|
||||
* This is optional and can be @c nil.
|
||||
* @param block A block that contains the action to execute.
|
||||
*
|
||||
* @return A GREYActionBlock instance with the given name and constraints.
|
||||
*/
|
||||
+ (instancetype)actionWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher> _Nullable)constraints
|
||||
performBlock:(GREYPerformBlock)block;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Designated Initializer.
|
||||
*
|
||||
* @param name The name of the action.
|
||||
* @param constraints Constraints that must be satisfied before the action is performed
|
||||
* This is optional and can be @c nil.
|
||||
* @param block A block that contains the action to execute.
|
||||
*
|
||||
* @return A GREYActionBlock instance with the given name and constraints.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher> _Nullable)constraints
|
||||
performBlock:(GREYPerformBlock)block NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
545
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYActions.h
generated
Normal file
545
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYActions.h
generated
Normal file
@@ -0,0 +1,545 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
@protocol GREYAction;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A interface that exposes UI element actions.
|
||||
*/
|
||||
@interface GREYActions : NSObject
|
||||
|
||||
/**
|
||||
* @return A GREYAction that performs multiple taps of a specified @c count.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForMultipleTapsWithCount:(NSUInteger)count;
|
||||
|
||||
/**
|
||||
* @return A GREYAction that performs multiple taps of a specified @c count at a specified
|
||||
* @c point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForMultipleTapsWithCount:(NSUInteger)count atPoint:(CGPoint)point;
|
||||
|
||||
/**
|
||||
* Returns an action that holds down finger for 1.0 second (@c kGREYLongPressDefaultDuration) to
|
||||
* simulate a long press.
|
||||
*
|
||||
* @return A GREYAction that performs a long press on an element.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForLongPress;
|
||||
|
||||
/**
|
||||
* Returns an action that holds down finger for specified @c duration to simulate a long press.
|
||||
*
|
||||
* @param duration The duration of the long press.
|
||||
*
|
||||
* @return A GREYAction that performs a long press on an element.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForLongPressWithDuration:(CFTimeInterval)duration;
|
||||
|
||||
/**
|
||||
* Returns an action that holds down finger for specified @c duration at the specified @c point
|
||||
* (interpreted as being relative to the element) to simulate a long press.
|
||||
*
|
||||
* @param point The point that should be tapped.
|
||||
* @param duration The duration of the long press.
|
||||
*
|
||||
* @return A GREYAction that performs a long press on an element.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForLongPressAtPoint:(CGPoint)point duration:(CFTimeInterval)duration;
|
||||
|
||||
/**
|
||||
* Returns an action that scrolls a @c UIScrollView by @c amount (in points) in the specified
|
||||
* @c direction.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param amount The amount of points in CGPoints to scroll.
|
||||
*
|
||||
* @return A GREYAction that scrolls a scroll view in a given @c direction for a given @c amount.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForScrollInDirection:(GREYDirection)direction amount:(CGFloat)amount;
|
||||
|
||||
/**
|
||||
* Returns a scroll action that scrolls in a @c direction for an @c amount of points starting from
|
||||
* the given start point specified as percentages. @c xOriginStartPercentage is the x start
|
||||
* position as a percentage of the total width of the scrollable visible area,
|
||||
* @c yOriginStartPercentage is the y start position as a percentage of the total height of the
|
||||
* scrollable visible area. @c xOriginStartPercentage and @c yOriginStartPercentage must be between
|
||||
* 0 and 1, exclusive.
|
||||
*
|
||||
* @param direction The direction of the scroll.
|
||||
* @param amount The amount scroll in points to inject.
|
||||
* @param xOriginStartPercentage X coordinate of the start point specified as a percentage (0, 1)
|
||||
* exclusive, of the total width of the scrollable visible area.
|
||||
* @param yOriginStartPercentage Y coordinate of the start point specified as a percentage (0, 1)
|
||||
* exclusive, of the total height of the scrollable visible area.
|
||||
*
|
||||
* @return A GREYAction that scrolls a scroll view in a given @c direction for a given @c amount
|
||||
* starting from the given start points.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForScrollInDirection:(GREYDirection)direction
|
||||
amount:(CGFloat)amount
|
||||
xOriginStartPercentage:(CGFloat)xOriginStartPercentage
|
||||
yOriginStartPercentage:(CGFloat)yOriginStartPercentage;
|
||||
|
||||
/**
|
||||
* @return A GREYAction that scrolls to the given content @c edge of a scroll view.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForScrollToContentEdge:(GREYContentEdge)edge;
|
||||
|
||||
/**
|
||||
* A GREYAction that scrolls to the given content @c edge of a scroll view with the scroll action
|
||||
* starting from the given start point specified as percentages. @c xOriginStartPercentage is the x
|
||||
* start position as a percentage of the total width of the scrollable visible area,
|
||||
* @c yOriginStartPercentage is the y start position as a percentage of the total height of the
|
||||
* scrollable visible area. @c xOriginStartPercentage and @c yOriginStartPercentage must be between
|
||||
* 0 and 1, exclusive.
|
||||
*
|
||||
* @param edge The edge towards which the scrolling is to take place.
|
||||
* @param xOriginStartPercentage X coordinate of the start point specified as a percentage (0, 1)
|
||||
* exclusive, of the total width of the scrollable visible area.
|
||||
* @param yOriginStartPercentage Y coordinate of the start point specified as a percentage (0, 1)
|
||||
* exclusive, of the total height of the scrollable visible area.
|
||||
*
|
||||
* @return A GREYAction that scrolls to the given content @c edge of a scroll view with the scroll
|
||||
* action starting from the given start point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForScrollToContentEdge:(GREYContentEdge)edge
|
||||
xOriginStartPercentage:(CGFloat)xOriginStartPercentage
|
||||
yOriginStartPercentage:(CGFloat)yOriginStartPercentage;
|
||||
|
||||
/**
|
||||
* Returns an action that fast swipes through the view. The start point of the swipe is chosen to
|
||||
* achieve the maximum the swipe possible to the other edge.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
*
|
||||
* @return A GREYAction that performs a fast swipe in the given direction.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForSwipeFastInDirection:(GREYDirection)direction;
|
||||
|
||||
/**
|
||||
* Returns an action that slow swipes through the view. The start point of the swipe is chosen to
|
||||
* achieve maximum the swipe possible to the other edge.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
*
|
||||
* @return A GREYAction that performs a slow swipe in the given direction.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForSwipeSlowInDirection:(GREYDirection)direction;
|
||||
|
||||
/**
|
||||
* Returns an action that swipes through the view quickly in the given @c direction from a specific
|
||||
* origin.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param xOriginStartPercentage the x start position as a percentage of the total width
|
||||
* of the view. This must be between 0 and 1.
|
||||
* @param yOriginStartPercentage the y start position as a percentage of the total height
|
||||
* of the view. This must be between 0 and 1.
|
||||
*
|
||||
* @return A GREYAction that performs a fast swipe through a view in a specific direction from
|
||||
* the specified point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForSwipeFastInDirection:(GREYDirection)direction
|
||||
xOriginStartPercentage:(CGFloat)xOriginStartPercentage
|
||||
yOriginStartPercentage:(CGFloat)yOriginStartPercentage;
|
||||
|
||||
/**
|
||||
* Returns an action that swipes through the view quickly in the given @c direction from a
|
||||
* specific origin.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param xOriginStartPercentage the x start position as a percentage of the total width
|
||||
* of the view. This must be between 0 and 1.
|
||||
* @param yOriginStartPercentage the y start position as a percentage of the total height
|
||||
* of the view. This must be between 0 and 1.
|
||||
*
|
||||
* @return A GREYAction that performs a slow swipe through a view in a specific direction from
|
||||
* the specified point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForSwipeSlowInDirection:(GREYDirection)direction
|
||||
xOriginStartPercentage:(CGFloat)xOriginStartPercentage
|
||||
yOriginStartPercentage:(CGFloat)yOriginStartPercentage;
|
||||
|
||||
/**
|
||||
* Returns an action that performs a multi-finger slow swipe through the view in the given
|
||||
* @c direction.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param numberOfFingers Number of fingers touching the screen for the swipe.
|
||||
*
|
||||
* @return A GREYAction that performs a multi-finger slow swipe through a view in a specific
|
||||
* direction from the specified point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForMultiFingerSwipeSlowInDirection:(GREYDirection)direction
|
||||
numberOfFingers:(NSUInteger)numberOfFingers;
|
||||
|
||||
/**
|
||||
* Returns an action that performs a multi-finger fast swipe through the view in the given
|
||||
* @c direction.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param numberOfFingers Number of fingers touching the screen for the swipe.
|
||||
*
|
||||
* @return A GREYAction that performs a multi-finger fast swipe through a view in a specific
|
||||
* direction from the specified point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForMultiFingerSwipeFastInDirection:(GREYDirection)direction
|
||||
numberOfFingers:(NSUInteger)numberOfFingers;
|
||||
|
||||
/**
|
||||
* Returns an action that performs a multi-finger slow swipe through the view in the given
|
||||
* @c direction from a specified origin.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param numberOfFingers Number of fingers touching the screen for the swipe.
|
||||
* @param xOriginStartPercentage The x start position as a percentage of the total width
|
||||
* of the view. This must be between 0 and 1.
|
||||
* @param yOriginStartPercentage The y start position as a percentage of the total height
|
||||
* of the view. This must be between 0 and 1.
|
||||
*
|
||||
* @return A GREYAction that performs a multi-finger slow swipe through a view in a specific
|
||||
* direction from the specified point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForMultiFingerSwipeSlowInDirection:(GREYDirection)direction
|
||||
numberOfFingers:(NSUInteger)numberOfFingers
|
||||
xOriginStartPercentage:(CGFloat)xOriginStartPercentage
|
||||
yOriginStartPercentage:(CGFloat)yOriginStartPercentage;
|
||||
|
||||
/**
|
||||
* Returns an action that performs a multi-finger fast swipe through the view in the given
|
||||
* @c direction from a specified origin.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param numberOfFingers Number of fingers touching the screen for the swipe.
|
||||
* @param xOriginStartPercentage The x start position as a percentage of the total width
|
||||
* of the view. This must be between 0 and 1.
|
||||
* @param yOriginStartPercentage The y start position as a percentage of the total height
|
||||
* of the view. This must be between 0 and 1.
|
||||
*
|
||||
* @return A GREYAction that performs a multi-finger fast swipe through a view in a specific
|
||||
* direction from the specified point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForMultiFingerSwipeFastInDirection:(GREYDirection)direction
|
||||
numberOfFingers:(NSUInteger)numberOfFingers
|
||||
xOriginStartPercentage:(CGFloat)xOriginStartPercentage
|
||||
yOriginStartPercentage:(CGFloat)yOriginStartPercentage;
|
||||
|
||||
/**
|
||||
* Returns an action that pinches view quickly in the specified @c direction and @c angle.
|
||||
*
|
||||
* @param pinchDirection The direction of the pinch action.
|
||||
* @param angle The angle of the pinch action in radians.
|
||||
* Use @c kGREYPinchAngleDefault for the default angle (currently set to
|
||||
* 30 degrees).
|
||||
*
|
||||
* @return A GREYAction that performs a fast pinch on the view in the specified @c direction.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForPinchFastInDirection:(GREYPinchDirection)pinchDirection
|
||||
withAngle:(double)angle;
|
||||
|
||||
/**
|
||||
* Returns an action that pinches view slowly in the specified @c direction and @c angle.
|
||||
*
|
||||
* @param pinchDirection The direction of the pinch action.
|
||||
* @param angle The angle of the pinch action in radians.
|
||||
* Use @c kGREYPinchAngleDefault for the default angle (currently set to
|
||||
* 30 degrees).
|
||||
*
|
||||
* @return A GREYAction that performs a slow pinch on the view in the specified @c direction.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForPinchSlowInDirection:(GREYPinchDirection)pinchDirection
|
||||
withAngle:(double)angle;
|
||||
|
||||
/**
|
||||
* Returns an action that attempts to move slider to within 1.0e-6f values of @c value.
|
||||
*
|
||||
* @param value The value to which the slider should be moved. If this is not attainable after a
|
||||
* reasonable number of attempts (currently 10) we assume that the @c value is
|
||||
* unattainable for a user (it is probably the case this value resides between two
|
||||
* pixels). In this case, the slider will end up at a user attainable value
|
||||
* that is closest to @c value.
|
||||
*
|
||||
* @return A GREYAction that moves a slider to a given @c value.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForMoveSliderToValue:(float)value;
|
||||
|
||||
/**
|
||||
* Returns an action that changes the value of UIStepper to @c value by tapping the appropriate
|
||||
* button multiple times.
|
||||
*
|
||||
* @param value The value to change the UIStepper to.
|
||||
*
|
||||
* @return A GREYAction that sets the given @c value on a stepper.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForSetStepperValue:(double)value;
|
||||
|
||||
/**
|
||||
* Returns an action that taps on an element at the activation point of the element.
|
||||
*
|
||||
* @return A GREYAction to tap on an element.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForTap;
|
||||
|
||||
/**
|
||||
* Returns an action that taps on an element at the specified @c point.
|
||||
*
|
||||
* @param point The point that should be tapped. It must be in the coordinate system of the
|
||||
* element and it's position is relative to the origin of the element, as in
|
||||
* (element_width/2, element_height/2) will tap at the center of element.
|
||||
*
|
||||
* @return A GREYAction to tap on an element at a specific point.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForTapAtPoint:(CGPoint)point;
|
||||
|
||||
/**
|
||||
* Returns an action that uses the iOS keyboard to input a string.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @return A GREYAction to type a specific text string in a text field.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForTypeText:(NSString *)text;
|
||||
|
||||
/**
|
||||
* Returns an action that sets text on a UITextField or webview input directly.
|
||||
*
|
||||
* @param text The text to be typed.
|
||||
*
|
||||
* @return A GREYAction to type a specific text string in a text field.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForReplaceText:(NSString *)text;
|
||||
|
||||
/**
|
||||
* @return A GREYAction that clears a text field by injecting back-spaces.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForClearText;
|
||||
|
||||
/**
|
||||
* Returns an action that toggles a switch control. This action is applicable to all elements that
|
||||
* implement the selector UISwitch::isOn and include UISwitch controls.
|
||||
*
|
||||
* @param on The switch control state.
|
||||
*
|
||||
* @return A GREYAction to toggle a UISwitch.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForTurnSwitchOn:(BOOL)on;
|
||||
|
||||
/**
|
||||
* Returns an action that injects dates/times into UIDatePickers.
|
||||
*
|
||||
* @param date The date to set the UIDatePicker.
|
||||
*
|
||||
* @return A GREYAction that sets a given date/time on a UIDatePicker.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForSetDate:(NSDate *)date;
|
||||
|
||||
/**
|
||||
* Returns an action that selects @c value on the given @c column of a UIPickerView.
|
||||
*
|
||||
* @param column The UIPickerView column being set.
|
||||
* @param value The value to set the UIPickerView.
|
||||
*
|
||||
* @return A GREYAction to set the value of a specified column of a UIPickerView.
|
||||
*/
|
||||
+ (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.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForJavaScriptExecution:(NSString *)js
|
||||
output:(__strong NSString *_Nullable *_Nullable)outResult;
|
||||
|
||||
/**
|
||||
* Returns an action that takes a snapshot of the selected element.
|
||||
*
|
||||
* @param[out] outImage The UIImage where the image content is stored.
|
||||
*
|
||||
* @return A GREYAction that takes a snapshot of an UI element.
|
||||
*/
|
||||
+ (id<GREYAction>)actionForSnapshot:(__strong UIImage *_Nullable *_Nullable)outImage;
|
||||
|
||||
@end
|
||||
|
||||
#if !(GREY_DISABLE_SHORTHAND)
|
||||
/** Shorthand macro for GREYActions::actionForMultipleTapsWithCount: with count @c 2. */
|
||||
GREY_EXPORT id<GREYAction> grey_doubleTap(void);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForMultipleTapsWithCount: with count @c 2 and @c point.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_doubleTapAtPoint(CGPoint point);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForMultipleTapsWithCount:. */
|
||||
GREY_EXPORT id<GREYAction> grey_multipleTapsWithCount(NSUInteger count);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForLongPress. */
|
||||
GREY_EXPORT id<GREYAction> grey_longPress(void);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForLongPressWithDuration:. */
|
||||
GREY_EXPORT id<GREYAction> grey_longPressWithDuration(CFTimeInterval duration);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForLongPressAtPoint:duration:. */
|
||||
GREY_EXPORT id<GREYAction> grey_longPressAtPointWithDuration(CGPoint point,
|
||||
CFTimeInterval duration);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForScrollInDirection:amount:. */
|
||||
GREY_EXPORT id<GREYAction> grey_scrollInDirection(GREYDirection direction, CGFloat amount);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForScrollInDirection:amount:xOriginStartPercentage:yOriginStartPercentage:.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_scrollInDirectionWithStartPoint(GREYDirection direction,
|
||||
CGFloat amount,
|
||||
CGFloat xOriginStartPercentage,
|
||||
CGFloat yOriginStartPercentage);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForScrollToContentEdge:. */
|
||||
GREY_EXPORT id<GREYAction> grey_scrollToContentEdge(GREYContentEdge edge);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForScrollToContentEdge:xOriginStartPercentage:yOriginStartPercentage:.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_scrollToContentEdgeWithStartPoint(GREYContentEdge edge,
|
||||
CGFloat xOriginStartPercentage,
|
||||
CGFloat yOriginStartPercentage);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForSwipeFastInDirection:. */
|
||||
GREY_EXPORT id<GREYAction> grey_swipeFastInDirection(GREYDirection direction);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForSwipeSlowInDirection:. */
|
||||
GREY_EXPORT id<GREYAction> grey_swipeSlowInDirection(GREYDirection direction);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForSwipeFastInDirection:xOriginStartPercentage:yOriginStartPercentage:.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_swipeFastInDirectionWithStartPoint(GREYDirection direction,
|
||||
CGFloat xOriginStartPercentage,
|
||||
CGFloat yOriginStartPercentage);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForSwipeSlowInDirection:xOriginStartPercentage:yOriginStartPercentage:.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_swipeSlowInDirectionWithStartPoint(GREYDirection direction,
|
||||
CGFloat xOriginStartPercentage,
|
||||
CGFloat yOriginStartPercentage);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForMultiFingerSwipeSlowInDirection:numberOfFingers:.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_multiFingerSwipeSlowInDirection(GREYDirection direction,
|
||||
NSUInteger numberOfFingers);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForMultiFingerSwipeFastInDirection:numberOfFingers:.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_multiFingerSwipeFastInDirection(GREYDirection direction,
|
||||
NSUInteger numberOfFingers);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForMultiFingerSwipeSlowInDirection:numberOfFingers:xOriginStartPercentage:
|
||||
* yOriginStartPercentage:.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_multiFingerSwipeSlowInDirectionWithStartPoint(
|
||||
GREYDirection direction,
|
||||
NSUInteger numberOfFingers,
|
||||
CGFloat xOriginStartPercentage,
|
||||
CGFloat yOriginStartPercentage);
|
||||
|
||||
/**
|
||||
* Shorthand macro for
|
||||
* GREYActions::actionForMultiFingerSwipeFastInDirection:numberOfFingers:xOriginStartPercentage:
|
||||
* yOriginStartPercentage:.
|
||||
*/
|
||||
GREY_EXPORT id<GREYAction> grey_multiFingerSwipeFastInDirectionWithStartPoint(
|
||||
GREYDirection direction,
|
||||
NSUInteger numberOfFingers,
|
||||
CGFloat xOriginStartPercentage,
|
||||
CGFloat yOriginStartPercentage);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForPinchFastInDirection:pinchDirection:angle:. */
|
||||
GREY_EXPORT id<GREYAction> grey_pinchFastInDirectionAndAngle(GREYPinchDirection pinchDirection,
|
||||
double angle);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForPinchSlowInDirection:pinchDirection:angle:. */
|
||||
GREY_EXPORT id<GREYAction> grey_pinchSlowInDirectionAndAngle(GREYPinchDirection pinchDirection,
|
||||
double angle);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForMoveSliderToValue:. */
|
||||
GREY_EXPORT id<GREYAction> grey_moveSliderToValue(float value);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForSetStepperValue:. */
|
||||
GREY_EXPORT id<GREYAction> grey_setStepperValue(double value);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForTap. */
|
||||
GREY_EXPORT id<GREYAction> grey_tap(void);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForTapAtPoint:. */
|
||||
GREY_EXPORT id<GREYAction> grey_tapAtPoint(CGPoint point);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForTypeText:. */
|
||||
GREY_EXPORT id<GREYAction> grey_typeText(NSString *text);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForReplaceText:. */
|
||||
GREY_EXPORT id<GREYAction> grey_replaceText(NSString *text);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForClearText. */
|
||||
GREY_EXPORT id<GREYAction> grey_clearText(void);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForTurnSwitchOn:. */
|
||||
GREY_EXPORT id<GREYAction> grey_turnSwitchOn(BOOL on);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForSetDate:. */
|
||||
GREY_EXPORT id<GREYAction> grey_setDate(NSDate *date);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForSetPickerColumn:toValue:. */
|
||||
GREY_EXPORT id<GREYAction> grey_setPickerColumnToValue(NSInteger column, NSString *value);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForJavaScriptExecution:output:. */
|
||||
GREY_EXPORT id<GREYAction> grey_javaScriptExecution(
|
||||
NSString *js, __strong NSString *_Nullable *_Nullable outResult);
|
||||
|
||||
/** Shorthand macro for GREYActions::actionForSnapshot:. */
|
||||
GREY_EXPORT id<GREYAction> grey_snapshot(__strong UIImage *_Nullable *_Nullable outImage);
|
||||
|
||||
#endif // GREY_DISABLE_SHORTHAND
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
84
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAllOf.h
generated
Normal file
84
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAllOf.h
generated
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
#import <EarlGrey/GREYBaseMatcher.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A matcher for combining multiple matchers with a logical @c AND operator, so that a match
|
||||
* only occurs when all combined matchers match the element. The invocation of the matchers
|
||||
* is in the same order in which they are passed. As soon as one matcher fails, the
|
||||
* rest of the matchers are not invoked.
|
||||
*/
|
||||
@interface GREYAllOf : GREYBaseMatcher
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Designated initializer that adds the different matchers to be combined.
|
||||
*
|
||||
* @param matchers Matchers that conform to GREYMatcher and will be combined together with
|
||||
* a logical AND in the order they are passed in.
|
||||
*
|
||||
* @return An instance of GREYAllOf, initialized with the provided @c matchers.
|
||||
*/
|
||||
- (instancetype)initWithMatchers:(NSArray<__kindof id<GREYMatcher>> *)matchers
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
#if !(GREY_DISABLE_SHORTHAND)
|
||||
|
||||
/**
|
||||
* A shorthand matcher that is a logical AND of all the matchers passed in as variable arguments.
|
||||
*
|
||||
* @param first The first matcher in the list of matchers.
|
||||
* @param second The second matcher in the list of matchers.
|
||||
* @param thirdOrNil The third matcher in the list of matchers, optionally the nil terminator.
|
||||
* @param ... Any more matchers to be added. Matchers are invoked in the order they are
|
||||
* specified and only if the preceding matcher passes. This va-arg must be
|
||||
* terminated with a @c nil value.
|
||||
*
|
||||
* @return An object conforming to GREYMatcher, initialized with the required matchers.
|
||||
*/
|
||||
GREY_EXPORT id<GREYMatcher> grey_allOf(id<GREYMatcher> first,
|
||||
id<GREYMatcher> second,
|
||||
id<GREYMatcher> _Nullable thirdOrNil,
|
||||
...)
|
||||
NS_SWIFT_UNAVAILABLE("Use grey_allOf(_:) instead") NS_REQUIRES_NIL_TERMINATION;
|
||||
|
||||
/**
|
||||
* A shorthand matcher that is a logical AND of all the matchers passed in within an NSArray.
|
||||
*
|
||||
* @param matchers An NSArray of one or more matchers to be added. Matchers are invoked in the
|
||||
* order they are specified and only if the preceding matcher passes.
|
||||
*
|
||||
* @return An object conforming to GREYMatcher, initialized with the required matchers.
|
||||
*/
|
||||
GREY_EXPORT id<GREYMatcher>
|
||||
grey_allOfMatchers(NSArray<__kindof id<GREYMatcher>> *matchers)
|
||||
NS_SWIFT_NAME(grey_allOf(_:));
|
||||
|
||||
#endif // GREY_DISABLE_SHORTHAND
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
84
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAnyOf.h
generated
Normal file
84
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAnyOf.h
generated
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
#import <EarlGrey/GREYBaseMatcher.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Matcher for combining multiple matchers with a logical @c OR operator, so that a match occurs
|
||||
* when any of the matchers match the element. The invocation of the matchers is in the same
|
||||
* order in which they are passed. As soon as one of the matchers succeeds, the rest are
|
||||
* not invoked.
|
||||
*/
|
||||
@interface GREYAnyOf : GREYBaseMatcher
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Designated initializer to add all the matchers to be checked.
|
||||
*
|
||||
* @param matchers The matchers, one of which is required to be matched by the matcher.
|
||||
* They are invoked in the order that they are passed in.
|
||||
*
|
||||
* @return An instance of GREYAnyOf, initialized with the provided matchers.
|
||||
*/
|
||||
- (instancetype)initWithMatchers:(NSArray<__kindof id<GREYMatcher>> *)matchers
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
#if !(GREY_DISABLE_SHORTHAND)
|
||||
|
||||
/**
|
||||
* A matcher that is a logical OR of all the matchers passed in as variable arguments.
|
||||
*
|
||||
* @param first The first matcher in the list of matchers.
|
||||
* @param second The second matcher in the list of matchers.
|
||||
* @param thirdOrNil The third matcher in the list of matchers, optionally the nil terminator.
|
||||
* @param ... Any more matchers to be added. Matchers are invoked in the order they are
|
||||
* specified and only if the preceding matcher fails.
|
||||
* This va-arg must be terminated with a @c nil value.
|
||||
*
|
||||
* @return An object conforming to GREYMatcher, initialized with the required matchers.
|
||||
*/
|
||||
GREY_EXPORT id<GREYMatcher> grey_anyOf(id<GREYMatcher> first,
|
||||
id<GREYMatcher> second,
|
||||
id<GREYMatcher> _Nullable thirdOrNil,
|
||||
...)
|
||||
NS_SWIFT_UNAVAILABLE("Use grey_anyOf(_:) instead")
|
||||
NS_REQUIRES_NIL_TERMINATION;
|
||||
|
||||
/**
|
||||
* A matcher that is a logical OR of all the matchers passed in within an NSArray.
|
||||
*
|
||||
* @param matchers An array of one more matchers to be added. Matchers are invoked in the order
|
||||
* they are specified and only if the preceding matcher fails.
|
||||
*
|
||||
* @return An object conforming to GREYMatcher, initialized with the required matchers.
|
||||
*/
|
||||
GREY_EXPORT id<GREYMatcher> grey_anyOfMatchers(NSArray<__kindof id<GREYMatcher>> *matchers)
|
||||
NS_SWIFT_NAME(grey_anyOf(_:));
|
||||
|
||||
#endif // GREY_DISABLE_SHORTHAND
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
51
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAssertion.h
generated
Normal file
51
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAssertion.h
generated
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Protocol to which EarlGrey assertion classes must conform.
|
||||
*/
|
||||
@protocol GREYAssertion<NSObject>
|
||||
|
||||
/**
|
||||
* Checks whether the assertion is valid for the provided @c element, throwing an exception if the
|
||||
* if the assertion fails and the @c errorOrNil parameter is @c nil. If a non-nil @c errorOrNil is
|
||||
* provided, it will be set to error that represents the assertion failure cause.
|
||||
* If the assertion does not accept @c nil elements, the error domain should be
|
||||
* @c kGREYInteractionErrorDomain and the error code @c kGREYInteractionElementNotFoundErrorCode.
|
||||
* GREYAssertionDefines.h defines macros for throwing common exception types.
|
||||
*
|
||||
* @param element Element on which the assertion should be checked.
|
||||
* @param[out] errorOrNil If non-nil, set to the cause of the assertion failure.
|
||||
*
|
||||
* @throws NSException If the assertion fails and the provided @c errorOrNil is @c nil.
|
||||
* The specific type depends on the implementation.
|
||||
*
|
||||
* @return @c YES if the assertion holds for the specified element, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)assert:(_Nullable id)element error:(__strong NSError *_Nullable *_Nullable)errorOrNil;
|
||||
|
||||
/**
|
||||
* @return The name of the assertion.
|
||||
*/
|
||||
- (NSString *)name;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYAssertion.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A block that accepts an @c element, which will be invoked when an assertion is going to be
|
||||
* performed on the element. If the assertion fails and a non-nil @c errorOrNil is provided,
|
||||
* the block should populate it with the cause of failure.
|
||||
*
|
||||
* @param element Element that the assertion will be checked against.
|
||||
* @param[out] errorOrNil If non-nil, set to the cause of the assertion failure.
|
||||
*
|
||||
* @return @c YES if the assertion is valid for @c element, @c NO otherwise.
|
||||
*/
|
||||
typedef BOOL (^GREYCheckBlockWithError)(_Nullable id element,
|
||||
__strong NSError *_Nullable *_Nullable errorOrNil);
|
||||
|
||||
/**
|
||||
* An interface to create GREYAssertions from blocks.
|
||||
*/
|
||||
@interface GREYAssertionBlock : NSObject<GREYAssertion>
|
||||
|
||||
/**
|
||||
* Creates an assertion with the given @c name and @c block that is executed when
|
||||
* GREYAssertion::assert:error: selector is performed on the assertion.
|
||||
*
|
||||
* @param name The assertion name.
|
||||
* @param block The block that will be invoked to perform the assertion.
|
||||
*
|
||||
* @return A new block-based assertion object.
|
||||
*/
|
||||
+ (instancetype)assertionWithName:(NSString *)name
|
||||
assertionBlockWithError:(GREYCheckBlockWithError)block;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes an assertion with the given @c name and @c block that is executed when
|
||||
* GREYAssertion::assert:error: selector is performed on the assertion.
|
||||
*
|
||||
* @param name The assertion name.
|
||||
* @param block The block that will be invoked to perform the assertion.
|
||||
*
|
||||
* @return The initialized assertion object.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
assertionBlockWithError:(GREYCheckBlockWithError)block NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,423 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Helper macros for performing assertions and throwing assertion failure exceptions.
|
||||
* On failure, these macros take screenshots and log full view hierarchy. They wait for app to idle
|
||||
* before performing the assertion.
|
||||
*/
|
||||
|
||||
#ifndef GREY_ASSERTION_DEFINES_H
|
||||
#define GREY_ASSERTION_DEFINES_H
|
||||
|
||||
#import <EarlGrey/GREYConfiguration.h>
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
#import <EarlGrey/GREYFailureHandler.h>
|
||||
#import <EarlGrey/GREYFrameworkException.h>
|
||||
#import <EarlGrey/GREYUIThreadExecutor.h>
|
||||
|
||||
/**
|
||||
* Exposes internal method to get the failure handler registered with EarlGrey.
|
||||
* It must be called from main thread otherwise the behavior is undefined.
|
||||
*/
|
||||
GREY_EXPORT id<GREYFailureHandler> grey_getFailureHandler(void);
|
||||
|
||||
/**
|
||||
* These Macros are safe to call from anywhere within a testcase.
|
||||
*/
|
||||
#pragma mark - Public Macros
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 evaluates to
|
||||
* @c NO.
|
||||
*
|
||||
* @param __a1 The expression that should be evaluated.
|
||||
* @param __description Description to print if @c __a1 evaluates to @c NO. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssert(__a1, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = @"Couldn't assert that (" #__a1 ") is true."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertTrue((__a1), (__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 evaluates to
|
||||
* @c NO.
|
||||
*
|
||||
* @param __a1 The expression that should be evaluated.
|
||||
* @param __description Description to print if @c __a1 evaluates to @c NO. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssertTrue(__a1, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = @"Couldn't assert that (" #__a1 ") is true."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertTrue((__a1), (__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 evaluates to
|
||||
* @c YES.
|
||||
*
|
||||
* @param __a1 The expression that should be evaluated.
|
||||
* @param __description Description to print if @c __a1 evaluates to @c NO. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssertFalse(__a1, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = @"Couldn't assert that (" #__a1 ") is false."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertFalse((__a1), (__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 is @c nil.
|
||||
*
|
||||
* @param __a1 The expression that should be evaluated.
|
||||
* @param __description Description to print if @c __a1 is @c nil. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssertNotNil(__a1, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = @"Couldn't assert that (" #__a1 ") is not nil."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertNotNil((__a1), (__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 is not @c nil.
|
||||
*
|
||||
* @param __a1 The expression that should be evaluated.
|
||||
* @param __description Description to print if @c __a1 is not @c nil. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssertNil(__a1, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = @"Couldn't assert that (" #__a1 ") is nil."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertNil((__a1), (__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 and
|
||||
* the expression @c __a2 are not equal.
|
||||
* @c __a1 and @c __a2 must be scalar types.
|
||||
*
|
||||
* @param __a1 The left hand scalar value on the equality operation.
|
||||
* @param __a2 The right hand scalar value on the equality operation.
|
||||
* @param __description Description to print if @c __a1 and @c __a2 are not equal. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssertEqual(__a1, __a2, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = @"Couldn't assert that (" #__a1 ") and (" #__a2 ") are equal."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertEqual((__a1), (__a2), (__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 and
|
||||
* the expression @c __a2 are equal.
|
||||
* @c __a1 and @c __a2 must be scalar types.
|
||||
*
|
||||
* @param __a1 The left hand scalar value on the equality operation.
|
||||
* @param __a2 The right hand scalar value on the equality operation.
|
||||
* @param __description Description to print if @c __a1 and @c __a2 are equal. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssertNotEqual(__a1, __a2, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = \
|
||||
@"Couldn't assert that (" #__a1 ") and (" #__a2 ") are not equal."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertNotEqual((__a1), (__a2), (__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 and
|
||||
* the expression @c __a2 are not equal.
|
||||
* @c __a1 and @c __a2 must be descendants of NSObject and will be compared with method isEqual.
|
||||
*
|
||||
* @param __a1 The left hand object on the equality operation.
|
||||
* @param __a2 The right hand object on the equality operation.
|
||||
* @param __description Description to print if @c __a1 and @c __a2 are not equal. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssertEqualObjects(__a1, __a2, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = \
|
||||
@"Couldn't assert that (" #__a1 ") and (" #__a2 ") are equal objects."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertEqualObjects((__a1), (__a2), __description, ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure with the provided @c __description if the expression @c __a1 and
|
||||
* the expression @c __a2 are equal.
|
||||
* @c __a1 and @c __a2 must be descendants of NSObject and will be compared with method isEqual.
|
||||
*
|
||||
* @param __a1 The left hand object on the equality operation.
|
||||
* @param __a2 The right hand object on the equality operation.
|
||||
* @param __description Description to print if @c __a1 and @c __a2 are equal. May be a format
|
||||
* string, in which case the variable args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYAssertNotEqualObjects(__a1, __a2, __description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
NSString *timeoutString__ = \
|
||||
@"Couldn't assert that (" #__a1 ") and (" #__a2 ") are not equal objects."; \
|
||||
I_GREYWaitForIdle(timeoutString__); \
|
||||
I_GREYAssertNotEqualObjects((__a1), (__a2), (__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure unconditionally, with the provided @c __description.
|
||||
*
|
||||
* @param __description Description to print. May be a format string, in which case the variable
|
||||
* args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYFail(__description, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
I_GREYFail((__description), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure unconditionally, with the provided @c __description and @c __details.
|
||||
*
|
||||
* @param __description Description to print.
|
||||
* @param __details The failure details. May be a format string, in which case the variable
|
||||
* args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYFailWithDetails(__description, __details, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
I_GREYFailWithDetails((__description), (__details), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
/**
|
||||
* Generates a failure unconditionally for when the constraints for performing an action fail,
|
||||
* with the provided @c __description and @c __details.
|
||||
*
|
||||
* @param __description Description to print.
|
||||
* @param __details The failure details. May be a format string, in which case the variable
|
||||
* args will be required.
|
||||
* @param ... Variable args for @c __description if it is a format string.
|
||||
*/
|
||||
#define GREYConstraintsFailedWithDetails(__description, __details, ...) \
|
||||
({ \
|
||||
I_GREYSetCurrentAsFailable(); \
|
||||
I_GREYConstraintsFailedWithDetails((__description), (__details), ##__VA_ARGS__); \
|
||||
})
|
||||
|
||||
#pragma mark - Private Macros
|
||||
|
||||
/**
|
||||
* THESE ARE METHODS TO BE CALLED BY THE FRAMEWORK ONLY.
|
||||
* DO NOT CALL OUTSIDE FRAMEWORK
|
||||
*/
|
||||
|
||||
/// @cond INTERNAL
|
||||
|
||||
// No private macro should call this.
|
||||
#define I_GREYSetCurrentAsFailable() \
|
||||
({ \
|
||||
id<GREYFailureHandler> failureHandler__ = grey_getFailureHandler(); \
|
||||
if ([failureHandler__ respondsToSelector:@selector(setInvocationFile:andInvocationLine:)]) { \
|
||||
[failureHandler__ setInvocationFile:[NSString stringWithUTF8String:__FILE__] \
|
||||
andInvocationLine:__LINE__]; \
|
||||
} \
|
||||
})
|
||||
|
||||
// No private macro should call this.
|
||||
#define I_GREYWaitForIdle(__timeoutDescription) \
|
||||
({ \
|
||||
CFTimeInterval interactionTimeout__ = \
|
||||
GREY_CONFIG_DOUBLE(kGREYConfigKeyInteractionTimeoutDuration); \
|
||||
NSError *error__; \
|
||||
BOOL success__ = \
|
||||
[[GREYUIThreadExecutor sharedInstance] executeSyncWithTimeout:interactionTimeout__ \
|
||||
block:nil \
|
||||
error:&error__]; \
|
||||
if (!success__) { \
|
||||
I_GREYTimeout(__timeoutDescription, @"Timed out waiting for app to idle. %@", error__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYFormattedString(__var, __format, ...) \
|
||||
({ \
|
||||
/* clang warns us about a leak in formatting but we don't care as we are about to fail. */ \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wformat-nonliteral\"") \
|
||||
_Pragma("clang diagnostic ignored \"-Wformat-security\"") \
|
||||
(__var) = [NSString stringWithFormat:(__format), ##__VA_ARGS__]; \
|
||||
_Pragma("clang diagnostic pop") \
|
||||
})
|
||||
|
||||
#define I_GREYRegisterFailure(__exceptionName, __description, __details, ...) \
|
||||
({ \
|
||||
NSString *details__; \
|
||||
I_GREYFormattedString(details__, __details, ##__VA_ARGS__); \
|
||||
id<GREYFailureHandler> failureHandler__ = grey_getFailureHandler(); \
|
||||
[failureHandler__ handleException:[GREYFrameworkException exceptionWithName:__exceptionName \
|
||||
reason:(__description)] \
|
||||
details:(details__)]; \
|
||||
})
|
||||
|
||||
#define I_GREYAssertTrue(__a1, __description, ...) \
|
||||
({ \
|
||||
if (!(__a1)) { \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, (__description), ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYAssertionFailedException, \
|
||||
@"(" #__a1 " is true) failed", \
|
||||
formattedDescription__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYAssertFalse(__a1, __description, ...) \
|
||||
({ \
|
||||
if ((__a1)) { \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, (__description), ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYAssertionFailedException, \
|
||||
@"(" #__a1 " is false) failed", \
|
||||
formattedDescription__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYAssertNotNil(__a1, __description, ...) \
|
||||
({ \
|
||||
if ((__a1) == nil) { \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, (__description), ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYNotNilException, \
|
||||
@"(" #__a1 " != nil) failed", \
|
||||
formattedDescription__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYAssertNil(__a1, __description, ...) \
|
||||
({ \
|
||||
if ((__a1) != nil) { \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, (__description), ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYNilException, \
|
||||
@"(" #__a1 " == nil) failed", \
|
||||
formattedDescription__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYAssertEqual(__a1, __a2, __description, ...) \
|
||||
({ \
|
||||
if ((__a1) != (__a2)) { \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, (__description), ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYAssertionFailedException, \
|
||||
@"(" #__a1 " == (" #__a2 ")) failed", \
|
||||
formattedDescription__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYAssertNotEqual(__a1, __a2, __description, ...) \
|
||||
({ \
|
||||
if ((__a1) == (__a2)) { \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, (__description), ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYAssertionFailedException, \
|
||||
@"(" #__a1 " != (" #__a2 ")) failed", \
|
||||
formattedDescription__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYAssertEqualObjects(__a1, __a2, __description, ...) \
|
||||
({ \
|
||||
if (![(__a1) isEqual:(__a2)]) { \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, (__description), ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYAssertionFailedException, \
|
||||
@"[" #__a1 " isEqual:(" #__a2 ")] failed", \
|
||||
formattedDescription__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYAssertNotEqualObjects(__a1, __a2, __description, ...) \
|
||||
({ \
|
||||
if ([(__a1) isEqual:(__a2)]) { \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, (__description), ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYAssertionFailedException, \
|
||||
@"![" #__a1 " isEqual:(" #__a2 ")] failed", \
|
||||
formattedDescription__); \
|
||||
} \
|
||||
})
|
||||
|
||||
#define I_GREYFail(__description, ...) \
|
||||
({ \
|
||||
NSString *formattedDescription__; \
|
||||
I_GREYFormattedString(formattedDescription__, __description, ##__VA_ARGS__); \
|
||||
I_GREYRegisterFailure(kGREYGenericFailureException, formattedDescription__, @""); \
|
||||
})
|
||||
|
||||
#define I_GREYFailWithDetails(__description, __details, ...) \
|
||||
I_GREYRegisterFailure(kGREYGenericFailureException, __description, __details, ##__VA_ARGS__)
|
||||
|
||||
#define I_GREYConstraintsFailedWithDetails(__description, __details, ...) \
|
||||
I_GREYRegisterFailure(kGREYConstraintFailedException, __description, __details, ##__VA_ARGS__)
|
||||
|
||||
#define I_GREYTimeout(__description, __details, ...) \
|
||||
I_GREYRegisterFailure(kGREYTimeoutException, __description, __details, ##__VA_ARGS__)
|
||||
|
||||
#define I_GREYActionFail(__description, __details, ...) \
|
||||
I_GREYRegisterFailure(kGREYActionFailedException, __description, __details, ##__VA_ARGS__)
|
||||
|
||||
#define I_GREYAssertionFail(__description, __details, ...) \
|
||||
I_GREYRegisterFailure(kGREYAssertionFailedException, __description, __details, ##__VA_ARGS__)
|
||||
|
||||
#define I_GREYElementNotFound(__description, __details, ...) \
|
||||
I_GREYRegisterFailure(kGREYNoMatchingElementException, __description, __details, ##__VA_ARGS__)
|
||||
|
||||
#define I_GREYMultipleElementsFound(__description, __details, ...) \
|
||||
I_GREYRegisterFailure(kGREYMultipleElementsFoundException, \
|
||||
__description, \
|
||||
__details, \
|
||||
##__VA_ARGS__)
|
||||
|
||||
/// @endcond
|
||||
|
||||
#endif // GREY_ASSERTION_DEFINES_H
|
||||
23
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAssertions.h
generated
Normal file
23
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYAssertions.h
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* An interface that exposes UI element assertions.
|
||||
*/
|
||||
@interface GREYAssertions : NSObject
|
||||
@end
|
||||
66
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYBaseAction.h
generated
Normal file
66
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYBaseAction.h
generated
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYAction.h>
|
||||
|
||||
@protocol GREYMatcher;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A base class for all actions that incorporates commonalities between initialization
|
||||
* parameters and constraint checking.
|
||||
*/
|
||||
@interface GREYBaseAction : NSObject<GREYAction>
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* The designated initializer for a base action with the provided @c constraints.
|
||||
*
|
||||
* @param name The name of the GREYAction being performed.
|
||||
*
|
||||
* @param constraints The constraints to be satisified by the element before the
|
||||
* action is performed.
|
||||
*
|
||||
* @return An instance of GREYBaseAction, initialized with the @c constraints for it to check for.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* A method that checks that @c element satisfies @c constraints this action was initialized with.
|
||||
* Subclasses should call this method if they want to check for constraints in their perform:error:
|
||||
* implementation.
|
||||
*
|
||||
* @param element A UI element being checked for the @c constraints.
|
||||
* @param[out] errorOrNilPtr Error stored when an element did not satisfy the @c constraints.
|
||||
* If an error is set but this pointer is @c nil,
|
||||
* then an action failed exception is thrown.
|
||||
*
|
||||
* @throws GREYFrameworkException if constraints fail and @c errorOrNilPtr is not provided.
|
||||
*
|
||||
* @return @c YES if the constraints are satisfied on the element. @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)satisfiesConstraintsForElement:(id)element error:(__strong NSError **)errorOrNilPtr;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYMatcher.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A base class that implements the GREYMatcher protocol methods.
|
||||
* Prefer subclassing this class over creating your own matchers.
|
||||
* Every subclass must override and provide its own implementation for GREYBaseMatcher::matches:
|
||||
* and GREYBaseMatcher::describeTo: methods.
|
||||
*/
|
||||
@interface GREYBaseMatcher : NSObject<GREYMatcher, NSCopying>
|
||||
|
||||
#pragma mark - GREYMatcher
|
||||
|
||||
/**
|
||||
* @see GREYMatcher::matches:
|
||||
*
|
||||
* @remark Subclasses are required to implement this method.
|
||||
*/
|
||||
- (BOOL)matches:(_Nullable id)item;
|
||||
|
||||
/**
|
||||
* @see GREYMatcher::describeTo:
|
||||
*
|
||||
* @remark Subclasses are required to implement this method.
|
||||
*/
|
||||
- (void)describeTo:(id<GREYDescription>)description;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
93
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYCondition.h
generated
Normal file
93
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYCondition.h
generated
Normal file
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A class for creating boolean conditions that can be waited on until the condition is satisfied
|
||||
* or a timeout elapses.
|
||||
*
|
||||
* Conditions are specified in the form of a block that returns a @c BOOL value indicating whether
|
||||
* the condition is met.
|
||||
*/
|
||||
@interface GREYCondition : NSObject
|
||||
|
||||
/**
|
||||
* Creates a condition with a block that should return @c YES when the condition is met.
|
||||
*
|
||||
* @param name A descriptive name for the condition
|
||||
* @param conditionBlock The block that will be used to evaluate the condition.
|
||||
*
|
||||
* @return A new initialized GREYCondition instance.
|
||||
*/
|
||||
+ (instancetype)conditionWithName:(NSString *)name block:(BOOL(^)(void))conditionBlock;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes a condition with a block that should return @c YES when the condition is met.
|
||||
*
|
||||
* @param name A descriptive name for the condition
|
||||
* @param conditionBlock The block that will be used to evaluate the condition.
|
||||
*
|
||||
* @return The initialized instance.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
block:(BOOL(^)(void))conditionBlock NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Waits for the condition to be met until the specified @c seconds have elapsed.
|
||||
*
|
||||
* Will poll the condition as often as possible on the main thread while still giving a fair chance
|
||||
* for other sources and handlers to be serviced.
|
||||
*
|
||||
* @remark Waiting on conditions with this method is very CPU intensive on the main thread. If
|
||||
* you do not need to return immediately after the condition is met, the consider using
|
||||
* GREYCondition::waitWithTimeout:pollInterval:
|
||||
*
|
||||
* @param seconds Amount of time to wait for the condition to be met, in seconds.
|
||||
*
|
||||
* @return @c YES if the condition was met before the timeout, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)waitWithTimeout:(CFTimeInterval)seconds;
|
||||
|
||||
/**
|
||||
* Waits for the condition to be met until the specified @c seconds have elapsed. Will poll the
|
||||
* condition immediately and then no more than once every @c interval seconds. Will attempt to poll
|
||||
* the condition as close as possible to every @c interval seconds.
|
||||
*
|
||||
* @remark Will allow the main thread to sleep instead of busily checking the condition.
|
||||
*
|
||||
* @param seconds Amount of time to wait for the condition to be met, in seconds.
|
||||
* @param interval The minimum time that should elapse between checking the condition.
|
||||
*
|
||||
* @return @c YES if the condition was met before the timeout, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)waitWithTimeout:(CFTimeInterval)seconds pollInterval:(CFTimeInterval)interval;
|
||||
|
||||
/**
|
||||
* @return Name of the condition.
|
||||
*/
|
||||
- (NSString *)name;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
311
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYConfiguration.h
generated
Normal file
311
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYConfiguration.h
generated
Normal file
@@ -0,0 +1,311 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYConfiguration.h
|
||||
* @brief A key-value store for configuring global behavior. Configuration values are read just
|
||||
* before performing a related function. On-going functions may not be affected by the
|
||||
* changes in the configuration until the values are re-read.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Configuration that enables or disables usage tracking for the framework.
|
||||
*
|
||||
* Accepted values: @c BOOL (i.e. @c YES or @c NO)
|
||||
* Default value: @c YES
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyAnalyticsEnabled;
|
||||
|
||||
/**
|
||||
* Configuration that enables or disables constraint checks before performing an action.
|
||||
*
|
||||
* Accepted values: @c BOOL (i.e. @c YES or @c NO)
|
||||
* Default value: @c YES
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyActionConstraintsEnabled;
|
||||
|
||||
/**
|
||||
* Configuration that holds timeout duration (in seconds) for actions and assertions. Actions or
|
||||
* assertions that are not scheduled within this time will fail with a timeout. If the action or
|
||||
* assertion starts within the timeout duration and if a search action is provided, then the search
|
||||
* action will execute at least once regardless of the timeout duration.
|
||||
*
|
||||
* Accepted values: @c double (negative values are invalid)
|
||||
* Default value: 30.0
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyInteractionTimeoutDuration;
|
||||
|
||||
/**
|
||||
* Configuration that enables or disables EarlGrey's synchronization feature.
|
||||
* When disabled, any command that used to wait for the app to idle before proceeding will no
|
||||
* longer do so.
|
||||
*
|
||||
* @remark For more fine-grained control over synchronization parameters, you can tweak other
|
||||
* provided configuration options below.
|
||||
*
|
||||
* Accepted values: @c BOOL (i.e. @c YES or @c NO)
|
||||
* Default value: @c YES
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeySynchronizationEnabled;
|
||||
|
||||
/**
|
||||
* Configuration for setting the max interval (in seconds) of non-repeating NSTimers that EarlGrey
|
||||
* will automatically track.
|
||||
*
|
||||
* Accepted values: @c double (negative values are invalid)
|
||||
* Default value: 1.5
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyNSTimerMaxTrackableInterval;
|
||||
|
||||
/**
|
||||
* Configuration for setting the max delay (in seconds) for dispatch_after and dispatch_after_f
|
||||
* calls that EarlGrey will automatically track. dispatch_after and dispatch_after_f calls
|
||||
* exceeding the specified time won't be tracked by the framework.
|
||||
*
|
||||
* Accepted values: @c double (negative values are invalid)
|
||||
* Default value: 1.5
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyDispatchAfterMaxTrackableDelay;
|
||||
|
||||
/**
|
||||
* Configuration for setting the max duration (in seconds) for delayed executions on the
|
||||
* main thread originating from any performSelector:afterDelay invocations that EarlGrey will
|
||||
* automatically track.
|
||||
*
|
||||
* Accepted values: @c double (negative values are invalid)
|
||||
* Default value: 1.5
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyDelayedPerformMaxTrackableDuration;
|
||||
|
||||
/**
|
||||
* Configuration that determines whether or not CALayer animations are modified. If @c YES, then
|
||||
* cyclic animations are set to run only once and the animation duration is limited to a maximum
|
||||
* of @c kGREYConfigKeyCALayerMaxAnimationDuration.
|
||||
*
|
||||
* @remark This should only be used if synchronization is disabled; otherwise cyclic animations
|
||||
* will cause EarlGrey to timeout and fail tests.
|
||||
*
|
||||
* Accepted values: @c BOOL (i.e. @c YES or @c NO)
|
||||
* Default value: @c YES
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyCALayerModifyAnimations;
|
||||
|
||||
/**
|
||||
* Configuration for setting max allowable animation duration (in seconds) for any CALayer based
|
||||
* animation. Animations exceeding the specified time will have their duration truncated to value
|
||||
* specified by this config.
|
||||
*
|
||||
* Accepted values: @c double (negative values are invalid)
|
||||
* Default value: 10.0
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyCALayerMaxAnimationDuration;
|
||||
|
||||
/**
|
||||
* Configuration that holds regular expressions for URLs that are blacklisted from synchronization.
|
||||
* EarlGrey will not wait for any network request with URLs matching the blacklisted regular
|
||||
* expressions to complete. Most frequently blacklisted URLs include those used for sending
|
||||
* analytics, pingbacks, and background network tasks that don't interfere with testing.
|
||||
*
|
||||
* @remark By default, EarlGrey will not synchronize with any URLs with "data" scheme.
|
||||
*
|
||||
* Accepted values: @c An @c NSArray of valid regular expressions as @c NSString.
|
||||
* The strings must be accepted by @c NSRegularExpression.
|
||||
* Default value: an empty @c NSArray
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyURLBlacklistRegex;
|
||||
|
||||
/**
|
||||
* Configuration that enables/disables inclusion of status bar window in every operation performed
|
||||
* by EarlGrey. By default, the status bar window is excluded from screenshots and UI hierarchy.
|
||||
*
|
||||
* Accepted values: @c BOOL (i.e. @c YES or @c NO)
|
||||
* Default value: NO
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyIncludeStatusBarWindow;
|
||||
|
||||
/**
|
||||
* Configuration for setting a directory location where any test artifacts such as screenshots,
|
||||
* test logs, etc. are stored. The user should ensure that the location provided is writable by
|
||||
* the test.
|
||||
*
|
||||
* Accepted values: NSString containing a valid absolute filepath that is writable by the test.
|
||||
* Default value: @c nil
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConfigKeyArtifactsDirLocation;
|
||||
|
||||
/**
|
||||
* Provides an interface for runtime configuration of EarlGrey's behavior.
|
||||
*/
|
||||
@interface GREYConfiguration : NSObject
|
||||
|
||||
/**
|
||||
* @return The singleton GREYConfiguration instance.
|
||||
*/
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* If a user-configured value is associated with the given @c configKey, it is returned,
|
||||
* otherwise the default value is returned. If a default value is not found, or an
|
||||
* NSInvalidArgumentException is raised.
|
||||
*
|
||||
* @param configKey The key whose value is being queried. Must be a valid @c NSString.
|
||||
*
|
||||
* @throws NSInvalidArgumentException If no value could be found associated with @c configKey.
|
||||
*
|
||||
* @return The value for the configuration stored associate with @c configKey.
|
||||
*/
|
||||
- (id)valueForConfigKey:(NSString *)configKey;
|
||||
|
||||
/**
|
||||
* If a user-configured value is associated with the given @c configKey, it is returned, otherwise
|
||||
* the default value is returned. If a default value is not found, NSInvalidArgumentException is
|
||||
* raised.
|
||||
*
|
||||
* @param configKey The key whose value is being queried. Must be a valid @c NSString.
|
||||
*
|
||||
* @throws NSInvalidArgumentException If no value could be found for the given @c configKey.
|
||||
*
|
||||
* @return The @c BOOL value for the configuration associated with @c configKey.
|
||||
*/
|
||||
- (BOOL)boolValueForConfigKey:(NSString *)configKey;
|
||||
|
||||
/**
|
||||
* If a user-configured value is associated with the given @c configKey, it is returned, otherwise
|
||||
* the default value is returned. If a default value is not found, NSInvalidArgumentException is
|
||||
* raised.
|
||||
*
|
||||
* @param configKey The key whose value is being queried. Must be a valid @c NSString.
|
||||
*
|
||||
* @throws NSInvalidArgumentException If no value could be found for the given @c configKey.
|
||||
*
|
||||
* @return The integer value for the configuration associated with @c configKey.
|
||||
*/
|
||||
- (NSInteger)integerValueForConfigKey:(NSString *)configKey;
|
||||
|
||||
/**
|
||||
* If a user-configured value is associated with the given @c configKey, it is returned, otherwise
|
||||
* the default value is returned. If a default value is not found, NSInvalidArgumentException is
|
||||
* raised.
|
||||
*
|
||||
* @param configKey The key whose value is being queried. Must be a valid @c NSString.
|
||||
*
|
||||
* @throws NSInvalidArgumentException If no value could be found for the given @c configKey.
|
||||
*
|
||||
* @return The @c double value for the configuration associated with @c configKey.
|
||||
*/
|
||||
- (double)doubleValueForConfigKey:(NSString *)configKey;
|
||||
|
||||
/**
|
||||
* If a user-configured value is associated with the given @c configKey, it is returned, otherwise
|
||||
* the default value is returned. If a default value is not found, NSInvalidArgumentException is
|
||||
* raised.
|
||||
*
|
||||
* @param configKey The key whose value is being queried. Must be a valid @c NSString.
|
||||
*
|
||||
* @throws NSInvalidArgumentException If no value could be found for the given @c configKey.
|
||||
*
|
||||
* @return The string value for the configuration associated with @c configKey.
|
||||
*/
|
||||
- (NSString *)stringValueForConfigKey:(NSString *)configKey;
|
||||
|
||||
/**
|
||||
* If a user-configured value is associated with the given @c configKey, it is returned, otherwise
|
||||
* the default value is returned. If a default value is not found, NSInvalidArgumentException is
|
||||
* raised.
|
||||
*
|
||||
* @param configKey The key whose value is being queried. Must be a valid @c NSString.
|
||||
*
|
||||
* @throws NSInvalidArgumentException If no value could be found for the given @c configKey.
|
||||
*
|
||||
* @return The array value for the configuration associated with @c configKey.
|
||||
*/
|
||||
- (NSArray *)arrayValueForConfigKey:(NSString *)configKey;
|
||||
|
||||
/**
|
||||
* Resets all configurations to default values, removing all the configured values.
|
||||
*
|
||||
* @remark Any default values added by calling GREYConfiguration:setDefaultValue:forConfigKey:
|
||||
* are not reset.
|
||||
*/
|
||||
- (void)reset;
|
||||
|
||||
/**
|
||||
* Given a value and a key that identifies a configuration, set the value of the configuration.
|
||||
* Overwrites any previous value for the configuration.
|
||||
*
|
||||
* @remark To restore original values, call GREYConfiguration::reset.
|
||||
*
|
||||
* @param value The configuration value to be set. Scalars should be wrapped in @c NSValue.
|
||||
* @param configKey Key identifying an existing or new configuration. Must be a valid @c NSString.
|
||||
*/
|
||||
- (void)setValue:(id)value forConfigKey:(NSString *)configKey;
|
||||
|
||||
/**
|
||||
* Associates configuration identified by @c configKey with the provided @c value.
|
||||
*
|
||||
* @remark Default values persist even after resetting the configuration
|
||||
* (using GREYConfiguration::reset)
|
||||
*
|
||||
* @param value The configuration value to be set. Scalars should be wrapped in @c NSValue.
|
||||
* @param configKey Key identifying an existing or new configuration. Must be a valid @c NSString.
|
||||
*/
|
||||
- (void)setDefaultValue:(id)value forConfigKey:(NSString *)configKey;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* @return the value of type @c id associated with the given @c __configName.
|
||||
*/
|
||||
#define GREY_CONFIG(__configName) \
|
||||
[[GREYConfiguration sharedInstance] valueForConfigKey:(__configName)]
|
||||
|
||||
/**
|
||||
* @return @c BOOL value associated with the given @c __configName.
|
||||
*/
|
||||
#define GREY_CONFIG_BOOL(__configName) \
|
||||
[[GREYConfiguration sharedInstance] boolValueForConfigKey:(__configName)]
|
||||
|
||||
/**
|
||||
* @return @c NSInteger value associated with the given @c __configName.
|
||||
*/
|
||||
#define GREY_CONFIG_INTEGER(__configName) \
|
||||
[[GREYConfiguration sharedInstance] integerValueForConfigKey:(__configName)]
|
||||
|
||||
/**
|
||||
* @return @c double value associated with the given @c __configName.
|
||||
*/
|
||||
#define GREY_CONFIG_DOUBLE(__configName) \
|
||||
[[GREYConfiguration sharedInstance] doubleValueForConfigKey:(__configName)]
|
||||
|
||||
/**
|
||||
* @return @c NSString value associated with the given @c __configName.
|
||||
*/
|
||||
#define GREY_CONFIG_STRING(__configName) \
|
||||
[[GREYConfiguration sharedInstance] stringValueForConfigKey:(__configName)]
|
||||
|
||||
/**
|
||||
* @return @c NSArray value associated with the given @c __configName.
|
||||
*/
|
||||
#define GREY_CONFIG_ARRAY(__configName) \
|
||||
[[GREYConfiguration sharedInstance] arrayValueForConfigKey:(__configName)]
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
296
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYConstants.h
generated
Normal file
296
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYConstants.h
generated
Normal file
@@ -0,0 +1,296 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Any alpha less than this value is considered hidden by Apple.
|
||||
* @see
|
||||
* https://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html#//apple_ref/occ/instm/UIView/hitTest:withEvent:
|
||||
*/
|
||||
GREY_EXTERN const CGFloat kGREYMinimumVisibleAlpha;
|
||||
|
||||
/**
|
||||
* Amount of time a "fast" swipe should last for, in seconds.
|
||||
*/
|
||||
GREY_EXTERN const CFTimeInterval kGREYSwipeFastDuration;
|
||||
|
||||
/**
|
||||
* Amount of time a "slow" swipe should last for, in seconds.
|
||||
*/
|
||||
GREY_EXTERN const CFTimeInterval kGREYSwipeSlowDuration;
|
||||
|
||||
/**
|
||||
* Amount of time a "fast" pinch should last for, in seconds
|
||||
*/
|
||||
GREY_EXTERN const CFTimeInterval kGREYPinchFastDuration;
|
||||
|
||||
/**
|
||||
* Amount of time a "slow" pinch should last for, in seconds
|
||||
*/
|
||||
GREY_EXTERN const CFTimeInterval kGREYPinchSlowDuration;
|
||||
|
||||
/**
|
||||
* Infinite timeout.
|
||||
*/
|
||||
GREY_EXTERN const CFTimeInterval kGREYInfiniteTimeout;
|
||||
|
||||
/**
|
||||
* Limit on the number of UIPickerViews that can be pulled for getting the hierarchy.
|
||||
*/
|
||||
GREY_EXTERN const NSInteger kUIPickerViewMaxAccessibilityViews;
|
||||
|
||||
/**
|
||||
* Amount of time a normal long press should last for, in seconds. Extracted from:
|
||||
* @see
|
||||
* https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UILongPressGestureRecognizer_Class/index.html#//apple_ref/occ/instp/UILongPressGestureRecognizer/minimumPressDuration
|
||||
*/
|
||||
GREY_EXTERN const CFTimeInterval kGREYLongPressDefaultDuration;
|
||||
|
||||
/**
|
||||
* Minimum acceptable difference between two floating-point values when comparing them.
|
||||
*/
|
||||
GREY_EXTERN const CGFloat kGREYAcceptableFloatDifference;
|
||||
|
||||
/**
|
||||
* NSUserDefaults key for checking if verbose logging is turned on. (i.e. logs with
|
||||
* GREYLogVerbose are printed.)
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYAllowVerboseLogging;
|
||||
|
||||
/**
|
||||
* The default pinch angle for the pinch action, specified by an approximate angle for a right
|
||||
* handed two finger pinch.
|
||||
*/
|
||||
GREY_EXTERN const double kGREYPinchAngleDefault;
|
||||
|
||||
/**
|
||||
* Directions for scrolling and swiping.
|
||||
*
|
||||
* The direction describes the motion of the view port as a result of the swipe, which is opposite
|
||||
* to the direction the user's finger moves. For example, a scroll down the page should be
|
||||
* expressed with @c kGREYDirectionDown as it simulates a touch that starts somewhere in the middle
|
||||
* of the screen and moves up to simulate an absolute scroll down behavior.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYDirection) {
|
||||
/**
|
||||
* The finger is moving to the right, view port is moving left.
|
||||
*/
|
||||
kGREYDirectionLeft = 1,
|
||||
/**
|
||||
* The finger is moving to the left, view port is moving right.
|
||||
*/
|
||||
kGREYDirectionRight,
|
||||
/**
|
||||
* The finger is moving downwards, view port is moving up.
|
||||
*/
|
||||
kGREYDirectionUp,
|
||||
/**
|
||||
* The finger is moving upwards, view port is moving down.
|
||||
*/
|
||||
kGREYDirectionDown,
|
||||
};
|
||||
|
||||
/**
|
||||
* Directions for pinch gesture.
|
||||
*
|
||||
* The direction describes the motion of the view port as a result of pinch. There are two
|
||||
* possible directions for pinch action inward and outward.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYPinchDirection) {
|
||||
/**
|
||||
* Two fingers pinching outward.
|
||||
*/
|
||||
kGREYPinchDirectionOutward = 1,
|
||||
/**
|
||||
* Two fingers pinching inward.
|
||||
*/
|
||||
kGREYPinchDirectionInward,
|
||||
};
|
||||
|
||||
/**
|
||||
* Content edges for scrolling.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYContentEdge) {
|
||||
/**
|
||||
* The left content edge of the screen in the current orientation.
|
||||
*/
|
||||
kGREYContentEdgeLeft,
|
||||
/**
|
||||
* The right content edge of the screen in the current orientation.
|
||||
*/
|
||||
kGREYContentEdgeRight,
|
||||
/**
|
||||
* The top content edge of the screen in the current orientation.
|
||||
*/
|
||||
kGREYContentEdgeTop,
|
||||
/**
|
||||
* The bottom content edge of the screen in the current orientation.
|
||||
*/
|
||||
kGREYContentEdgeBottom,
|
||||
};
|
||||
|
||||
/**
|
||||
* Directions for layout specification.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYLayoutDirection) {
|
||||
/**
|
||||
* To the left of the current element.
|
||||
*/
|
||||
kGREYLayoutDirectionLeft = 1,
|
||||
/**
|
||||
* To the right of the current element.
|
||||
*/
|
||||
kGREYLayoutDirectionRight,
|
||||
/**
|
||||
* Above the current element.
|
||||
*/
|
||||
kGREYLayoutDirectionUp,
|
||||
/**
|
||||
* Below the current element.
|
||||
*/
|
||||
kGREYLayoutDirectionDown,
|
||||
};
|
||||
|
||||
/**
|
||||
* Layout attributes for matching on layouts (modelled after @c NSLayoutAttribute).
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYLayoutAttribute) {
|
||||
/**
|
||||
* The left edge of element.
|
||||
*/
|
||||
kGREYLayoutAttributeLeft = 1,
|
||||
/**
|
||||
* The right edge of element.
|
||||
*/
|
||||
kGREYLayoutAttributeRight,
|
||||
/**
|
||||
* The top edge of element.
|
||||
*/
|
||||
kGREYLayoutAttributeTop,
|
||||
/**
|
||||
* The bottom edge of element.
|
||||
*/
|
||||
kGREYLayoutAttributeBottom,
|
||||
};
|
||||
|
||||
/**
|
||||
* Layout relations for comparison of layout attributes (modelled after @c NSLayoutRelation).
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYLayoutRelation) {
|
||||
/**
|
||||
* Value is less than or equal to the other operand.
|
||||
*/
|
||||
kGREYLayoutRelationLessThanOrEqual = -1,
|
||||
/**
|
||||
* Value is equal to the other operand.
|
||||
*/
|
||||
kGREYLayoutRelationEqual = 0,
|
||||
/**
|
||||
* Value is greater than or equal to the other operand.
|
||||
*/
|
||||
kGREYLayoutRelationGreaterThanOrEqual = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* Types of tap actions
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYTapType) {
|
||||
/**
|
||||
* Tap action for basic tap.
|
||||
*/
|
||||
kGREYTapTypeShort,
|
||||
/**
|
||||
* Tap action for long press tap.
|
||||
*/
|
||||
kGREYTapTypeLong,
|
||||
/**
|
||||
* Tap action for multiple taps (for example double tap).
|
||||
*/
|
||||
kGREYTapTypeMultiple,
|
||||
/**
|
||||
* Tap action for keyboard keys.
|
||||
*/
|
||||
kGREYTapTypeKBKey,
|
||||
};
|
||||
|
||||
/**
|
||||
* @return A string representation of the given @c deviceOrientation.
|
||||
*/
|
||||
NSString *NSStringFromUIDeviceOrientation(UIDeviceOrientation deviceOrientation);
|
||||
|
||||
/**
|
||||
* @return A string representation of the given @c direction.
|
||||
*/
|
||||
NSString *NSStringFromGREYDirection(GREYDirection direction);
|
||||
|
||||
/**
|
||||
* Returns a string representation of the given @c pinchDirection.
|
||||
*/
|
||||
NSString *NSStringFromPinchDirection(GREYPinchDirection pinchDirection);
|
||||
|
||||
/**
|
||||
* @return A string representation of the given @c edge.
|
||||
*/
|
||||
NSString *NSStringFromGREYContentEdge(GREYContentEdge edge);
|
||||
|
||||
/**
|
||||
* @return A string representation of the given layout @c attribute.
|
||||
*/
|
||||
NSString *NSStringFromGREYLayoutAttribute(GREYLayoutAttribute attribute);
|
||||
|
||||
/**
|
||||
* @return A string representation of the given layout @c relation.
|
||||
*/
|
||||
NSString *NSStringFromGREYLayoutRelation(GREYLayoutRelation relation);
|
||||
|
||||
/**
|
||||
* @return A string representation of the given accessibility trait.
|
||||
*/
|
||||
NSString *NSStringFromUIAccessibilityTraits(UIAccessibilityTraits traits);
|
||||
|
||||
/**
|
||||
* A class containing helper methods for conversion to-and-from constants.
|
||||
*/
|
||||
@interface GREYConstants : NSObject
|
||||
|
||||
/**
|
||||
* @return The direction from center to the given @c edge.
|
||||
*/
|
||||
+ (GREYDirection)directionFromCenterForEdge:(GREYContentEdge)edge;
|
||||
|
||||
/**
|
||||
* @return The edge that is in the given @c direction from the center.
|
||||
*/
|
||||
+ (GREYContentEdge)edgeInDirectionFromCenter:(GREYDirection)direction;
|
||||
|
||||
/**
|
||||
* @return The reverse direction of the given @c direction.
|
||||
*/
|
||||
+ (GREYDirection)reverseOfDirection:(GREYDirection)direction;
|
||||
|
||||
/**
|
||||
* @return A normalized vector in the given @c direction.
|
||||
*/
|
||||
+ (CGVector)normalizedVectorFromDirection:(GREYDirection)direction;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* An block-based enumerator that repeatedly invokes the block to return the next object.
|
||||
*/
|
||||
@interface GREYDataEnumerator : NSEnumerator
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Instantiates the enumerator with custom information and a block to return the next object.
|
||||
*
|
||||
* @param userInfo Custom object that is passed into the block. Use this for passing any
|
||||
* additional information required by the block.
|
||||
* @param nextObjectBlock A block that is invoked to return the next object in the enumerator.
|
||||
*
|
||||
* @return An instance of GREYDataEnumerator, initialized with the specified information.
|
||||
*/
|
||||
- (instancetype)initWithUserInfo:(id)userInfo
|
||||
block:(id(^)(id))nextObjectBlock NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
#pragma mark - NSEnumerator
|
||||
|
||||
/**
|
||||
* @return The next object in the enumerator returned by the @c nextObjectBlock.
|
||||
*/
|
||||
- (id _Nullable)nextObject;
|
||||
/**
|
||||
* @return An array of all the objects in the enumerator.
|
||||
*/
|
||||
- (NSArray *)allObjects;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
54
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYDefines.h
generated
Normal file
54
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYDefines.h
generated
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYDefines.h
|
||||
* @brief Miscellaneous defines and macros for EarlGrey.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#ifndef GREY_DEFINES_H
|
||||
#define GREY_DEFINES_H
|
||||
|
||||
#define GREY_EXPORT FOUNDATION_EXPORT __used
|
||||
#define GREY_EXTERN FOUNDATION_EXTERN
|
||||
#define GREY_UNUSED_VARIABLE __attribute__((unused))
|
||||
|
||||
#define iOS8_0_OR_ABOVE() ([UIDevice currentDevice].systemVersion.doubleValue >= 8.0)
|
||||
#define iOS8_1_OR_ABOVE() ([UIDevice currentDevice].systemVersion.doubleValue >= 8.1)
|
||||
#define iOS8_2_OR_ABOVE() ([UIDevice currentDevice].systemVersion.doubleValue >= 8.2)
|
||||
#define iOS9_OR_ABOVE() ([UIDevice currentDevice].systemVersion.intValue >= 9)
|
||||
#define iOS10_OR_ABOVE() ([UIDevice currentDevice].systemVersion.intValue >= 10)
|
||||
#define iOS11_OR_ABOVE() ([UIDevice currentDevice].systemVersion.intValue >= 11)
|
||||
|
||||
#pragma mark - Math
|
||||
|
||||
/**
|
||||
* @return The smallest @c int following the @c double @c x. This macro is needed to avoid
|
||||
* rounding errors when "modules" project setting is enabled causing math functions to
|
||||
* map from tgmath.h to math.h.
|
||||
*/
|
||||
#define grey_ceil(x) ((CGFloat)ceil(x))
|
||||
|
||||
/**
|
||||
* @return The largest @c int less than the @c double @c x. This macro is needed to avoid
|
||||
* rounding errors when "modules" project setting is enabled causing math functions to
|
||||
* map from tgmath.h to math.h.
|
||||
*/
|
||||
#define grey_floor(x) ((CGFloat)floor(x))
|
||||
|
||||
#endif // GREY_DEFINES_H
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A protocol that defines the layout of an object that conforms to GREYMatcher.
|
||||
*/
|
||||
@protocol GREYDescription<NSObject>
|
||||
|
||||
/**
|
||||
* Appends the provided text to the GREYDescription.
|
||||
*
|
||||
* @param text The text to be appended to the GREYDescription.
|
||||
*
|
||||
* @return An instance of an object conforming to GREYDescription with the provided
|
||||
* @c text appended to it.
|
||||
*/
|
||||
- (id<GREYDescription>)appendText:(NSString *)text;
|
||||
|
||||
/**
|
||||
* Appends the description of the provided object to the GREYDescription.
|
||||
*
|
||||
* @param object The object whose description is to be appended to the GREYDescription.
|
||||
*
|
||||
* @return An instance of an object conforming to GREYDescription with the provided
|
||||
* object's description appended to it.
|
||||
*/
|
||||
- (id<GREYDescription>)appendDescriptionOf:(id)object;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYIdlingResource.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Idling resource that tracks blocks sent to a dispatch queue.
|
||||
*/
|
||||
@interface GREYDispatchQueueIdlingResource : NSObject<GREYIdlingResource>
|
||||
|
||||
/**
|
||||
* Creates an idling resource backed by the specified @c queue.
|
||||
*
|
||||
* @c dispatch_sync blocks and dispatch_sync_f tasks sent to @c queue are tracked.
|
||||
* @c dispatch_async blocks and @c dispatch_async_f tasks sent to @c queue are tracked.
|
||||
* @c dispatch_after blocks and @c dispatch_after_f tasks sent to @c queue are tracked if they are
|
||||
* delayed no more than the delay amount set for the
|
||||
* @c kGREYConfigKeyTrackableDispatchAfterDuration configuration. A weak reference is held to
|
||||
* @c queue. If @c queue is deallocated, then the idling resource will deregister itself from the
|
||||
* UI thread executor.
|
||||
*
|
||||
* @param queue The dispatch queue that will be tracked by the resource.
|
||||
* @param name A descriptive name for the idling resource.
|
||||
*
|
||||
* @return An idling resource backed by the specified dispatch queue.
|
||||
*/
|
||||
+ (instancetype)resourceWithDispatchQueue:(dispatch_queue_t)queue name:(NSString *)name;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol GREYMatcher, GREYProvider;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Finds UI elements in GREYProvider that are accepted by a matcher.
|
||||
*/
|
||||
@interface GREYElementFinder : NSObject
|
||||
|
||||
/**
|
||||
* The matcher the element finder is initialized with. Objects returned from this class
|
||||
* must match this matcher.
|
||||
*/
|
||||
@property(nonatomic, readonly) id<GREYMatcher> matcher;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes the finder with a given @c matcher.
|
||||
*
|
||||
* @param matcher Matcher that defines what elements the finder should search for.
|
||||
*
|
||||
* @return An instance of GREYElementFinder, initialized with a matcher.
|
||||
*/
|
||||
- (instancetype)initWithMatcher:(id<GREYMatcher>)matcher NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Performs a search on elements provided by @c elementProvider and returns all the elements
|
||||
* that are accepted by the matcher this object is initialized with.
|
||||
*
|
||||
* @param elementProvider Provides elements to run through the matcher.
|
||||
*
|
||||
* @return An array of matched elements. If no matching element is found, then it is empty.
|
||||
* The relative order of the elements is preserved when returned.
|
||||
*/
|
||||
- (NSArray *)elementsMatchedInProvider:(id<GREYProvider>)elementProvider;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A utility to get the string representation of the UI hierarchy.
|
||||
*/
|
||||
@interface GREYElementHierarchy : NSObject
|
||||
|
||||
/**
|
||||
* Returns UI hierarchy with @c element as the root. @c element can be either a UIView or an
|
||||
* Accessibility element.
|
||||
*
|
||||
* @param element The root element for the hierarchy.
|
||||
*
|
||||
* @return The UI hierarchy as a string.
|
||||
*/
|
||||
+ (NSString *)hierarchyStringForElement:(id)element;
|
||||
|
||||
/**
|
||||
* Similar to hierarchyStringForElement: with additional parameters for providing annotations
|
||||
* for printed views. @c annotationDictionary is a dictionary of type
|
||||
* @code @{[NSValue valueWithNonretainedObject:id]:NSString} @endcode with UI elements that
|
||||
* require special formatting i.e. special text to be appended to the description. For example,
|
||||
* @code @{viewA : @"This is a special view"} @endcode or
|
||||
* @code @{elementA : @"This is a special view"} @endcode will have it's description as:
|
||||
* @"<DESCRIPTION> This is a special view".
|
||||
*
|
||||
* @param element The root element for the hierarchy.
|
||||
* @param annotationDictionary A dictionary of annotations.
|
||||
*
|
||||
* @return The UI hierarchy as a string.
|
||||
*/
|
||||
+ (NSString *)hierarchyStringForElement:(id)element
|
||||
withAnnotationDictionary:(NSDictionary *_Nullable)annotationDictionary;
|
||||
|
||||
/**
|
||||
* Returns the UI hierarchy for all @c UIWindows provided by the GREYUIWindowProvider.
|
||||
*/
|
||||
+ (NSString *)hierarchyStringForAllUIWindows;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYInteraction.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Interface for creating an interaction with a UI element. If no datasource is set,
|
||||
* a default datasource is used. The default datasource provides access to the entire UI element
|
||||
* hierarchy of all the windows in the application.
|
||||
*/
|
||||
@interface GREYElementInteraction : NSObject<GREYInteraction>
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes the interaction with a single UI element matching @c elementMatcher.
|
||||
*
|
||||
* @param elementMatcher Matcher for selecting UI element to interact with.
|
||||
*
|
||||
* @return An instance of GREYElementInteraction, initialized with a specified matcher.
|
||||
*/
|
||||
- (instancetype)initWithElementMatcher:(id<GREYMatcher>)elementMatcher;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseMatcher.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A block for implementing GREYBaseMatcher::matches:.
|
||||
*
|
||||
* @param element The element passed to the block for matching.
|
||||
*
|
||||
* @return @c YES if the matcher's specified condition was matched by the element, else @c NO.
|
||||
*/
|
||||
typedef BOOL (^MatchesBlock)(id element);
|
||||
|
||||
/**
|
||||
* A block for implementing GREYBaseMatcher::describeTo:.
|
||||
*
|
||||
* @param description The description for the matcher.
|
||||
*/
|
||||
typedef void (^DescribeToBlock)(id<GREYDescription> description);
|
||||
|
||||
@protocol GREYDescription;
|
||||
|
||||
/**
|
||||
* A block based implementation of GREYBaseMatcher. Enables custom implementation of protocol
|
||||
* method using blocks.
|
||||
*/
|
||||
@interface GREYElementMatcherBlock : GREYBaseMatcher
|
||||
|
||||
/**
|
||||
* The block which will be invoked for the GREYBaseMatcher::matches: method.
|
||||
*/
|
||||
@property(nonatomic, copy) MatchesBlock matcherBlock;
|
||||
|
||||
/**
|
||||
* The block which will be invoked for the GREYBaseMatcher::describeTo: method.
|
||||
*/
|
||||
@property(nonatomic, copy) DescribeToBlock descriptionBlock;
|
||||
|
||||
/**
|
||||
* Class method to instantiate a custom matcher.
|
||||
*
|
||||
* @param matchBlock A block for implementing GREYBaseMatcher::matches: method.
|
||||
* @param describeBlock The block which will be invoked for the GREYBaseMatcher::describeTo:
|
||||
* method.
|
||||
*
|
||||
* @return A GREYElementMatcherBlock instance, initialized with the required matching
|
||||
* condition and description.
|
||||
*/
|
||||
+ (instancetype)matcherWithMatchesBlock:(MatchesBlock)matchBlock
|
||||
descriptionBlock:(DescribeToBlock)describeBlock;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes a custom matcher.
|
||||
*
|
||||
* @param matchBlock A block for implementing GREYBaseMatcher::matches: method.
|
||||
* @param describeBlock The block which will be invoked for the
|
||||
* GREYBaseMatcher::describeTo: method.
|
||||
*
|
||||
* @return A GREYElementMatcherBlock instance, initialized with the required matching
|
||||
* condition and description.
|
||||
*/
|
||||
- (instancetype)initWithMatchesBlock:(MatchesBlock)matchBlock
|
||||
descriptionBlock:(DescribeToBlock)describeBlock NS_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class GREYFrameworkException;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Protocol for handling failures (such as failure of actions and assertions) raised by EarlGrey.
|
||||
*/
|
||||
@protocol GREYFailureHandler<NSObject>
|
||||
|
||||
/**
|
||||
* Called by the framework to raise an exception.
|
||||
*
|
||||
* @param exception The exception to be handled.
|
||||
* @param details Extra information about the failure.
|
||||
*/
|
||||
- (void)handleException:(GREYFrameworkException *)exception details:(NSString *)details;
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
* Sets the file name and line number of operation that caused the failure.
|
||||
*
|
||||
* @param fileName The name of the file where the error happened.
|
||||
* @param lineNumber The line number in the file that caused the error.
|
||||
*/
|
||||
- (void)setInvocationFile:(NSString *)fileName andInvocationLine:(NSUInteger)lineNumber;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Generic framework failure.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYGenericFailureException;
|
||||
/**
|
||||
* Thrown on action failure.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYActionFailedException;
|
||||
/**
|
||||
* Thrown on assertion failure.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYAssertionFailedException;
|
||||
/**
|
||||
* Thrown when assertion failed due to an unexpected @c nil parameter.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYNilException;
|
||||
/**
|
||||
* Thrown when assertion failed due to an unexpected non-nil parameter.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYNotNilException;
|
||||
|
||||
/**
|
||||
* Thrown by the selection API when no UI element matches the selection matcher.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYNoMatchingElementException;
|
||||
|
||||
/**
|
||||
* Thrown by the interaction API when either an action or assertion matcher matches multiple
|
||||
* elements in the UI hierarchy.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYMultipleElementsFoundException;
|
||||
|
||||
/**
|
||||
* Thrown by the interaction API when either an action or assertion times out waiting for the
|
||||
* app to become idle.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYTimeoutException;
|
||||
|
||||
/**
|
||||
* Thrown by the action API when the constraints required for performing the action are not
|
||||
* satisfied.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYConstraintFailedException;
|
||||
|
||||
/**
|
||||
* Exception raised by the framework which results in a test failure.
|
||||
* To catch such exceptions, install a custom failure handler
|
||||
* using EarlGrey::setFailureHandler:. A default failure handler is provided by the framework.
|
||||
*/
|
||||
@interface GREYFrameworkException : NSException
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Creates a new exception instance.
|
||||
*
|
||||
* @param name The name of the exception.
|
||||
* @param reason The reason for the exception.
|
||||
*
|
||||
* @return A GREYFrameworkException instance, initialized with a @c name and @c reason.
|
||||
*/
|
||||
+ (instancetype)exceptionWithName:(NSString *)name reason:(nullable NSString *)reason;
|
||||
|
||||
/**
|
||||
* Creates a new exception instance.
|
||||
*
|
||||
* @param name The name of the exception.
|
||||
* @param reason The reason for the exception.
|
||||
* @param userInfo userInfo as used by @c NSException.
|
||||
* EarlGrey doesn't use this param so it's safe to pass nil.
|
||||
*
|
||||
* @return A GREYFrameworkException instance, initialized with a @c name and @c reason.
|
||||
*/
|
||||
+ (instancetype)exceptionWithName:(NSString *)name
|
||||
reason:(nullable NSString *)reason
|
||||
userInfo:(nullable NSDictionary *)userInfo;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A protocol for resources that can potentially modify the UI and should be synchronized with
|
||||
* before performing any interaction or verification with UI element.
|
||||
*/
|
||||
@protocol GREYIdlingResource<NSObject>
|
||||
|
||||
/**
|
||||
* A method to query idleness of this resource.
|
||||
*
|
||||
* Note: This method is called on the main thread and polled continuously until this resource goes
|
||||
* into idle state or a test timeout occurs. It is discouraged to perform any heavy tasks in this
|
||||
* method.
|
||||
*
|
||||
* @return @c YES if the resource is currently idle; @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)isIdleNow;
|
||||
|
||||
/**
|
||||
* @return A user friendly name that will be printed if this resource fails to idle leading to a
|
||||
* test timeout.
|
||||
*/
|
||||
- (NSString *)idlingResourceName;
|
||||
|
||||
/**
|
||||
* @return Information that will be printed alongside the name if this resource fails to idle in
|
||||
* the given timeout.
|
||||
*/
|
||||
- (NSString *)idlingResourceDescription;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
268
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYInteraction.h
generated
Normal file
268
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYInteraction.h
generated
Normal file
@@ -0,0 +1,268 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
@protocol GREYInteractionDataSource;
|
||||
@protocol GREYAction;
|
||||
@protocol GREYAssertion;
|
||||
@protocol GREYMatcher;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Error domain for element interaction failures.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYInteractionErrorDomain;
|
||||
|
||||
/**
|
||||
* Error codes for element interaction failures.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYInteractionErrorCode) {
|
||||
/**
|
||||
* Element search has failed.
|
||||
*/
|
||||
kGREYInteractionElementNotFoundErrorCode = 0,
|
||||
/**
|
||||
* Constraints failed for performing an interaction.
|
||||
*/
|
||||
kGREYInteractionConstraintsFailedErrorCode,
|
||||
/**
|
||||
* Action execution has failed.
|
||||
*/
|
||||
kGREYInteractionActionFailedErrorCode,
|
||||
/**
|
||||
* Assertion execution has failed.
|
||||
*/
|
||||
kGREYInteractionAssertionFailedErrorCode,
|
||||
/**
|
||||
* Timeout reached before interaction could be performed.
|
||||
*/
|
||||
kGREYInteractionTimeoutErrorCode,
|
||||
/**
|
||||
* Single element search found multiple elements.
|
||||
*/
|
||||
kGREYInteractionMultipleElementsMatchedErrorCode,
|
||||
/**
|
||||
* Index provided for matching an element from multiple elements was over the number of elements
|
||||
* found.
|
||||
*/
|
||||
kGREYInteractionMatchedElementIndexOutOfBoundsErrorCode,
|
||||
};
|
||||
|
||||
/**
|
||||
* Notification name for when an action will be performed. The action itself is contained in the
|
||||
* @c userInfo object from the @c notification and can be obtained using the key
|
||||
* @c kGREYActionUserInfoKey.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYWillPerformActionNotification;
|
||||
|
||||
/**
|
||||
* Notification name for when an action has been performed. The action itself is contained in the
|
||||
* @c userInfo object from the @c notification and can be obtained using the key
|
||||
* @c kGREYActionUserInfoKey.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYDidPerformActionNotification;
|
||||
|
||||
/**
|
||||
* Notification name for when an assertion will be checked. The assertion itself is contained in
|
||||
* the @c userInfo object from the @c notification and can be obtained using the key
|
||||
* @c kGREYAssertionUserInfoKey.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYWillPerformAssertionNotification;
|
||||
|
||||
/**
|
||||
* Notification name for when an assertion has been performed. The assertion itself is contained
|
||||
* in the @c userInfo object from the @c notification and can be obtained using the key
|
||||
* @c kGREYAssertionUserInfoKey.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYDidPerformAssertionNotification;
|
||||
|
||||
/**
|
||||
* User Info dictionary key for the action performed.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYActionUserInfoKey;
|
||||
|
||||
/**
|
||||
* User Info dictionary key for the element an action was performed on. The element for an
|
||||
* assertion can be @c nil in case of an error.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYActionElementUserInfoKey;
|
||||
|
||||
/**
|
||||
* User Info dictionary key for any error populated on the action being performed.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYActionErrorUserInfoKey;
|
||||
|
||||
/**
|
||||
* User Info dictionary key for the assertion checked.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYAssertionUserInfoKey;
|
||||
|
||||
/**
|
||||
* User Info dictionary key for the element an assertion was checked on. The element for an
|
||||
* assertion can be @c nil since assertions can be performed on @c nil elements.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYAssertionElementUserInfoKey;
|
||||
|
||||
/**
|
||||
* User Info dictionary key for any error populated on the assertion being checked.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYAssertionErrorUserInfoKey;
|
||||
|
||||
/**
|
||||
* Represents an interaction with a UI element.
|
||||
*/
|
||||
@protocol GREYInteraction<NSObject>
|
||||
|
||||
/**
|
||||
* Data source for providing UI elements to interact with.
|
||||
* The dataSource must adopt GREYInteractionDataSource protocol and a weak reference is held.
|
||||
*/
|
||||
@property(nonatomic, weak) id<GREYInteractionDataSource> dataSource;
|
||||
|
||||
/**
|
||||
* Indicates that the current interaction should be performed on a UI element contained inside
|
||||
* another UI element that is uniquely matched by @c rootMatcher.
|
||||
*
|
||||
* @param rootMatcher Matcher used to select the container of the element the interaction
|
||||
* will be performed on.
|
||||
*
|
||||
* @return The provided GREYInteraction instance, with an appropriate rootMatcher.
|
||||
*/
|
||||
- (instancetype)inRoot:(id<GREYMatcher>)rootMatcher;
|
||||
|
||||
/**
|
||||
* Performs the @c action repeatedly on the element matching the @c matcher until the element
|
||||
* to interact with (specified by GREYInteraction::selectElementWithMatcher:) is found or a
|
||||
* timeout occurs. The search action is only performed when coupled with
|
||||
* GREYInteraction::performAction:, GREYInteraction::assert:, or
|
||||
* GREYInteraction::assertWithMatcher: APIs. This API only creates an interaction consisting of
|
||||
* repeated executions of the search action provided. You need to call an action or assertion
|
||||
* after this in order to interaction with the element being searched for.
|
||||
*
|
||||
* For example, this code will perform an upward scroll of 50 points until an element is found
|
||||
* and then tap on it:
|
||||
* @code
|
||||
* [[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"elementToFind")]
|
||||
* usingSearchAction:grey_scrollInDirection(kGREYDirectionUp, 50.0f)
|
||||
* onElementWithMatcher:grey_accessibilityID(@"ScrollingWindow")]
|
||||
* performAction:grey_tap()] // This should be separately called for the action.
|
||||
* @endcode
|
||||
*
|
||||
* @param action The action to be performed on the element.
|
||||
* @param matcher The matcher that the element matches.
|
||||
*
|
||||
* @return The provided GREYInteraction instance, with an appropriate action and matcher.
|
||||
*/
|
||||
- (instancetype)usingSearchAction:(id<GREYAction>)action
|
||||
onElementWithMatcher:(id<GREYMatcher>)matcher;
|
||||
|
||||
/**
|
||||
* Performs an @c action on the selected UI element.
|
||||
*
|
||||
* @param action The action to be performed on the @c element.
|
||||
* @throws NSException if the action fails.
|
||||
*
|
||||
* @return The provided GREYInteraction instance with an appropriate action.
|
||||
*/
|
||||
- (instancetype)performAction:(id<GREYAction>)action NS_REFINED_FOR_SWIFT;
|
||||
|
||||
/**
|
||||
* Performs an @c action on the selected UI element with an error set on failure.
|
||||
*
|
||||
* @param action The action to be performed on the @c element.
|
||||
* @param[out] errorOrNil Error populated on failure.
|
||||
* @throws NSException on action failure if @c errorOrNil is not set.
|
||||
*
|
||||
* @return The provided GREYInteraction instance, with an action and an error that will be
|
||||
* populated on failure.
|
||||
*/
|
||||
- (instancetype)performAction:(id<GREYAction>)action
|
||||
error:(__strong NSError *_Nullable *_Nullable)errorOrNil
|
||||
NS_SWIFT_NOTHROW NS_REFINED_FOR_SWIFT;
|
||||
|
||||
/**
|
||||
* Performs an @c assertion on the selected UI element.
|
||||
*
|
||||
* @param assertion The assertion to be performed on the @c element.
|
||||
* @throws NSException if the @c assertion fails.
|
||||
*
|
||||
* @return The provided GREYInteraction instance with a valid assertion.
|
||||
*/
|
||||
- (instancetype)assert:(id<GREYAssertion>)assertion;
|
||||
|
||||
/**
|
||||
* Performs an @c assertion on the selected UI element with an error set on failure.
|
||||
*
|
||||
* @param assertion The assertion to be performed on the @c element.
|
||||
* @param[out] errorOrNil Error populated on failure.
|
||||
* @throws NSException on assertion failure if @c errorOrNil is not set.
|
||||
*
|
||||
* @return The provided GREYInteraction instance with an assertion and an error that will be
|
||||
* populated on failure.
|
||||
*/
|
||||
- (instancetype)assert:(id<GREYAssertion>)assertion
|
||||
error:(__strong NSError *_Nullable *_Nullable)errorOrNil NS_SWIFT_NOTHROW;
|
||||
|
||||
/**
|
||||
* Performs an assertion that evaluates @c matcher on the selected UI element.
|
||||
*
|
||||
* @param matcher The matcher to be evaluated on the @c element.
|
||||
*
|
||||
* @return The provided GREYInteraction instance with a matcher to be evaluated on an element.
|
||||
*/
|
||||
- (instancetype)assertWithMatcher:(id<GREYMatcher>)matcher NS_REFINED_FOR_SWIFT;
|
||||
|
||||
/**
|
||||
* Performs an assertion that evaluates @c matcher on the selected UI element.
|
||||
*
|
||||
* @param matcher The matcher to be evaluated on the @c element.
|
||||
* @param[out] errorOrNil Error populated on failure.
|
||||
* @throws NSException on assertion failure if @c errorOrNil is not set.
|
||||
*
|
||||
* @return The provided GREYInteraction instance, with a matcher to be evaluated on an element and
|
||||
* an error that will be populated on failure.
|
||||
*/
|
||||
- (instancetype)assertWithMatcher:(id<GREYMatcher>)matcher
|
||||
error:(__strong NSError *_Nullable *_Nullable)errorOrNil
|
||||
NS_SWIFT_NOTHROW NS_REFINED_FOR_SWIFT;
|
||||
|
||||
/**
|
||||
* In case of multiple matches, selects the element at the specified index. In case of the
|
||||
* index being over the number of matched elements, it throws an exception. Please make sure
|
||||
* that this is used after you've created the matcher. For example, in case three elements are
|
||||
* matched, and you wish to match with the second one, then @c atIndex would be used in this
|
||||
* manner:
|
||||
*
|
||||
* @code
|
||||
* [[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Generic Matcher")] atIndex:1];
|
||||
* @endcode
|
||||
*
|
||||
* @param index The zero-indexed position of the element in the list of matched elements
|
||||
* to be selected.
|
||||
* @throws NSException if the @c index is more than the number of matched elements.
|
||||
*
|
||||
* @return An interaction (assertion or an action) to be performed on the element at the
|
||||
* specified index in the list of matched elements.
|
||||
*/
|
||||
- (instancetype)atIndex:(NSUInteger)index;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Modeled after NSLayoutConstraint, this class captures information related to a layout
|
||||
* constraint: two attributes and a relation that must be satisfied between them.
|
||||
*/
|
||||
@interface GREYLayoutConstraint : NSObject
|
||||
|
||||
/**
|
||||
* Creates a GREYLayoutConstraint to verify a constraint attribute on an element. The relation is
|
||||
* given by : @c attribute value = @c referenceAttribute * @c multiplier + @c constant.
|
||||
*
|
||||
* For example, with constraint relation @c kGREYLayoutRelationEqual, multiplier 2.0 and
|
||||
* constant 10.0, the attribute values of 20.0 and 5.0 satisfy the constraint because:
|
||||
* 20.0 = 5.0 * 2.0 + 10.0 but 30.0 and 40.0 don't because 30.0 != 40.0 * 2.0 + 10.0.
|
||||
*
|
||||
* @param attribute A layout attribute to create the constraint from.
|
||||
* @param relation The GREYLayoutRelation between the @c attribute and
|
||||
* the @c referenceAttribute
|
||||
* @param referenceAttribute The layout attribute whose relation is being checked
|
||||
* with respect to @attribute.
|
||||
* @param multiplier Value to multiply the @c referenceAttribute value.
|
||||
* @param constant Any constant to be added to the relation being checked.
|
||||
*
|
||||
* @return A GREYLayoutConstraint instance, that constrains an element's attribute with
|
||||
* respect to a reference.
|
||||
*/
|
||||
+ (instancetype)layoutConstraintWithAttribute:(GREYLayoutAttribute)attribute
|
||||
relatedBy:(GREYLayoutRelation)relation
|
||||
toReferenceAttribute:(GREYLayoutAttribute)referenceAttribute
|
||||
multiplier:(CGFloat)multiplier
|
||||
constant:(CGFloat)constant;
|
||||
|
||||
/**
|
||||
* Creates a GREYLayoutConstraint that checks the position of a UI element with respect to a
|
||||
* particular direction
|
||||
*
|
||||
* @param direction The direction being checked against the reference element.
|
||||
* @param separation The separation between an element and an edge in the given @c direction.
|
||||
*
|
||||
* @return A GREYLayoutConstraint instance that constrains an element to a particular direction.
|
||||
*/
|
||||
+ (instancetype)layoutConstraintForDirection:(GREYLayoutDirection)direction
|
||||
andMinimumSeparation:(CGFloat)separation;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Checks if the given element satisfies the provided constraints, as shown by a reference element.
|
||||
*
|
||||
* @param element The element being checked for the constraints.
|
||||
* @param referenceElement The reference element to check the @c element against.
|
||||
*
|
||||
* @return @c YES if the the given elements satisify the constraint, else @NO.
|
||||
*/
|
||||
- (BOOL)satisfiedByElement:(id)element andReferenceElement:(id)referenceElement;
|
||||
|
||||
/**
|
||||
* @return A description of the GREYLayoutConstraint created.
|
||||
*/
|
||||
- (NSString *)description;
|
||||
|
||||
/**
|
||||
* The attribute constraint being checked.
|
||||
*/
|
||||
@property(nonatomic, assign) GREYLayoutAttribute attribute;
|
||||
/**
|
||||
* The GREYLayoutRelation between the @c attribute and the @c referenceAttribute.
|
||||
*/
|
||||
@property(nonatomic, assign) GREYLayoutRelation relation;
|
||||
/**
|
||||
* The value the @c attribute is being compared to.
|
||||
*/
|
||||
@property(nonatomic, assign) GREYLayoutAttribute referenceAttribute;
|
||||
/**
|
||||
* Value to multiply the @c referenceAttribute value with.
|
||||
*/
|
||||
@property(nonatomic, assign) CGFloat multiplier;
|
||||
/**
|
||||
* Any constant to be added to the relation being checked.
|
||||
*/
|
||||
@property(nonatomic, assign) CGFloat constant;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYIdlingResource.h>
|
||||
|
||||
@class NSManagedObjectContext;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Idling resource that tracks core data managed object context operations.
|
||||
*
|
||||
* Tracks the managed object context's internal operation queue and optionally any pending changes
|
||||
* yet to be committed.
|
||||
*/
|
||||
@interface GREYManagedObjectContextIdlingResource : NSObject<GREYIdlingResource>
|
||||
|
||||
/**
|
||||
* Creates an idling resource tracking @c managedObjectContext.
|
||||
*
|
||||
* A weak reference is held to @c managedObjectContext. If @c managedObjectContext is deallocated,
|
||||
* then the idling resource will deregister itself from the thread executor.
|
||||
*
|
||||
* @param managedObjectContext The managed object context to be tracked by the resource.
|
||||
* @param trackPendingChanges If @c YES, then the idling resource will report that it is busy
|
||||
* when the managed object context has pending changes.
|
||||
* @param name A descriptive name for the idling resource.
|
||||
*
|
||||
* @return An idling resource tracking @c managedObjectContext.
|
||||
*/
|
||||
+ (instancetype)resourceWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext
|
||||
trackPendingChanges:(BOOL)trackPendingChanges
|
||||
name:(NSString *)name;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
74
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYMatcher.h
generated
Normal file
74
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYMatcher.h
generated
Normal file
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDescription.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Matchers are another way of expressing simple or complex logical expressions. This protocol
|
||||
* defines a set of methods that must be implemented by every matcher object.
|
||||
*/
|
||||
@protocol GREYMatcher<NSObject>
|
||||
|
||||
/**
|
||||
* A method to evaluate the matcher for the provided @c item.
|
||||
*
|
||||
* @param item The object which is to be evaluated against the matcher.
|
||||
*
|
||||
* @return @c YES if the object matched the matcher, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)matches:(_Nullable id)item;
|
||||
|
||||
/**
|
||||
* A method to evaluate the matcher for the provided @c item with a description for the issue
|
||||
* in case of a mismatch.
|
||||
*
|
||||
* @param item The object which is to be evaluated against the matcher.
|
||||
*
|
||||
* @param mismatchDescription The description that is built or appended if the provided @c item
|
||||
* does not match the matcher.
|
||||
*
|
||||
* @return @c YES if the object matched the matcher, @c NO otherwise. In case of a mismatch, the
|
||||
* reason for mismatch is added to @c mismatchDescription.
|
||||
*/
|
||||
- (BOOL)matches:(_Nullable id)item describingMismatchTo:(id<GREYDescription>)mismatchDescription;
|
||||
|
||||
/**
|
||||
* A method to generate the description containing the reason for why a matcher did not match an
|
||||
* item.
|
||||
*
|
||||
* @param item The object which is to be evaluated against the matcher.
|
||||
*
|
||||
* @param mismatchDescription The description that is built or appended if the provided @c item
|
||||
* does not match the matcher.
|
||||
*
|
||||
* @remark This method assumes that GREYMatcher::matches: is false, but will not check this.
|
||||
*/
|
||||
- (void)describeMismatchOf:(_Nullable id)item to:(id<GREYDescription>)mismatchDescription;
|
||||
|
||||
/**
|
||||
* A method to generate a description of an object.
|
||||
*
|
||||
* @param description The description that is built or appended.
|
||||
*/
|
||||
- (void)describeTo:(id<GREYDescription>)description;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
563
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYMatchers.h
generated
Normal file
563
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYMatchers.h
generated
Normal file
@@ -0,0 +1,563 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol GREYMatcher;
|
||||
|
||||
/**
|
||||
* EarlGrey matchers for UI elements.
|
||||
*/
|
||||
@interface GREYMatchers : NSObject
|
||||
|
||||
/**
|
||||
* Matcher for application's key window.
|
||||
*
|
||||
* @return A matcher for the application's key window.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForKeyWindow;
|
||||
|
||||
/**
|
||||
* Matcher for UI element with the provided accessibility @c label.
|
||||
*
|
||||
* @param label The accessibility label to be matched.
|
||||
*
|
||||
* @return A matcher for the accessibility label of an accessible element.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAccessibilityLabel:(NSString *)label;
|
||||
|
||||
/**
|
||||
* Matcher for UI element with the provided accessibility ID @c accessibilityID.
|
||||
*
|
||||
* @param accessibilityID The accessibility ID to be matched.
|
||||
*
|
||||
* @return A matcher for the accessibility ID of an accessible element.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAccessibilityID:(NSString *)accessibilityID;
|
||||
|
||||
/**
|
||||
* Matcher for UI element with the provided accessibility @c value.
|
||||
*
|
||||
* @param value The accessibility value to be matched.
|
||||
*
|
||||
* @return A matcher for the accessibility value of an accessible element.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAccessibilityValue:(NSString *)value;
|
||||
|
||||
/**
|
||||
* Matcher for UI element with the provided accessibility @c traits.
|
||||
*
|
||||
* @param traits The accessibility traits to be matched.
|
||||
*
|
||||
* @return A matcher for the accessibility traits of an accessible element.
|
||||
*
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAccessibilityTraits:(UIAccessibilityTraits)traits;
|
||||
|
||||
/**
|
||||
* Matcher for UI element with the provided accessiblity @c hint.
|
||||
*
|
||||
* @param hint The accessibility hint to be matched.
|
||||
*
|
||||
* @return A matcher for the accessibility hint of an accessible element.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAccessibilityHint:(NSString *)hint;
|
||||
|
||||
/**
|
||||
* Matcher for UI element with accessiblity focus.
|
||||
*
|
||||
* @return A matcher for the accessibility focus of an accessible element.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAccessibilityElementIsFocused;
|
||||
|
||||
/**
|
||||
* Matcher for UI elements of type UIButton, UILabel, UITextField or UITextView displaying the
|
||||
* provided @c inputText.
|
||||
*
|
||||
* @param text The text to be matched in the UI elements.
|
||||
*
|
||||
* @return A matcher to check for any UI elements with a text field containing the given text.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForText:(NSString *)text;
|
||||
|
||||
/**
|
||||
* Matcher for element that is the first responder.
|
||||
*
|
||||
* @return A matcher that verifies if a UI element is the first responder.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForFirstResponder;
|
||||
|
||||
/**
|
||||
* Matcher to check if system alert view is shown.
|
||||
*
|
||||
* @return A matcher to check if a system alert view is being shown.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForSystemAlertViewShown;
|
||||
|
||||
/**
|
||||
* Matcher for UI element whose percent visible area (of its accessibility frame) exceeds the
|
||||
* given @c percent.
|
||||
*
|
||||
* @param percent The percent visible area that the UI element being matched has to be visible.
|
||||
* Allowed values for @c percent are [0,1] inclusive.
|
||||
*
|
||||
* @return A matcher that checks if a UI element has a visible area at least equal
|
||||
* to a minimum value.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForMinimumVisiblePercent:(CGFloat)percent;
|
||||
|
||||
/**
|
||||
* Matcher for UI element that is sufficiently visible to the user. EarlGrey considers elements
|
||||
* that are more than @c kElementSufficientlyVisiblePercentage (75 %) visible areawise to be
|
||||
* sufficiently visible.
|
||||
*
|
||||
* @return A matcher intialized with a visibility percentage that confirms an element is
|
||||
* sufficiently visible.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForSufficientlyVisible;
|
||||
|
||||
/**
|
||||
* Matcher for UI element that is not visible to the user at all i.e. it has a zero visible area.
|
||||
*
|
||||
* @return A matcher for verifying if an element is not visible.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForNotVisible;
|
||||
|
||||
/**
|
||||
* Matcher for UI element that matches EarlGrey's criteria for user interaction. Currently it must
|
||||
* satisfy at least the following criteria:
|
||||
* 1) At least a few pixels of the element are visible to the user.
|
||||
* 2) The element's accessibility activation point OR the center of the element's visible area
|
||||
* is completely visible.
|
||||
*
|
||||
* @return A matcher that checks if a UI element is interactable.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForInteractable;
|
||||
|
||||
/**
|
||||
* Matcher to check if a UI element is accessible.
|
||||
*
|
||||
* @return A matcher that checks if a UI element is accessible.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAccessibilityElement;
|
||||
|
||||
/**
|
||||
* Matcher for elements that are instances of the provided @c klass or any class that inherits from
|
||||
* it.
|
||||
*
|
||||
* @param klass A class.
|
||||
*
|
||||
* @return A matcher that checks if the given element's class is the provided @c klass or any of
|
||||
* its derived classes.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForKindOfClass:(Class)klass;
|
||||
|
||||
/**
|
||||
* Matcher for matching UIProgressView's values. Use greaterThan, greaterThanOrEqualTo,
|
||||
* lessThan etc to create @c comparisonMatcher. For example, to match the UIProgressView
|
||||
* elements that have progress value greater than 50.2, use
|
||||
* @code [GREYMatchers matcherForProgress:grey_greaterThan(@(50.2))] @endcode. In case if an
|
||||
* unimplemented matcher is required, please implement it similar to @c grey_closeTo.
|
||||
*
|
||||
* @param comparisonMatcher The matcher with the value to check the progress against.
|
||||
*
|
||||
* @return A matcher for checking a UIProgessView's value.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForProgress:(id<GREYMatcher>)comparisonMatcher;
|
||||
|
||||
/**
|
||||
* Matcher for UI element that respond to the provided @c sel.
|
||||
*
|
||||
* @param sel The selector to be responded to.
|
||||
*
|
||||
* @return A matcher to check if a UI element's class responds to a particular selector.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForRespondsToSelector:(SEL)sel;
|
||||
|
||||
/**
|
||||
* Matcher for UI element that conform to the provided @c protocol.
|
||||
*
|
||||
* @param protocol The protocol that the UI element must conform to.
|
||||
*
|
||||
* @return A matcher to check if a UI element's class confirms to a particular protocol.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForConformsToProtocol:(Protocol *)protocol;
|
||||
|
||||
/**
|
||||
* Matcher that matches any UI element with an ancestor matching the given @c ancestorMatcher.
|
||||
*
|
||||
* @param ancestorMatcher A matcher that's run against the ancestors of the UI element being
|
||||
* matched.
|
||||
*
|
||||
* @return A matcher to check if a specified element has an ancestor that matches
|
||||
* @c ancestorMatcher.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAncestor:(id<GREYMatcher>)ancestorMatcher;
|
||||
|
||||
/**
|
||||
* Matcher that matches any UI element with a descendant matching the given @c descendantMatcher.
|
||||
*
|
||||
* @param descendantMatcher A matcher that's run against the descendants of the UI element being
|
||||
* matched.
|
||||
*
|
||||
* @return A matcher to check if a specified element has a descendant that matches
|
||||
* @c descendantMatcher.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForDescendant:(id<GREYMatcher>)descendantMatcher;
|
||||
|
||||
/**
|
||||
* Matcher that matches UIButton that has title label as @c text.
|
||||
*
|
||||
* @param title The title to be checked on the UIButtons being matched.
|
||||
*
|
||||
* @return A matcher to confirm UIButton titles.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForButtonTitle:(NSString *)title;
|
||||
|
||||
/**
|
||||
* Matcher that matches UIScrollView that has contentOffset as @c offset.
|
||||
*
|
||||
* @param offset The content offset to be checked on the UIScrollView being
|
||||
* matched.
|
||||
*
|
||||
* @return A matcher to confirm UIScrollView content offset.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForScrollViewContentOffset:(CGPoint)offset;
|
||||
|
||||
/**
|
||||
* Matcher that matches UIStepper with value as @c value.
|
||||
*
|
||||
* @param value A value that the UIStepper should be checked for.
|
||||
*
|
||||
* @return A matcher for checking UIStepper values.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForStepperValue:(double)value;
|
||||
|
||||
/**
|
||||
* Matcher that matches a UISlider's value.
|
||||
*
|
||||
* @param valueMatcher A matcher for the UISlider's value. You must provide a valid
|
||||
* @c valueMatcher for the floating point value comparison. The
|
||||
* @c valueMatcher should be of the type @c closeTo, @c greaterThan,
|
||||
* @c lessThan, @c lessThanOrEqualTo, @c greaterThanOrEqualTo. The
|
||||
* value matchers should account for any loss in precision for the given
|
||||
* floating point value. If you are using @c grey_closeTo, use delta diff as
|
||||
* @c kGREYAcceptableFloatDifference. In case if an unimplemented matcher
|
||||
* is required, please implement it similar to @c grey_closeTo.
|
||||
*
|
||||
* @return A matcher for checking a UISlider's value.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForSliderValueMatcher:(id<GREYMatcher>)valueMatcher;
|
||||
|
||||
/**
|
||||
* Matcher that matches UIDatePicker that is set to @c value.
|
||||
*
|
||||
* @param value The date value that should be present in the UIDatePicker
|
||||
*
|
||||
* @return A matcher for a date in a UIDatePicker.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForDatePickerValue:(NSDate *)value;
|
||||
|
||||
/**
|
||||
* Matcher that matches UIPickerView that has a column set to @c value.
|
||||
*
|
||||
* @param column The column of the UIPickerView to be matched.
|
||||
* @param value The value that should be set in the column of the UIPickerView.
|
||||
*
|
||||
* @return A matcher to check the value in a particular column of a UIPickerView.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForPickerColumn:(NSInteger)column
|
||||
setToValue:(nullable NSString *)value;
|
||||
|
||||
/**
|
||||
* Matcher that verifies whether an element, that is a UIControl, is enabled.
|
||||
*
|
||||
* @return A matcher for checking whether a UI element is an enabled UIControl.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForEnabledElement;
|
||||
|
||||
/**
|
||||
* Matcher that verifies whether an element, that is a UIControl, is selected.
|
||||
*
|
||||
* @return A matcher for checking whether a UI element is a selected UIControl.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForSelectedElement;
|
||||
|
||||
/**
|
||||
* Matcher that verifies whether a view has its userInteractionEnabled property set to @c YES.
|
||||
*
|
||||
* @return A matcher for checking whether a view' userInteractionEnabled property is set to @c YES.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForUserInteractionEnabled;
|
||||
|
||||
/**
|
||||
* Matcher that verifies that the selected element satisfies the given constraints to the
|
||||
* reference element.
|
||||
* Usage:
|
||||
* @code
|
||||
* GREYLayoutConstraint *constraint1 = [GREYLayoutConstraint layoutConstraintWithAttribute ... ];
|
||||
* GREYLayoutConstraint *constraint2 = [GREYLayoutConstraint layoutConstraintForDirection ... ];
|
||||
* id<GREYMatcher> *matcher = [GREYMatcher matcherForConstraints:@[ constraint1, constraint2 ]
|
||||
* toReferenceElementMatching:aReferenceElementMatcher];
|
||||
* [EarlGrey selectElementWithMatcher ...] assertWithMatcher:matcher];
|
||||
* @endcode
|
||||
*
|
||||
* @param constraints The constraints to be matched.
|
||||
* @param referenceElementMatcher The reference element with the correct constraints.
|
||||
*
|
||||
* @remark Constraints are often represented using floating point numbers. Floating point
|
||||
* arithmetic can often induce errors based on the way the numbers are represented in
|
||||
* hardware; hence, floating point comparisons use a margin value
|
||||
* @c kGREYAcceptableFloatDifference that is used for adding accuracy to such arithmetic.
|
||||
*
|
||||
* @return A matcher to verify the GREYLayoutConstraints on a UI element.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForConstraints:(NSArray *)constraints
|
||||
toReferenceElementMatching:(id<GREYMatcher>)referenceElementMatcher;
|
||||
|
||||
/**
|
||||
* Matcher primarily for asserting that the element is @c nil or not found.
|
||||
*
|
||||
* @return A matcher to check if a specified element is @c nil or not found.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForNil;
|
||||
|
||||
/**
|
||||
* Matcher for asserting that the element exists in the UI hierarchy (i.e. not @c nil).
|
||||
*
|
||||
* @return A matcher to check if a specified element is not @c nil.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForNotNil;
|
||||
|
||||
/**
|
||||
* Matcher for toggling the switch control.
|
||||
*
|
||||
* @param on The state of the switch control. The switch control is in ON state if @c on is @c YES
|
||||
* or OFF state if @c on is NO.
|
||||
*
|
||||
* @return A matcher to check if a UISwitch is on or off.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForSwitchWithOnState:(BOOL)on;
|
||||
|
||||
/**
|
||||
* A Matcher for NSNumbers that matches when the examined number is within a specified @c delta
|
||||
* from the specified value.
|
||||
*
|
||||
* @param value The expected value of the number being matched.
|
||||
*
|
||||
* @param delta The delta within which matches are allowed
|
||||
*
|
||||
* @return A matcher that checks if a number is close to a specified @c value.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForCloseTo:(double)value delta:(double)delta;
|
||||
|
||||
/**
|
||||
* A Matcher that matches against any object, including @c nils.
|
||||
*
|
||||
* @return A matcher that matches any object.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForAnything;
|
||||
|
||||
/**
|
||||
* A Matcher that checks if a provided object is equal to the specified @c value. The equality is
|
||||
* determined by calling the @c isEqual: method of the object being examined. In case the @c
|
||||
* value is @c nil, then the object itself is checked to be @c nil.
|
||||
*
|
||||
* @param value The value to be checked for equality. Please ensure that scalar types are
|
||||
* passed in as boxed (object) values.
|
||||
*
|
||||
* @return A matcher that checks if an object is equal to the provided one.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForEqualTo:(id)value;
|
||||
|
||||
/**
|
||||
* A Matcher that checks if a provided object is less than a specified @c value. The comparison
|
||||
* is made by calling the @c compare: method of the object being examined.
|
||||
*
|
||||
* @param value The value to be compared, which should return @c NSOrderedDescending. Please
|
||||
* ensure that scalar values are passed in as boxed (object) values.
|
||||
*
|
||||
* @return A matcher that checks an object is lesser than another provided @c value.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForLessThan:(id)value;
|
||||
|
||||
/**
|
||||
* A Matcher that checks if a provided object is greater than a specified @c value. The comparison
|
||||
* is made by calling the @c compare: method of the object being examined.
|
||||
*
|
||||
* @param value The value to be compared, which should return @c NSOrderedAscending. Please
|
||||
* ensure that scalar values are passed in as boxed (object) values.
|
||||
*
|
||||
* @return A matcher that checks an object is greater than another provided @c value.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForGreaterThan:(id)value;
|
||||
|
||||
/**
|
||||
* Matcher that matches a UIScrollView scrolled to content @c edge.
|
||||
*
|
||||
* @param edge The content edge UIScrollView should be scrolled to.
|
||||
*
|
||||
* @return A matcher that matches a UIScrollView scrolled to content @c edge.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForScrolledToContentEdge:(GREYContentEdge)edge;
|
||||
|
||||
/**
|
||||
* Matcher that matches a UITextField's content.
|
||||
*
|
||||
* @param value The text string contained inside the UITextField.
|
||||
*
|
||||
* @return A matcher that matches the value inside a UITextField.
|
||||
*/
|
||||
+ (id<GREYMatcher>)matcherForTextFieldValue:(NSString *)value;
|
||||
|
||||
@end
|
||||
|
||||
#if !(GREY_DISABLE_SHORTHAND)
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForKeyWindow. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_keyWindow(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAccessibilityLabel:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_accessibilityLabel(NSString *label);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAccessibilityID:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_accessibilityID(NSString *accessibilityID);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAccessibilityValue:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_accessibilityValue(NSString *grey_accessibilityValue);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAccessibilityTraits:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_accessibilityTrait(UIAccessibilityTraits traits);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAccessibilityElementIsFocused. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_accessibilityFocused(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAccessibilityHint:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_accessibilityHint(NSString *hint);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForText:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_text(NSString *inputText);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForFirstResponder. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_firstResponder(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForSystemAlertViewShown. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_systemAlertViewShown(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForMinimumVisiblePercent:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_minimumVisiblePercent(CGFloat percent);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForSufficientlyVisible. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_sufficientlyVisible(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForInteractable. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_interactable(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForNotVisible. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_notVisible(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAccessibilityElement. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_accessibilityElement(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForKindOfClass:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_kindOfClass(Class klass);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForProgress:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_progress(id<GREYMatcher> comparisonMatcher);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForRespondsToSelector:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_respondsToSelector(SEL sel);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForConformsToProtocol:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_conformsToProtocol(Protocol *protocol);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAncestor:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_ancestor(id<GREYMatcher> ancestorMatcher);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForDescendant:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_descendant(id<GREYMatcher> descendantMatcher);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForButtonTitle:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_buttonTitle(NSString *text);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForScrollViewContentOffset:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_scrollViewContentOffset(CGPoint offset);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForStepperValue:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_stepperValue(double value);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForSliderValueMatcher:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_sliderValueMatcher(id<GREYMatcher> valueMatcher);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForDatePickerValue:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_datePickerValue(NSDate *date);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForPickerColumn:setToValue:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_pickerColumnSetToValue(NSInteger column,
|
||||
NSString * _Nullable value);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForEnabledElement. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_enabled(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForSelectedElement. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_selected(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForUserInteractionEnabled. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_userInteractionEnabled(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForConstraints:toReferenceElementMatching:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_layout(NSArray *constraints,
|
||||
id<GREYMatcher> referenceElementMatcher);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForNil. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_nil(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForNotNil. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_notNil(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForSwitchWithOnState:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_switchWithOnState(BOOL on);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForCloseTo:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_closeTo(double value, double delta);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForAnything. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_anything(void);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForEqualTo:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_equalTo(id value);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForLessThan:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_lessThan(id value);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForGreaterThan:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_greaterThan(id value);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForScrolledToContentEdge:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_scrolledToContentEdge(GREYContentEdge edge);
|
||||
|
||||
/** Shorthand for GREYMatchers::matcherForTextFieldValue:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_textFieldValue(NSString *value);
|
||||
|
||||
#endif // GREY_DISABLE_SHORTHAND
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYIdlingResource.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* An idling resource to track NSTimer firing events so that the framework can synchronize
|
||||
* with them.
|
||||
*/
|
||||
@interface GREYNSTimerIdlingResource : NSObject<GREYIdlingResource>
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Creates an idling resource that tracks the specified @c timer, causing actions to wait until
|
||||
* the timer is fired or invalidated. If @c removeOnIdle is @c YES, the idling resource will
|
||||
* automatically remove itself from the list of registered idling resources when it becomes idle.
|
||||
*
|
||||
* @param timer The timer that will be tracked by the idling resource.
|
||||
* @param name A descriptive name for the idling resource.
|
||||
* @param removeOnIdle Defines whether the resource should unregister itself when it becomes idle.
|
||||
*
|
||||
* @return A new and initialized GREYNSTimerIdlingResource instance.
|
||||
*/
|
||||
+ (instancetype)trackTimer:(NSTimer *)timer name:(NSString *)name removeOnIdle:(BOOL)removeOnIdle;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
50
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYNot.h
generated
Normal file
50
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYNot.h
generated
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
#import <EarlGrey/GREYBaseMatcher.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A matcher to negate the result of another matcher.
|
||||
*/
|
||||
@interface GREYNot : GREYBaseMatcher
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes this matcher with another @c matcher whose result is negated.
|
||||
*
|
||||
* @param matcher A matcher whose result will be negated.
|
||||
*
|
||||
* @return An instance of GREYNot, initialized with a matcher.
|
||||
*/
|
||||
- (instancetype)initWithMatcher:(id<GREYMatcher>)matcher NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
#if !(GREY_DISABLE_SHORTHAND)
|
||||
|
||||
/** Shorthand macro for GREYNot::initWithMatcher:. */
|
||||
GREY_EXPORT id<GREYMatcher> grey_not(id<GREYMatcher> matcher);
|
||||
|
||||
#endif // GREY_DISABLE_SHORTHAND
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYIdlingResource.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Idling resource that monitors operation queues.
|
||||
*/
|
||||
@interface GREYOperationQueueIdlingResource : NSObject<GREYIdlingResource>
|
||||
|
||||
/**
|
||||
* Creates an idling resource for monitoring @c queue for idleness.
|
||||
* A queue is considered idle when it has no pending operations.
|
||||
* A weak reference is held to @c queue. If @c queue is deallocated, then the idling resource will
|
||||
* deregister itself from the UI thread executor.
|
||||
*
|
||||
* @param queue The queue that will be tracked by the resource.
|
||||
* @param name A descriptive name for the idling resource.
|
||||
*
|
||||
* @return Returns an idling resource for the specified NSOperationQueue.
|
||||
*/
|
||||
+ (instancetype)resourceWithNSOperationQueue:(NSOperationQueue *)queue name:(NSString *)name;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
33
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYProvider.h
generated
Normal file
33
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYProvider.h
generated
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A protocol for providing arbitrary data as an enumeration.
|
||||
*/
|
||||
@protocol GREYProvider<NSObject>
|
||||
|
||||
/**
|
||||
* @return A new enumerator that can be used to enumerate data backed by this provider.
|
||||
*/
|
||||
- (NSEnumerator *)dataEnumerator;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Provides interfaces for taking screenshots of the entire screen and UI elements of the App.
|
||||
*/
|
||||
@interface GREYScreenshotUtil : NSObject
|
||||
|
||||
/**
|
||||
* Draws the application's main screen using the bitmap graphics context specified by the @c
|
||||
* bitmapContextRef reference, centering it if the context size is different than the screen size.
|
||||
* The provided reference must point to a CGBitmapContext. When @c afterUpdates is set to @c YES,
|
||||
* this method waits for the screen to draw pending changes before taking a screenshot, otherwise
|
||||
* the screenshot contains the current contents of the screen.
|
||||
*
|
||||
* @param bitmapContextRef Target bitmap context for rendering.
|
||||
* @param afterUpdates Boolean indicating whether to render before (@c NO) or after (@c YES)
|
||||
* screen updates.
|
||||
*/
|
||||
+ (void)drawScreenInContext:(CGContextRef)bitmapContextRef afterScreenUpdates:(BOOL)afterUpdates;
|
||||
|
||||
/**
|
||||
* @return An image of the current app's screen frame buffer. This method waits for any pending
|
||||
* screen updates to go through before taking a screenshot. Returned image orientation is
|
||||
* same as the current interface orientation.
|
||||
*/
|
||||
+ (UIImage *)takeScreenshot;
|
||||
|
||||
/**
|
||||
* @return The App Store and iTunes Connect friendly image of the current screen frame buffer.
|
||||
*/
|
||||
+ (UIImage *)takeScreenshotForAppStore;
|
||||
|
||||
/**
|
||||
* @return A snapshot of the provided @c element. @c element must be an instance of @c UIView or
|
||||
* an accessibility element.
|
||||
*/
|
||||
+ (UIImage *)snapshotElement:(id)element;
|
||||
|
||||
/**
|
||||
* Saves the provided @c image as a PNG to the given @c filename under the given @c directoryPath.
|
||||
* If the given directory path doesn't exist, it will be created.
|
||||
*
|
||||
* @param image The source image.
|
||||
* @param filename The target file name.
|
||||
* @param directoryPath The path to the directory where the image must be saved.
|
||||
*
|
||||
* @return The complete filepath and name of the saved image or @c nil on failure.
|
||||
*/
|
||||
+ (NSString *)saveImageAsPNG:(UIImage *)image
|
||||
toFile:(NSString *)filename
|
||||
inDirectory:(NSString *)directoryPath;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Returns a new buffer that contains XRGB pixels for the provided @c imageRef i.e. the alpha
|
||||
* channel is removed. If @c outBitmapContext is not @c NULL, it is set to the bitmap context of
|
||||
* the returned buffer and caller must call CGContextRelease on it. Each pixel in returned buffer
|
||||
* occupies 4 bytes and the buffer must be free()'d by the caller.
|
||||
*
|
||||
* @param imageRef The source image.
|
||||
* @param[out] outBmpCtx Optional bitmap context that holds the returned buffer.
|
||||
*
|
||||
* @return A new buffer that contains XRGB pixels for the provided image.
|
||||
*/
|
||||
GREY_EXPORT unsigned char *_Nullable grey_createImagePixelDataFromCGImageRef(
|
||||
CGImageRef imageRef, CGContextRef _Nullable *_Nullable outBmpCtx);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
/**
|
||||
* The Error domain for a scroll error.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYScrollErrorDomain;
|
||||
|
||||
/**
|
||||
* Error codes for scrolling related errors.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYScrollErrorCode) {
|
||||
/**
|
||||
* Reached content edge before the entire scroll action was complete.
|
||||
*/
|
||||
kGREYScrollReachedContentEdge,
|
||||
/**
|
||||
* It is not possible to scroll.
|
||||
*/
|
||||
kGREYScrollImpossible,
|
||||
/**
|
||||
* Could not scroll to the element we are looking for.
|
||||
*/
|
||||
kGREYScrollToElementFailed,
|
||||
};
|
||||
47
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYSyncAPI.h
generated
Normal file
47
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYSyncAPI.h
generated
Normal file
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Methods for executing sync or async blocks with EarlGrey operations.
|
||||
*/
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Executes a block containing EarlGrey statements on the main thread and waits for it to
|
||||
* complete. @c block is retained until execution completes.
|
||||
* Important: Must be called from a non-main thread otherwise it will block main thread
|
||||
* indefinitely.
|
||||
*
|
||||
* @param block Block that will be executed.
|
||||
*/
|
||||
GREY_EXPORT void grey_execute_sync(void (^block)(void));
|
||||
|
||||
/**
|
||||
* Executes a block containing EarlGrey statements on the main thread without waiting for it to
|
||||
* complete. @c block is retained until execution completes.
|
||||
* Can be invoked safely from the main or non-main thread.
|
||||
*
|
||||
* @param block Block that will be executed.
|
||||
*/
|
||||
GREY_EXPORT void grey_execute_async(void (^block)(void));
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
39
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYTestHelper.h
generated
Normal file
39
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Headers/GREYTestHelper.h
generated
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Provides interface for test helper methods.
|
||||
*/
|
||||
@interface GREYTestHelper : NSObject
|
||||
|
||||
/**
|
||||
* Enables fast animation. Invoke in the XCTest setUp method to increase
|
||||
* the speed of your tests by not having to wait on slow animations.
|
||||
*/
|
||||
+ (void)enableFastAnimation;
|
||||
|
||||
/**
|
||||
* Disables fast animation.
|
||||
*/
|
||||
+ (void)disableFastAnimation;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,139 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Header file for GREYUIThreadExecutor.
|
||||
*/
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol GREYIdlingResource;
|
||||
|
||||
/**
|
||||
* Error domain for thread executor failures.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYUIThreadExecutorErrorDomain;
|
||||
|
||||
/**
|
||||
* Error codes for thread executor failures.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYUIThreadExecutorErrorCode) {
|
||||
/**
|
||||
* Timeout reached before block could be executed.
|
||||
*/
|
||||
kGREYUIThreadExecutorTimeoutErrorCode,
|
||||
};
|
||||
|
||||
/**
|
||||
* Typedef for blocks that can be executed by the GREYUIThreadExecutor.
|
||||
*/
|
||||
typedef void(^GREYExecBlock)(void);
|
||||
|
||||
/**
|
||||
* Executor that syncs execution with the UI events on the main thread.
|
||||
* Before executing a block or operation, it waits for any pending UI events to complete.
|
||||
*/
|
||||
@interface GREYUIThreadExecutor : NSObject
|
||||
|
||||
/**
|
||||
* @return The unique shared instance of the GREYUIThreadExecutor.
|
||||
*/
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Blocking call that drains the main runloop enough times to make each source gets a fair chance
|
||||
* of service. No guarantee is made on whether the app is in kGREYIdle state after this method
|
||||
* returns.
|
||||
*/
|
||||
- (void)drainOnce;
|
||||
|
||||
/**
|
||||
* Blocking call that drains the UI thread for the specified number of @c seconds.
|
||||
* This method can block for longer than the specified time if any of the signalled sources take
|
||||
* longer than that to execute.
|
||||
*
|
||||
* @param seconds Amount of time that the UI thread should be drained for, in seconds.
|
||||
*/
|
||||
- (void)drainForTime:(CFTimeInterval)seconds;
|
||||
|
||||
/**
|
||||
* Blocking call that drains the UI thread until both the UI and registered GREYIdlingResources
|
||||
* are in idle.
|
||||
*
|
||||
* @remark Be very careful while calling this as you could end up in state where the caller expects
|
||||
* the callee to mark the thread as idle and callee inadvertantly calls
|
||||
* GREYUIThreadExecutor::drainUntilIdle:, in which case it will go into an infinite loop
|
||||
* and the test will have to be force-killed by the test-runner.
|
||||
*/
|
||||
- (void)drainUntilIdle;
|
||||
|
||||
/**
|
||||
* Drains the UI thread and waits for both the UI and idling resources to idle until the given
|
||||
* amount of @c seconds have passed, at which point, a timeout occurs and the method returns @c NO.
|
||||
* Returns @c YES if idled within @c seconds, @c NO otherwise.
|
||||
*
|
||||
* @param seconds Amount of time to wait for the UI and idling resources to idle.
|
||||
*
|
||||
* @return @c YES if idled within @c seconds, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)drainUntilIdleWithTimeout:(CFTimeInterval)seconds;
|
||||
|
||||
/**
|
||||
* Invokes GREYUIThreadExecutor::executeSyncWithTimeout:block:error: with @c kGREYInfiniteTimeout,
|
||||
* @c execBlock and @c error as the respective parameters.
|
||||
*
|
||||
* @param execBlock The block to be executed.
|
||||
* @param errorOrNil Reference to the error that will store the failure cause, if any.
|
||||
*
|
||||
* @return @c YES if the block was executed, @c NO otherwise, in which case @c error will be set to
|
||||
* the failure cause.
|
||||
*/
|
||||
- (BOOL)executeSync:(GREYExecBlock)execBlock
|
||||
error:(__strong NSError *_Nullable *_Nullable)errorOrNil;
|
||||
|
||||
/**
|
||||
* Executes @c execBlock on the main thread, synchronizing with all registered GREYIdlingResources
|
||||
* and UI events. If the UI thread or idling resources are not idle until @c seconds have elapsed,
|
||||
* @c execBlock is not executed and error (if provided) is populated.
|
||||
*
|
||||
* @param seconds The timeout for waiting for the resources to idle, in seconds.
|
||||
* A value of @c kGREYInfiniteTimeout indicates an infinite timeout.
|
||||
* @param execBlock The block to be executed.
|
||||
* @param errorOrNil Reference to the error that will store the failure cause, if any.
|
||||
*
|
||||
* @return @c YES if the block was executed, @c NO otherwise, in which case @c error will be set to
|
||||
* the failure cause.
|
||||
*
|
||||
* @remark Blocks are executed in the order in which they were submitted.
|
||||
* @remark This selector must be invoked on the main thread.
|
||||
*/
|
||||
- (BOOL)executeSyncWithTimeout:(CFTimeInterval)seconds
|
||||
block:(_Nullable GREYExecBlock)execBlock
|
||||
error:(__strong NSError *_Nullable *_Nullable)errorOrNil;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
BIN
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Info.plist
generated
Normal file
BIN
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/Info.plist
generated
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
framework module EarlGrey {
|
||||
umbrella header "EarlGrey.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
/**
|
||||
* An enumeration of all states that EarlGrey identifies a CAAnimation to be in.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, GREYCAAnimationState) {
|
||||
/**
|
||||
* Default state every animation is in.
|
||||
*/
|
||||
kGREYAnimationPendingStart = 0,
|
||||
/**
|
||||
* State the animation is in when it begins.
|
||||
*/
|
||||
kGREYAnimationStarted,
|
||||
/**
|
||||
* State the animation is in when it ends.
|
||||
*/
|
||||
kGREYAnimationStopped,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* EarlGrey specific addition for CAAnimation to track currently running animations.
|
||||
*/
|
||||
@interface CAAnimation (GREYAdditions)
|
||||
|
||||
/**
|
||||
* Sets the animation state to @c state.
|
||||
*
|
||||
* @param state The target state.
|
||||
*/
|
||||
- (void)grey_setAnimationState:(GREYCAAnimationState)state;
|
||||
|
||||
/**
|
||||
* Returns the current state of the animation. If CAAnimation::grey_setAnimationState was never
|
||||
* called on this animation, @c kGREYANIMATION_PENDING_START is returned.
|
||||
*
|
||||
* @return The current state.
|
||||
*/
|
||||
- (GREYCAAnimationState)grey_animationState;
|
||||
|
||||
/**
|
||||
* Tracks the animation with GREYAppStateTracker until the expected animation runtime has elapsed,
|
||||
* after which it untracks itself.
|
||||
*/
|
||||
- (void)grey_trackForDurationOfAnimation;
|
||||
|
||||
/**
|
||||
* Force untrack itself from GREYAppStateTracker, regardless of completion status.
|
||||
*/
|
||||
- (void)grey_untrack;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
/**
|
||||
* EarlGrey specific additions to CALayer to track animations.
|
||||
*/
|
||||
@interface CALayer (GREYAdditions)
|
||||
@end
|
||||
@@ -0,0 +1,220 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#pragma mark - Constants
|
||||
|
||||
/**
|
||||
* Value used to denote a null CGPoint.
|
||||
*/
|
||||
extern const CGPoint GREYCGPointNull;
|
||||
|
||||
#pragma mark - CGVector
|
||||
|
||||
/**
|
||||
* @return The scalar length of @c vector.
|
||||
*/
|
||||
CGFloat CGVectorLength(CGVector vector);
|
||||
|
||||
/**
|
||||
* @return The the vector obtained by scaling the given @c vector by the given @c scale amount.
|
||||
*/
|
||||
CGVector CGVectorScale(CGVector vector, CGFloat scale);
|
||||
|
||||
/**
|
||||
* Creates a vector with the given end points and optionally normalizes it if @c normalize is
|
||||
* @c YES.
|
||||
*
|
||||
* @param startPoint Start point for the vector.
|
||||
* @param endPoint End point for the vector.
|
||||
* @param normalize A @c BOOL indicating whether to normalize (@c YES) or not (@c NO).
|
||||
*
|
||||
* @return A vector with the given end points and optionally normalized if @c normalize is
|
||||
* @c YES.
|
||||
*/
|
||||
CGVector CGVectorFromEndPoints(CGPoint startPoint, CGPoint endPoint, BOOL normalize);
|
||||
|
||||
#pragma mark - CGPoint
|
||||
|
||||
/**
|
||||
* Adds the corresponding coordinates of the given @c vector and @c point and returns the result as
|
||||
* a CGPoint.
|
||||
*
|
||||
* @param point The point to add.
|
||||
* @param vector The vector to add.
|
||||
*
|
||||
* @return A point with corresponding coordinates of the given @c point and @c vector added.
|
||||
*/
|
||||
CGPoint CGPointAddVector(CGPoint point, CGVector vector);
|
||||
|
||||
/**
|
||||
* @return The center of the provided @c rect.
|
||||
*/
|
||||
CGPoint CGRectCenter(CGRect rect);
|
||||
|
||||
/**
|
||||
* Multiplies both the coordinates of the given @c inPoint by the given @c amount and returns
|
||||
* the resulting point.
|
||||
*
|
||||
* @param inPoint The input point to multiply.
|
||||
* @param amount The amount to multiply with.
|
||||
*
|
||||
* @return The point obtained by multiplying the given @c inPoint and the given @c amount.
|
||||
*/
|
||||
CGPoint CGPointMultiply(CGPoint inPoint, double amount);
|
||||
|
||||
/**
|
||||
* @return The point obtained by converting @c pointToConvertToPixel from points to pixels as per
|
||||
* the screen scale.
|
||||
*/
|
||||
CGPoint CGPointToPixel(CGPoint positionInPoints);
|
||||
|
||||
/**
|
||||
* @return The point obtained by converting @c pixelToConvertToPoint from pixels to points as per
|
||||
* the screen scale.
|
||||
*/
|
||||
CGPoint CGPixelToPoint(CGPoint positionInPixels);
|
||||
|
||||
/**
|
||||
* @return The point obtained after rounding the coordinates of the given @c cgpointInPoints to
|
||||
* the nearest whole pixel and then to points.
|
||||
*/
|
||||
CGPoint CGPointAfterRemovingFractionalPixels(CGPoint cgpointInPoints);
|
||||
|
||||
/**
|
||||
* @return The point obtained by converting the given @c pointInFixed from fixed to variable
|
||||
* coordinate system.
|
||||
*/
|
||||
CGPoint CGPointFixedToVariable(CGPoint pointInFixed);
|
||||
|
||||
/**
|
||||
* @return The point obtained by converting the given @c pointInVariable from variable to fixed
|
||||
* coordinate system.
|
||||
*/
|
||||
CGPoint CGPointVariableToFixed(CGPoint pointInVariable);
|
||||
|
||||
/**
|
||||
* @return @c YES if the given @c point represents an null point, @c NO otherwise.
|
||||
*/
|
||||
BOOL CGPointIsNull(CGPoint point);
|
||||
|
||||
#pragma mark - CGFloat
|
||||
|
||||
/**
|
||||
* @return The value obtained by rounding the given @c floatInPoints to the nearest whole pixel
|
||||
* and converting it to points as per the screen scale.
|
||||
*/
|
||||
CGFloat CGFloatAfterRemovingFractionalPixels(CGFloat floatInPoints);
|
||||
|
||||
#pragma mark - CGRect
|
||||
|
||||
/**
|
||||
* @return The area of the given @c rect.
|
||||
*/
|
||||
double CGRectArea(CGRect rect);
|
||||
|
||||
/**
|
||||
* Scales the given rectangle @c inRect, by a factor of the given @c amount and then translates
|
||||
* the origin by a factor of @c amount. This is same as multiplying x, y, width and height of the
|
||||
* given rectangle by the given @c amount.
|
||||
*
|
||||
* @param inRect The rectangle to be scaled and translated.
|
||||
* @param amount The amount by which to scale (and the factor by which to translate).
|
||||
*
|
||||
* @return The scaled and translated rectangle.
|
||||
*/
|
||||
CGRect CGRectScaleAndTranslate(CGRect inRect, double amount);
|
||||
|
||||
/**
|
||||
* @return The rect obtained by converting the given @c rectInPoints from points to pixels as per
|
||||
* the screen scale.
|
||||
*/
|
||||
CGRect CGRectPointToPixel(CGRect rectInPoints);
|
||||
|
||||
/**
|
||||
* @return The rect obtained by converting the given @c rectInPoints from pixels to points as
|
||||
* per the screen scale.
|
||||
*/
|
||||
CGRect CGRectPixelToPoint(CGRect rectInPixel);
|
||||
|
||||
/**
|
||||
* Starting with iOS 8.0 window and screen coordinates rotates with the the app's interface
|
||||
* orientation. This method converts the given rect in fixed coordinate space to an oriented rect
|
||||
* matching the current app orientation.
|
||||
*
|
||||
* @param rectInFixedCoordinates The rect in fixed coordinates to be transformed to variable
|
||||
* coordinates.
|
||||
*
|
||||
* @return The rect obtained by converting the given @c rectInFixedCoordinates from fixed screen
|
||||
* coordinates to variable screen coordinates.
|
||||
*/
|
||||
CGRect CGRectFixedToVariableScreenCoordinates(CGRect rectInFixedCoordinates);
|
||||
|
||||
/**
|
||||
* Starting with iOS 8.0 window and screen coordinates rotates with the the app's interface
|
||||
* orientation. This method converts the given rect in variable coordinate space to fixed
|
||||
* coordinates.
|
||||
*
|
||||
* @param rectInVariableCoordinates The rect in variable coordinates to be transformed to fixed
|
||||
* coordinates.
|
||||
*
|
||||
* @return The rect obtained by converting the given @c rectInVariableCoordinates from variable
|
||||
* screen coordinates to fixed screen coordinates.
|
||||
*/
|
||||
CGRect CGRectVariableToFixedScreenCoordinates(CGRect rectInVariableCoordinates);
|
||||
|
||||
/**
|
||||
* Return the intersection of @c rect1 and @c rect2. The built-in function can produce floating
|
||||
* errors on 32-bit platform (i.e. iphone 5), which results in a bigger rectangle than both
|
||||
* sources. This will remove the errors by forcing the resulting rectangle to be no greater than
|
||||
* the sources.
|
||||
*
|
||||
* @param rect1 The first source rectangle.
|
||||
* @param rect2 The second source rectangle.
|
||||
*
|
||||
* @return A rectangle that represents the intersection of the two specified rectangles. If the two
|
||||
* rectangles do not intersect, returns the null rectangle. To check for this condition,
|
||||
* use CGRectIsNull.
|
||||
*/
|
||||
CGRect CGRectIntersectionStrict(CGRect rect1, CGRect rect2);
|
||||
|
||||
/**
|
||||
* Normalizes @c rectInPixels to the largest rectangle that is within rectInPixels and
|
||||
* pixel-boundary aligned. If the fractional part of height or width are > 0.5, they are rounded up
|
||||
* otherwise rounded down.
|
||||
*
|
||||
* @param rectInPixels A rect in pixel coordinates.
|
||||
*
|
||||
* @return The normalized rect.
|
||||
*/
|
||||
CGRect CGRectIntegralInside(CGRect rectInPixels);
|
||||
|
||||
#pragma mark - CGAffineTransform
|
||||
|
||||
/**
|
||||
* Returns the transform required for transforming from fixed coordinate system (iOS 7 and below)
|
||||
* to variable coordinate system.
|
||||
*
|
||||
* @remark This method is only applicable on iOS 7 and below as the later OSes use variable
|
||||
* coordinate system by default.
|
||||
*
|
||||
* @param statusBarOrientation A status bar orientation in fixed coordinate system.
|
||||
*
|
||||
* @return The transformed status bar orientation for variable coordinate system.
|
||||
*/
|
||||
CGAffineTransform CGAffineTransformForFixedToVariable(UIInterfaceOrientation statusBarOrientation);
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYActions+Internal.h
|
||||
* @brief Exposes GREYActions' interfaces and methods that are otherwise private for
|
||||
* testing purposes.
|
||||
*/
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GREYActions (Internal)
|
||||
|
||||
/**
|
||||
* Use the iOS keyboard to type a string starting from the provided UITextPosition. If the
|
||||
* position is @c nil, then type text from the text input's current position. Should only be called
|
||||
* with a position if element conforms to the UITextInput protocol - which it should if you
|
||||
* derived the UITextPosition from the element.
|
||||
*
|
||||
* @param text The text to be typed.
|
||||
* @param position The position in the text field at which the text is to be typed.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @remark This is available only for internal testing purposes.
|
||||
*/
|
||||
+ (id<GREYAction>)grey_actionForTypeText:(NSString *)text
|
||||
atUITextPosition:(UITextPosition *)position;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol GREYAnalyticsDelegate;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Provides methods for tracking EarlGrey usage using Google Analytics.
|
||||
*
|
||||
* @remark To opt out of Analytics use GREYConfiguration and set config value for
|
||||
* @c kGREYConfigKeyAnalyticsEnabled to @c NO before the instance tear down method
|
||||
* XCTestCase::tearDown method returns. Sample code to opt out of analytics:
|
||||
* @code
|
||||
* [[GREYConfiguration sharedInstance] setValue:@(NO)
|
||||
* forConfigKey:kGREYConfigKeyAnalyticsEnabled];
|
||||
* @endcode
|
||||
*/
|
||||
@interface GREYAnalytics : NSObject
|
||||
|
||||
/**
|
||||
* @return The singleton instance.
|
||||
*/
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* @return The current delegate.
|
||||
*/
|
||||
- (id<GREYAnalyticsDelegate>)delegate;
|
||||
|
||||
/**
|
||||
* Sets a delegate for custom handling of analytics payload data. To reset GREYAnalytics to its
|
||||
* default behavior pass @c nil.
|
||||
*/
|
||||
- (void)setDelegate:(id<GREYAnalyticsDelegate>)delegate;
|
||||
|
||||
/**
|
||||
* Called when an EarlGrey invocation occurs using any @code [EarlGrey XXX] @endcode statements.
|
||||
*/
|
||||
- (void)didInvokeEarlGrey;
|
||||
|
||||
/**
|
||||
* Sends an Analytics Event hit based on protocol specified in:
|
||||
* @see https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#event
|
||||
*
|
||||
* @param trackingID The tracking ID under which to track this event.
|
||||
* @param clientID The ID for the user sending this event.
|
||||
* @param category The Event Category for the event hit.
|
||||
* @param action The Event Action for the event hit.
|
||||
* @param value The event value for the event hit.
|
||||
*/
|
||||
+ (void)sendEventHitWithTrackingID:(NSString *)trackingID
|
||||
clientID:(NSString *)clientID
|
||||
category:(NSString *)category
|
||||
action:(NSString *)action
|
||||
value:(NSString *)value;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol GREYAnalyticsDelegate<NSObject>
|
||||
|
||||
/**
|
||||
* Sent to the delegate to handle Analytics Event hit. See this for more info:
|
||||
* https://developers.google.com/analytics/devguides/collection/protocol/v1/.
|
||||
*
|
||||
* @note In case of failure to track the method must fail silently to prevent test interruption.
|
||||
*
|
||||
* @param trackingID The tracking ID under which to track this event.
|
||||
* @param clientID The ID for the user sending this event.
|
||||
* @param category The Event Category for the event hit.
|
||||
* @param action The Event Action for the event hit.
|
||||
* @param value The event value for the event hit.
|
||||
*/
|
||||
- (void)trackEventWithTrackingID:(NSString *)trackingID
|
||||
clientID:(NSString *)clientID
|
||||
category:(NSString *)category
|
||||
action:(NSString *)action
|
||||
value:(NSString *)value;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,186 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYIdlingResource.h>
|
||||
|
||||
@class GREYAppStateTrackerObject;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief App state tracker header file.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Non-idle states that the App can be at any given point in time.
|
||||
* These states are not mutually exclusive and can be combined together using Bitwise-OR to
|
||||
* represent multiple states.
|
||||
*/
|
||||
typedef NS_OPTIONS(NSUInteger, GREYAppState) {
|
||||
/**
|
||||
* Idle state implies App is not undergoing any state changes and it is OK to interact with it.
|
||||
*/
|
||||
kGREYIdle = 0,
|
||||
/**
|
||||
* View is pending draw or layout pass.
|
||||
*/
|
||||
kGREYPendingDrawLayoutPass = (1UL << 0),
|
||||
/**
|
||||
* Waiting for viewDidAppear: method invocation.
|
||||
*/
|
||||
kGREYPendingViewsToAppear = (1UL << 1),
|
||||
/**
|
||||
* Waiting for viewDidDisappear: method invocation.
|
||||
*/
|
||||
kGREYPendingViewsToDisappear = (1UL << 2),
|
||||
/**
|
||||
* Pending keyboard transition.
|
||||
*/
|
||||
kGREYPendingKeyboardTransition = (1UL << 3),
|
||||
/**
|
||||
* Waiting for CA animation to complete.
|
||||
*/
|
||||
kGREYPendingCAAnimation = (1UL << 4),
|
||||
/**
|
||||
* Waiting for a UIAnimation to be marked as stopped.
|
||||
*/
|
||||
kGREYPendingUIAnimation = (1UL << 5),
|
||||
/**
|
||||
* Pending root view controller to be set.
|
||||
*/
|
||||
kGREYPendingRootViewControllerToAppear = (1UL << 6),
|
||||
/**
|
||||
* Pending a UIWebView async load request
|
||||
*/
|
||||
kGREYPendingUIWebViewAsyncRequest = (1UL << 7),
|
||||
/**
|
||||
* Pending a network request completion.
|
||||
*/
|
||||
kGREYPendingNetworkRequest = (1UL << 8),
|
||||
/**
|
||||
* Pending gesture recognition.
|
||||
*/
|
||||
kGREYPendingGestureRecognition = (1UL << 9),
|
||||
/**
|
||||
* Waiting for UIScrollView to finish scrolling.
|
||||
*/
|
||||
kGREYPendingUIScrollViewScrolling = (1UL << 10),
|
||||
/**
|
||||
* [UIApplication beginIgnoringInteractionEvents] was called and all interaction events are
|
||||
* being ignored.
|
||||
*/
|
||||
kGREYIgnoringSystemWideUserInteraction = (1UL << 11),
|
||||
};
|
||||
|
||||
/**
|
||||
* Idling resource that tracks the application state.
|
||||
*/
|
||||
@interface GREYAppStateTracker : NSObject<GREYIdlingResource>
|
||||
|
||||
/**
|
||||
* @return The unique shared instance of the GREYAppStateTracker.
|
||||
*/
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @return The state that the App is in currently.
|
||||
*/
|
||||
- (GREYAppState)currentState;
|
||||
|
||||
/**
|
||||
* Updates the state of the object, including the provided @c state and updating the overall state
|
||||
* of the application. If @c object is already being tracked with for a different state, the
|
||||
* object's state will be updated to a XOR of the current state and @c state.
|
||||
*
|
||||
* @param state The state that should be tracked for the object.
|
||||
* @param object The object that should have its tracked state updated.
|
||||
*
|
||||
* @return The GREYAppStateTracker that was assigned to the object by the state tracker, or @c nil
|
||||
* if @c object is @c nil. Future calls for the same object will return the same
|
||||
* identifier until the object is untracked.
|
||||
*/
|
||||
- (GREYAppStateTrackerObject * _Nullable)trackState:(GREYAppState)state forObject:(id)object;
|
||||
|
||||
/**
|
||||
* Untracks the state for the object with the specified id. For untracking, it does not matter
|
||||
* if the state has been added to being ignored.
|
||||
*
|
||||
* @param state The state that should be untracked.
|
||||
* @param object The GREYAppStateTrackerObject associated with the object whose state should be
|
||||
* untracked.
|
||||
*/
|
||||
- (void)untrackState:(GREYAppState)state forObject:(GREYAppStateTrackerObject *)object;
|
||||
|
||||
/**
|
||||
* Ignore any state changes made to the state(s) provided. To stop ignoring a state, set this
|
||||
* to a @c GREYAppState value that does not contain that particular state or use
|
||||
* @c GREYAppStateTracker::clearIgnoredStates.
|
||||
*
|
||||
* @remark This will not retroactively affect any currently tracked objects with the ignored app
|
||||
* state(s). This only ensures that any further tracking of an object with an app state
|
||||
* that is being ignored will be ignored. Untracking is not affected by this method.
|
||||
*
|
||||
* @param state The app state that should be ignored. This can be a bitwise-OR of multiple
|
||||
* app states.
|
||||
*/
|
||||
- (void)ignoreChangesToState:(GREYAppState)state;
|
||||
|
||||
/**
|
||||
* Removes any states that were being ignored.
|
||||
*/
|
||||
- (void)clearIgnoredStates;
|
||||
|
||||
/**
|
||||
* Clears all states that are tracked by the GREYAppStateTracker singleton.
|
||||
*
|
||||
* @remark This is available only for internal testing purposes.
|
||||
*/
|
||||
- (void)grey_clearState;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Utility macro for tracking the state of an object.
|
||||
*
|
||||
* @param state The state that should be tracked for the object.
|
||||
* @param object The object that should have its tracked state updated.
|
||||
*
|
||||
* @return The GREYAppStateTracker that was assigned to the object by the state tracker, or @c nil
|
||||
* if @c object is @c nil. Future calls for the same object will return the same
|
||||
* identifier until the object is untracked.
|
||||
*/
|
||||
#define TRACK_STATE_FOR_OBJECT(state_, object_) \
|
||||
[[GREYAppStateTracker sharedInstance] trackState:(state_) forObject:(object_)]
|
||||
|
||||
/**
|
||||
* Utility macro for untracking the state of an object.
|
||||
*
|
||||
* @param state The state that should be untracked.
|
||||
* @param object The GREYAppStateTrackerObject associated with the object whose state should be
|
||||
* untracked.
|
||||
*/
|
||||
#define UNTRACK_STATE_FOR_OBJECT(state_, object_) \
|
||||
[[GREYAppStateTracker sharedInstance] untrackState:(state_) forObject:(object_)]
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// Copyright 2017 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "Synchronization/GREYAppStateTracker.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class GREYObjectDeallocationTracker;
|
||||
|
||||
/**
|
||||
* Class used by the GREYAppStateTracker for synchronization purposes.
|
||||
*/
|
||||
@interface GREYAppStateTrackerObject : NSObject
|
||||
|
||||
/**
|
||||
* Initializing the GREYAppStateTrackerObject.
|
||||
*
|
||||
* @param deallocationTracker The object that will be pointed to using a weak reference.
|
||||
*
|
||||
* @return An instance of GREYAppStateTrackerObject.
|
||||
*/
|
||||
- (instancetype)initWithDeallocationTracker:(GREYObjectDeallocationTracker *)deallocationTracker;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializer.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @c object is an instance of GREYObjectDeallocatingTracker aka the internal object. The
|
||||
* GREYAppStateTrackerObject holds weakly to the GREYObjectDeallocatingTracker object.
|
||||
*/
|
||||
@property(nonatomic, readonly, weak) GREYObjectDeallocationTracker *object;
|
||||
|
||||
/**
|
||||
* The state that this object is tracking.
|
||||
*/
|
||||
@property(nonatomic, assign) GREYAppState state;
|
||||
|
||||
/**
|
||||
* The description of the object that is being represented by GREYAppStateTrackerObject.
|
||||
*/
|
||||
@property(nonatomic, strong) NSString *objectDescription;
|
||||
|
||||
/**
|
||||
* @return The callstack that was set when a new state @c state was set.
|
||||
*/
|
||||
- (NSArray<NSString *> *)stateAssignmentCallStack;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,423 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYAppleInternals.h
|
||||
* @brief Exposes interfaces, structs and methods that are otherwise private.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIWindow (GREYExposed)
|
||||
- (id)firstResponder;
|
||||
@end
|
||||
|
||||
@interface UIViewController (GREYExposed)
|
||||
- (void)viewWillMoveToWindow:(id)window;
|
||||
- (void)viewDidMoveToWindow:(id)window shouldAppearOrDisappear:(BOOL)arg;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Structure that represents IOHIDEvents, which are sent from iOS to the application.
|
||||
*/
|
||||
typedef struct __IOHIDEvent *IOHIDEventRef;
|
||||
|
||||
/**
|
||||
* Private class source:
|
||||
* http://www.opensource.apple.com/source/IOHIDFamily/IOHIDFamily-503.92.1/IOHIDFamily/IOHIDEventTypes.h
|
||||
*/
|
||||
#ifdef __LP64__
|
||||
typedef double IOHIDFloat;
|
||||
#else
|
||||
typedef float IOHIDFloat;
|
||||
#endif
|
||||
|
||||
typedef UInt32 IOOptionBits;
|
||||
|
||||
/**
|
||||
* Event mask detailing the events being dispatched by a digitizer. It is possible for digitizer
|
||||
* events to contain child digitizer events, effectively, behaving as collections. In the
|
||||
* collection case, the child event mask field referrence by
|
||||
* kIOHIDEventFieldDigitizerChildEventMask will detail the cumulative event state of the child
|
||||
* digitizer events. If you append a child digitizer event to a parent digitizer event, appropriate
|
||||
* state will be transferred on to the parent.
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
* Issued when the range state has changed.
|
||||
*/
|
||||
kIOHIDDigitizerEventRange = 0x00000001,
|
||||
/**
|
||||
* Issued when the touch state has changed.
|
||||
*/
|
||||
kIOHIDDigitizerEventTouch = 0x00000002,
|
||||
/**
|
||||
* Issued when the position has changed.
|
||||
*/
|
||||
kIOHIDDigitizerEventPosition = 0x00000004,
|
||||
} IOHIDDigitizerEventMask;
|
||||
|
||||
/**
|
||||
* Creates a digitizer event that sourced from a finger touching the screen.
|
||||
*/
|
||||
IOHIDEventRef IOHIDEventCreateDigitizerFingerEvent(CFAllocatorRef allocator,
|
||||
AbsoluteTime timeStamp,
|
||||
uint32_t index,
|
||||
uint32_t identity,
|
||||
IOHIDDigitizerEventMask eventMask,
|
||||
IOHIDFloat x,
|
||||
IOHIDFloat y,
|
||||
IOHIDFloat z,
|
||||
IOHIDFloat tipPressure,
|
||||
IOHIDFloat twist,
|
||||
Boolean range,
|
||||
Boolean touch,
|
||||
IOOptionBits options);
|
||||
|
||||
/**
|
||||
* Private class for representing internal touch events.
|
||||
* @see
|
||||
* https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/UIKit.framework/UIInternalEvent.h
|
||||
*/
|
||||
@interface UIInternalEvent : UIEvent
|
||||
/**
|
||||
* Sets HIDEvent property for the event.
|
||||
*
|
||||
* @param event The event for HIDEvent property.
|
||||
*/
|
||||
- (void)_setHIDEvent:(IOHIDEventRef)event;
|
||||
@end
|
||||
|
||||
/**
|
||||
* A private class that represents touch related events. This is sent to UIApplication whenever a
|
||||
* touch occurs.
|
||||
*/
|
||||
@interface UITouchesEvent : UIInternalEvent
|
||||
/**
|
||||
* Adds a @c touch to the event. It's unclear what @c delayedDelivery does.
|
||||
*
|
||||
* @param touch The touch object to be added.
|
||||
* @param delayedDelivery Unknown private API param.
|
||||
*/
|
||||
- (void)_addTouch:(UITouch *)touch forDelayedDelivery:(BOOL)delayedDelivery;
|
||||
|
||||
/**
|
||||
* Removes all touch objects from the event.
|
||||
*/
|
||||
- (void)_clearTouches;
|
||||
@end
|
||||
|
||||
/**
|
||||
* A private class that represents backboard services accelerometer.
|
||||
*/
|
||||
@interface BKSAccelerometer : NSObject
|
||||
/**
|
||||
* Enable or disable accelerometer events.
|
||||
*/
|
||||
@property(nonatomic) BOOL accelerometerEventsEnabled;
|
||||
@end
|
||||
|
||||
/**
|
||||
* A private class that represents motion related events. This is sent to UIApplication whenever a
|
||||
* motion occurs.
|
||||
*/
|
||||
@interface UIMotionEvent : NSObject {
|
||||
// The motion accelerometer of the event.
|
||||
BKSAccelerometer *_motionAccelerometer;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface UIApplication (GREYExposed)
|
||||
- (BOOL)_isSpringBoardShowingAnAlert;
|
||||
- (UIWindow *)statusBarWindow;
|
||||
/**
|
||||
* Changes the main runloop to run in the specified mode, pushing it to the top of the stack of
|
||||
* current modes.
|
||||
*/
|
||||
- (void)pushRunLoopMode:(NSString *)mode;
|
||||
/**
|
||||
* Changes the main runloop to run in the specified mode, pushing it to the top of the stack of
|
||||
* current modes.
|
||||
*/
|
||||
- (void)pushRunLoopMode:(NSString *)mode requester:(id)requester;
|
||||
/**
|
||||
* Pops topmost mode from the runloop mode stack.
|
||||
*/
|
||||
- (void)popRunLoopMode:(NSString *)mode;
|
||||
/**
|
||||
* Pops topmost mode from the runloop mode stack.
|
||||
*/
|
||||
- (void)popRunLoopMode:(NSString *)mode requester:(id)requester;
|
||||
/**
|
||||
* @return The shared UITouchesEvent object of the application, which is used to keep track of
|
||||
* UITouch objects, and the relevant touch interaction state.
|
||||
*/
|
||||
- (UITouchesEvent *)_touchesEvent;
|
||||
/**
|
||||
* @return The shared UIMotionEvent object of the application, used to force enable motion
|
||||
* accelerometer events.
|
||||
*/
|
||||
- (UIMotionEvent *)_motionEvent;
|
||||
|
||||
/**
|
||||
* Sends a motion began event for the specified subtype.
|
||||
*/
|
||||
- (void)_sendMotionBegan:(UIEventSubtype)subtype;
|
||||
|
||||
/**
|
||||
* Sends a motion ended event for the specified subtype.
|
||||
*/
|
||||
- (void)_sendMotionEnded:(UIEventSubtype)subtype;
|
||||
@end
|
||||
|
||||
@interface UIScrollView (GREYExposed)
|
||||
/**
|
||||
* Called when user finishes scrolling the content. @c deceleration is @c YES if scrolling movement
|
||||
* will continue, but decelerate, after user stopped dragging the content. If @c deceleration is
|
||||
* @c NO, scrolling stops immediately.
|
||||
*
|
||||
* @param deceleration Indicating if scrollview was experiencing deceleration.
|
||||
*/
|
||||
- (void)_scrollViewDidEndDraggingWithDeceleration:(BOOL)deceleration;
|
||||
|
||||
/**
|
||||
* Called when user is about to begin scrolling the content.
|
||||
*/
|
||||
- (void)_scrollViewWillBeginDragging;
|
||||
|
||||
/**
|
||||
* Called when scrolling of content has finished, if content continued scrolling with deceleration
|
||||
* after user stopped dragging it. @c notify determines whether UIScrollViewDelegate will be
|
||||
* notified that scrolling has finished.
|
||||
*
|
||||
* @param notify An indicator specifiying if scrolling has finished.
|
||||
*/
|
||||
- (void)_stopScrollDecelerationNotify:(BOOL)notify;
|
||||
@end
|
||||
|
||||
@interface UIDevice (GREYExposed)
|
||||
- (void)setOrientation:(UIDeviceOrientation)orientation animated:(BOOL)animated;
|
||||
@end
|
||||
|
||||
@interface UITouch (GREYExposed)
|
||||
/**
|
||||
* Sets flag marking this touch as the first touch for view.
|
||||
*
|
||||
* @param first A boolean to indicate if this is the first touch for the view.
|
||||
*/
|
||||
- (void)_setIsFirstTouchForView:(BOOL)first;
|
||||
|
||||
/**
|
||||
* Sets flag marking this touch as a tap.
|
||||
*
|
||||
* @param isTap A boolean to indicate that this is a tap.
|
||||
*/
|
||||
- (void)setIsTap:(BOOL)isTap;
|
||||
|
||||
/**
|
||||
* Sets location property to @c location. If @c reset is @c NO, the original value of location will
|
||||
* be stored in the UITouch's internal property @c previousLocation. If @c reset is @c YES, @c
|
||||
* location will be stored in @c previousLocation.
|
||||
*
|
||||
* @param location The new location relative to the touch's window.
|
||||
* @param reset An indicator to specify if @c previousLocation must be reset.
|
||||
*/
|
||||
- (void)_setLocationInWindow:(CGPoint)location resetPrevious:(BOOL)reset;
|
||||
|
||||
/**
|
||||
* Sets phase property and notifies phaseChangeDelegate.
|
||||
*
|
||||
* @param phase The new phase property.
|
||||
*/
|
||||
- (void)setPhase:(UITouchPhase)phase;
|
||||
|
||||
/**
|
||||
* Sets tapCount property.
|
||||
*
|
||||
* @param tapCount The new tap count.
|
||||
*/
|
||||
- (void)setTapCount:(NSUInteger)tapCount;
|
||||
|
||||
/**
|
||||
* Sets timestamp property.
|
||||
*
|
||||
* @param timestamp The new timestamp.
|
||||
*/
|
||||
- (void)setTimestamp:(NSTimeInterval)timestamp;
|
||||
|
||||
/**
|
||||
* Sets view property.
|
||||
*
|
||||
* @param view The new view property.
|
||||
*/
|
||||
- (void)setView:(UIView *)view;
|
||||
|
||||
/**
|
||||
* Sets window property and converts stored CGPoint structs to the the window's coordinate system.
|
||||
*
|
||||
* @param window The new window property.
|
||||
*/
|
||||
- (void)setWindow:(UIWindow *)window;
|
||||
|
||||
/**
|
||||
* Sets HIDEvent property for this touch.
|
||||
*
|
||||
* @param event The new HIDEvent property.
|
||||
*/
|
||||
- (void)_setHidEvent:(IOHIDEventRef)event;
|
||||
@end
|
||||
|
||||
@interface UIKeyboardTaskQueue
|
||||
/**
|
||||
* Completes all pending or ongoing tasks in the task queue before returning. Must be called from
|
||||
* the main thread.
|
||||
*/
|
||||
- (void)waitUntilAllTasksAreFinished;
|
||||
@end
|
||||
|
||||
@interface UIKeyboardImpl
|
||||
/**
|
||||
* @return Shared instance of UIKeyboardImpl. It may be different from the active instance.
|
||||
*/
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/**
|
||||
* @return The Active instance of UIKeyboardImpl, if one exists; otherwise returns @c nil. Active
|
||||
* instance could exist even if the keyboard is not shown on the screen.
|
||||
*/
|
||||
+ (instancetype)activeInstance;
|
||||
|
||||
/**
|
||||
* @return The current keyboard layout view, which contains accessibility elements for keyboard
|
||||
* keys that are shown on the keyboard.
|
||||
*/
|
||||
- (UIView *)_layout;
|
||||
|
||||
/**
|
||||
* @return The string shown on the return key on the keyboard.
|
||||
*/
|
||||
- (NSString *)returnKeyDisplayName;
|
||||
|
||||
/**
|
||||
* @return The task queue keyboard is using to manage asynchronous tasks.
|
||||
*/
|
||||
- (UIKeyboardTaskQueue *)taskQueue;
|
||||
|
||||
/**
|
||||
* Automatically hides the software keyboard if @c enabled is set to @c YES and hardware keyboard
|
||||
* is available. Setting @c enabled to @c NO will always show software keyboard. This setting is
|
||||
* global and applies to all instances of UIKeyboardImpl.
|
||||
*
|
||||
* @param enabled A boolean that indicates automatic minimization (hiding) of the keyboard.
|
||||
*/
|
||||
- (void)setAutomaticMinimizationEnabled:(BOOL)enabled;
|
||||
|
||||
/**
|
||||
* @return The delegate that the UIKeyboard is typing on.
|
||||
*/
|
||||
- (id)delegate;
|
||||
|
||||
/**
|
||||
* Sets the current UIKeyboard's delegate.
|
||||
*
|
||||
* @param delegate The element to set the UIKeyboard's delegate to.
|
||||
*/
|
||||
- (void)setDelegate:(id)delegate;
|
||||
/**
|
||||
* A method to hide the keyboard without resigning the first responder. This is used only
|
||||
* in iOS 8.1 where we found that turning off the autocorrection type on the first responder
|
||||
* using setAutomaticMinimizationEnabled: without toggling the keyboard caused keyboard touches
|
||||
* to be ignored.
|
||||
*/
|
||||
- (void)hideKeyboard;
|
||||
|
||||
/**
|
||||
* A method to show the keyboard without resigning the first responder. This is used only
|
||||
* in iOS 8.1 where we found that turning off the autocorrection type on the first responder
|
||||
* using setAutomaticMinimizationEnabled: without toggling the keyboard caused keyboard touches
|
||||
* to be ignored.
|
||||
*/
|
||||
- (void)showKeyboard;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Text Input preferences controller to modify the keyboard preferences for iOS 8+.
|
||||
*/
|
||||
@interface TIPreferencesController : NSObject
|
||||
|
||||
/** Whether the autocorrection is enabled. */
|
||||
@property BOOL autocorrectionEnabled;
|
||||
|
||||
/** Whether the predication is enabled. */
|
||||
@property BOOL predictionEnabled;
|
||||
|
||||
/** The shared singleton instance. */
|
||||
+ (instancetype)sharedPreferencesController;
|
||||
|
||||
/** Synchronize the change to save it on disk. */
|
||||
- (void)synchronizePreferences;
|
||||
|
||||
/** Modify the preference @c value by @c key. */
|
||||
- (void)setValue:(NSValue *)value forPreferenceKey:(NSString *)key;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Used for enabling accessibility on simulator and device.
|
||||
*/
|
||||
@interface AXBackBoardServer
|
||||
|
||||
/**
|
||||
* Returns backboard server instance.
|
||||
*/
|
||||
+ (id)server;
|
||||
|
||||
/**
|
||||
* Sets preference with @c key to @c value and raises @c notification.
|
||||
*/
|
||||
- (void)setAccessibilityPreferenceAsMobile:(CFStringRef)key
|
||||
value:(CFBooleanRef)value
|
||||
notification:(CFStringRef)notification;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Used for enabling accessibility on device.
|
||||
*/
|
||||
@interface XCAXClient_iOS
|
||||
|
||||
/**
|
||||
* Singleton shared instance when initialized will try to background the current process.
|
||||
*/
|
||||
+ (id)sharedClient;
|
||||
|
||||
/**
|
||||
* Programatically enable accessibility on both simulator and device.
|
||||
* Blocks until accessibility is fully loaded.
|
||||
*
|
||||
* @return ignored.
|
||||
*/
|
||||
- (bool)_loadAccessibility:(void **)unused;
|
||||
|
||||
@end
|
||||
|
||||
@interface UIAccessibilityTextFieldElement
|
||||
|
||||
/**
|
||||
* @return The UITextField that contains the accessibility text field element.
|
||||
*/
|
||||
-(UITextField *)textField;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYAssertions+Internal.h
|
||||
* @brief Exposes GREYAssertions' interfaces and methods that are otherwise private for
|
||||
* testing purposes.
|
||||
*/
|
||||
|
||||
#import <EarlGrey/GREYAssertions.h>
|
||||
|
||||
@class GREYError;
|
||||
@protocol GREYAssertion;
|
||||
@protocol GREYMatcher;
|
||||
|
||||
@interface GREYAssertions (Internal)
|
||||
|
||||
/**
|
||||
* Raise a @c GREYFrameworkException with the provided @c name, @c details and @c error.
|
||||
*
|
||||
* @param name The name of the exception.
|
||||
* @param details The details of the exception.
|
||||
* @param error The error that is the major reason of the exception.
|
||||
*
|
||||
* @remark This is available only for internal usage purposes.
|
||||
*/
|
||||
+ (void)grey_raiseExceptionNamed:(NSString *)name
|
||||
exceptionDetails:(NSString *)details
|
||||
withError:(GREYError *)error;
|
||||
|
||||
/**
|
||||
* Create a @c GREYAssertion with the provided @c matcher to check assertions on elements.
|
||||
*
|
||||
* @param matcher The @c GREYMatcher object to be matched by the assertion.
|
||||
*
|
||||
* @return A @c GREYAssertion object that can be used to match an object with the provided @c matcher.
|
||||
*
|
||||
* @remark This is available only for internal testing purposes.
|
||||
*/
|
||||
+ (id<GREYAssertion>)grey_createAssertionWithMatcher:(id<GREYMatcher>)matcher;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GREYCAAnimationDelegate : NSObject
|
||||
|
||||
/**
|
||||
* Wraps the passed in CAAnimationDelegate in a GREYSurrogateDelegate for helping in tracking
|
||||
* the delegate's animation start and stop events for better synchronization.
|
||||
*
|
||||
* @param delegate The CAAnimationDelegate animation delegate that is to be swizzled.
|
||||
*
|
||||
* @return An NSObject conforming to CAAnimationDelegate.
|
||||
*/
|
||||
+ (instancetype)surrogateDelegateForDelegate:(id)delegate;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use surrogateDelegateForDelegate.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
#pragma mark - CAAnimationDelegate
|
||||
|
||||
- (void)animationDidStart:(CAAnimation *)animation;
|
||||
- (void)animationDidStop:(CAAnimation *)animation finished:(BOOL)finished;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Actions for manipulating UIStepper.
|
||||
*/
|
||||
@interface GREYChangeStepperAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes with the expected value by which to change the stepper.
|
||||
*
|
||||
* @param value The amount by which the stepper should change.
|
||||
*
|
||||
* @return An instance of GREYChangeStepperAction.
|
||||
*/
|
||||
- (instancetype)initWithValue:(double)value NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A dispatch queue tracker for tracking dispatch queues.
|
||||
*
|
||||
* At most one tracker exists for each dispatch queue. The tracker will continue tracking the
|
||||
* dispatch queue until the tracker or the tracker's underlying queue has been deallocated.
|
||||
*/
|
||||
@interface GREYDispatchQueueTracker : NSObject
|
||||
|
||||
/**
|
||||
* Returns a tracker tracking @c queue. Creates a tracker only if one does not already exist.
|
||||
*
|
||||
* The tracked queue is held weakly so that it can be deallocated normally. The tracker will track
|
||||
* the busy state of "zombie" queues that have been released by all external references but still
|
||||
* have enqueued tasks that hold references to the queue.
|
||||
*
|
||||
* @param queue The queue that the returned tracker should be tracking.
|
||||
*
|
||||
* @return A tracker tracking @c queue.
|
||||
*/
|
||||
+ (instancetype)trackerForDispatchQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Check for the idle state of the tracked dispatch queue.
|
||||
*
|
||||
* The tracked dispatch queue is considered busy if a tracked operation has not yet completed.
|
||||
* @c dispatch_sync blocks and dispatch_sync_f tasks sent to @c queue are tracked.
|
||||
* @c dispatch_async blocks and @c dispatch_async_f tasks sent to @c queue are tracked.
|
||||
* @c dispatch_after blocks and @c dispatch_after_f tasks sent to @c queue are tracked if they are
|
||||
* delayed no more than the delay amount set for the
|
||||
* @c kGREYConfigKeyTrackableDispatchAfterDuration configuration.
|
||||
*
|
||||
* @return @c YES if the dispatch queue being tracked is idle, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)isIdleNow;
|
||||
|
||||
/**
|
||||
* Check if the tracked queue still has external references.
|
||||
*
|
||||
* After all external references to a queue have been dropped, asynchronous tasks on the dispatch
|
||||
* queue will still complete and the tracker will still report that it is busy until those tasks
|
||||
* have completed. When the queue is only kept active by enqueued blocks, it is considered to be a
|
||||
* zombie queue and not a live queue.
|
||||
*
|
||||
* @return @c YES if the dispatch queue being tracked no longer has external references, @c NO
|
||||
* otherwise.
|
||||
*/
|
||||
- (BOOL)isTrackingALiveQueue;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYElementInteraction+Internal.h
|
||||
* @brief Exposes GREYElementInteraction's interfaces and methods that are otherwise private for
|
||||
* testing purposes.
|
||||
*/
|
||||
|
||||
#import <EarlGrey/GREYElementInteraction.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GREYElementInteraction (Internal)
|
||||
|
||||
/**
|
||||
* Searches for UI elements within the root views and returns all matched UI elements. The given
|
||||
* search action is performed until an element is found.
|
||||
*
|
||||
* @param timeout The amount of time during which search actions must be performed to find an
|
||||
* element.
|
||||
* @param error The error populated on failure. If an element was found and returned when using
|
||||
* the search actions then any action or timeout errors that happened in the
|
||||
* previous search are ignored. However, if an element is not found, the error
|
||||
* will be propagated.
|
||||
*
|
||||
* @return An array of matched UI elements in the data source. If no UI element is found in
|
||||
* @c timeout seconds, a timeout error will be produced and no UI element will be returned.
|
||||
*
|
||||
* @remark This is available only for internal testing purposes.
|
||||
*/
|
||||
- (NSArray *)matchedElementsWithTimeout:(NSTimeInterval)timeout error:(__strong NSError **)error;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYProvider.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A provider for UI elements.
|
||||
*/
|
||||
@interface GREYElementProvider : NSObject<GREYProvider>
|
||||
|
||||
/**
|
||||
* Class method to initialize this provider with the specified @c elements.
|
||||
*
|
||||
* @param elements An array of elements that the provider is populated with.
|
||||
*
|
||||
* @return An instance of GREYElementProvider populated with @c elements.
|
||||
*/
|
||||
+ (instancetype)providerWithElements:(NSArray *)elements;
|
||||
|
||||
/**
|
||||
* Class method to initialize this provider with the specified @c rootElements.
|
||||
*
|
||||
* @param rootElements An array of root elements whose entire hierarchy will populate the provider.
|
||||
*
|
||||
* @return An instance of GREYElementProvider with root elements set to @c rootElements.
|
||||
*/
|
||||
+ (instancetype)providerWithRootElements:(NSArray *)rootElements;
|
||||
|
||||
/**
|
||||
* Class method to initialize this provider with the specified @c rootProvider.
|
||||
*
|
||||
* @param rootProvider A provider for root elements. The root elements and their entire hierarchy
|
||||
* will populate the current provider.
|
||||
*
|
||||
* @return An instance of GREYElementProvider with root elements set root elements in the root
|
||||
* provider and their entire hierarchy.
|
||||
*/
|
||||
+ (instancetype)providerWithRootProvider:(id<GREYProvider>)rootProvider;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes this provider with the specified @c elements.
|
||||
*
|
||||
* @param elements Elements to populate the provider with.
|
||||
*
|
||||
* @return An instance of GREYElementProvider populated with @c elements.
|
||||
*/
|
||||
- (instancetype)initWithElements:(NSArray *)elements;
|
||||
|
||||
/**
|
||||
* Initializes this provider with the specified @c rootElements.
|
||||
*
|
||||
* @param rootElements An array of root elements whose entire hierarchy will populate the provider.
|
||||
*
|
||||
* @return An instance of GREYElementProvider with root elements set to @c rootElements.
|
||||
*/
|
||||
- (instancetype)initWithRootElements:(NSArray *)rootElements;
|
||||
|
||||
/**
|
||||
* Initializes this provider with the specified @c rootProvider.
|
||||
*
|
||||
* @param rootProvider A provider for root elements. The root elements and their entire hierarchy
|
||||
* will populate the current provider.
|
||||
*
|
||||
* @return An instance of GREYElementProvider with root elements set root elements in the root
|
||||
* provider and their entire hierarchy.
|
||||
*/
|
||||
- (instancetype)initWithRootProvider:(id<GREYProvider>)rootProvider;
|
||||
|
||||
/**
|
||||
* Designated Initializer. Must provide exactly one @c non-nil parameter out of
|
||||
* all the accepted parameters.
|
||||
*
|
||||
* @param rootProvider A provider for root elements. The root elements and their entire hierarchy
|
||||
* will populate the current provider.
|
||||
* @param rootElements An array of root elements whose entire hierarchy will populate the provider.
|
||||
* @param elements An array of elements that will populate the provider.
|
||||
*
|
||||
* @return A GREYElementProviderInstance, initialized with at least one of the specified
|
||||
* parameters.
|
||||
*/
|
||||
- (instancetype)initWithRootProvider:(id<GREYProvider> _Nullable)rootProvider
|
||||
orRootElements:(NSArray *_Nullable)rootElements
|
||||
orElements:(NSArray *_Nullable)elements NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
#pragma mark - GREYProvider
|
||||
|
||||
/**
|
||||
* @return An enumerator for the elements in the provider.
|
||||
*/
|
||||
- (NSEnumerator *)dataEnumerator;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYError+Internal.h
|
||||
* @brief Exposes GREYError's interfaces and methods that are otherwise private for
|
||||
* testing purposes.
|
||||
*/
|
||||
|
||||
#import "Common/GREYError.h"
|
||||
|
||||
@class XCTestCase;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Key used to retrieve the error test case class name from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorTestCaseClassNameKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the test case method name from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorTestCaseMethodNameKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the file path from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorFilePathKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the file name from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorFileNameKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the line from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorLineKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the function name from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorFunctionNameKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the user info from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorUserInfoKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the error info from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorErrorInfoKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the bundle ID from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorBundleIDKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the stack trace from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorStackTraceKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the app UI hierarchy from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorAppUIHierarchyKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the app screenshots from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorAppScreenShotsKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the description glossary from an error object dictionary.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDescriptionGlossaryKey;
|
||||
|
||||
@interface GREYError (Internal)
|
||||
|
||||
@property(nonatomic) NSString *testCaseClassName;
|
||||
@property(nonatomic) NSString *testCaseMethodName;
|
||||
@property(nonatomic) NSString *filePath;
|
||||
@property(nonatomic) NSUInteger line;
|
||||
@property(nonatomic) NSString *functionName;
|
||||
@property(nonatomic) NSDictionary *errorInfo;
|
||||
@property(nonatomic) NSString *bundleID;
|
||||
@property(nonatomic) NSArray *stackTrace;
|
||||
@property(nonatomic) NSString *appUIHierarchy;
|
||||
@property(nonatomic) NSDictionary *appScreenshots;
|
||||
|
||||
- (instancetype)initWithDomain:(NSString *)domain
|
||||
code:(NSInteger)code
|
||||
userInfo:(NSDictionary *)dict
|
||||
testCase:(XCTestCase *)testCase;
|
||||
|
||||
+ (instancetype)errorWithDomain:(NSString *)domain
|
||||
code:(NSInteger)code
|
||||
userInfo:(NSDictionary *)dict
|
||||
testCase:(XCTestCase *)testCase;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
331
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/PrivateHeaders/GREYError.h
generated
Normal file
331
dev/integration_tests/ios_add2app/Pods/EarlGrey/EarlGrey/EarlGrey.framework/PrivateHeaders/GREYError.h
generated
Normal file
@@ -0,0 +1,331 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
@class GREYError;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Creates a @c GREYError object with given @c domain, @c code, @c description
|
||||
* The description is accessible by querying error's @c userInfo with
|
||||
* @c NSLocalizedDescriptionKey.
|
||||
*
|
||||
* @param domain The error domain.
|
||||
* @param code The error code.
|
||||
* @param description The error's localized description.
|
||||
*
|
||||
* @return A @c GREYError object with the given input.
|
||||
*/
|
||||
#define GREYErrorMake(domain, code, description) \
|
||||
I_GREYErrorMake((domain), \
|
||||
(code), \
|
||||
@{ NSLocalizedDescriptionKey : (description) }, \
|
||||
[NSString stringWithUTF8String:__FILE__], \
|
||||
__LINE__, \
|
||||
[NSString stringWithUTF8String:__PRETTY_FUNCTION__], \
|
||||
nil, \
|
||||
[NSThread callStackSymbols])
|
||||
|
||||
/**
|
||||
* Creates a @c GREYError object with given @c domain, @c code, @c description
|
||||
* and @c nestedError.
|
||||
* The description is accessible by querying error's @c userInfo with
|
||||
* @c NSLocalizedDescriptionKey. The @c nestedError is accessible by error's
|
||||
* @c userInfo with @c NSUnderlyingErrorKey.
|
||||
*
|
||||
* @param domain The error domain.
|
||||
* @param code The error code.
|
||||
* @param description The error's localized description.
|
||||
* @param nestedError An error to be nested in current error.
|
||||
*
|
||||
* @return A @c GREYError object with the given input.
|
||||
*/
|
||||
#define GREYNestedErrorMake(domain, code, description, nestedError) \
|
||||
I_GREYErrorMake((domain), \
|
||||
(code), \
|
||||
@{ NSLocalizedDescriptionKey : (description), \
|
||||
NSUnderlyingErrorKey : (nestedError) }, \
|
||||
[NSString stringWithUTF8String:__FILE__], \
|
||||
__LINE__, \
|
||||
[NSString stringWithUTF8String:__PRETTY_FUNCTION__], \
|
||||
nil, \
|
||||
[NSThread callStackSymbols])
|
||||
|
||||
/**
|
||||
* If @c errorRef is not @c NULL, it is set to a @c GREYError object that is created with
|
||||
* the given @c domain, @c code and @c description.
|
||||
* The description is accessible by querying error's @c userInfo with @c NSLocalizedDescriptionKey.
|
||||
* If @c errorRef is @c NULL, the error information is logged using NSLog.
|
||||
*
|
||||
* @param[out] errorRef A @c GREYError reference for retrieving the created
|
||||
* error object.
|
||||
* @param domain The error domain.
|
||||
* @param code The error code.
|
||||
* @param description The error's localized description.
|
||||
*
|
||||
*/
|
||||
#define GREYPopulateErrorOrLog(errorRef, domain, code, description) \
|
||||
({ \
|
||||
GREYError *e = GREYErrorMake((domain), (code), (description)); \
|
||||
if(errorRef) { \
|
||||
*errorRef = e; \
|
||||
} else { \
|
||||
NSLog(@"%@", e); \
|
||||
} \
|
||||
})
|
||||
|
||||
/**
|
||||
* If @c errorRef is not @c NULL, it is set to a @c GREYError object that is created with
|
||||
* the given @c domain, @c code, @c description and @c glossary.
|
||||
* The description is accessible by querying error's @c userInfo with @c NSLocalizedDescriptionKey.
|
||||
* If @c errorRef is @c NULL, the error information is logged using NSLog.
|
||||
*
|
||||
* @param[out] errorRef A @c GREYError reference for retrieving the created
|
||||
* error object.
|
||||
* @param domain The error domain.
|
||||
* @param code The error code.
|
||||
* @param description The error's localized description.
|
||||
* @param glossary A glossary dictionary that is going to be populated with the error.
|
||||
*
|
||||
*/
|
||||
#define GREYPopulateErrorNotedOrLog(errorRef, domain, code, description, glossary) \
|
||||
({ \
|
||||
GREYError *e = GREYErrorMake((domain), (code), (description)); \
|
||||
e.descriptionGlossary = (glossary); \
|
||||
if(errorRef) { \
|
||||
*errorRef = e; \
|
||||
} else { \
|
||||
NSLog(@"%@", e); \
|
||||
} \
|
||||
})
|
||||
|
||||
/**
|
||||
* If @c errorRef is not @c NULL, it is set to a @c GREYError object that is created
|
||||
* with the given @c domain, @c code, @c description and @c nestedError.
|
||||
* The description is accessible by querying error's @c userInfo with
|
||||
* @c NSLocalizedDescriptionKey. The @c nestedError is accessible by error's
|
||||
* @c userInfo with @c NSUnderlyingErrorKey.
|
||||
* If @c errorRef is @c NULL, the error information is logged using NSLog.
|
||||
*
|
||||
* @param[out] errorRef A @c GREYError reference for retrieving the created
|
||||
* error object.
|
||||
* @param domain The error domain.
|
||||
* @param code The error code.
|
||||
* @param description The error's localized description.
|
||||
* @param nestedError An error to be nested in current error.
|
||||
*
|
||||
*/
|
||||
#define GREYPopulateNestedErrorOrLog(errorRef, domain, code, description, nestedError) \
|
||||
({ \
|
||||
GREYError *e = GREYNestedErrorMake((domain), (code), (description), (nestedError)); \
|
||||
if(errorRef) { \
|
||||
*errorRef = e; \
|
||||
} else { \
|
||||
NSLog(@"%@", e); \
|
||||
} \
|
||||
})
|
||||
|
||||
/**
|
||||
* Creates a @c GREYError object with given @c domain, @c code, @c userInfo,
|
||||
* @c filePath, @c line, @c functionName, @c errorInfo and @c stackTrace.
|
||||
*
|
||||
* @param domain The error domain.
|
||||
* @param code The error code.
|
||||
* @param userInfo The user information that should be included
|
||||
* in the @c GREYError object.
|
||||
* @param filePath The file path where the error is generated.
|
||||
* @param line The file line where the error is generated.
|
||||
* @param functionName The function name where the error is generated.
|
||||
* @param errorInfo A dictionary containing details about the error.
|
||||
* @param stackTrace The stack trace for the app when the error is generated.
|
||||
*
|
||||
* @return A @c GREYError object with the given input.
|
||||
*/
|
||||
GREY_EXTERN GREYError *I_GREYErrorMake(NSString *domain,
|
||||
NSInteger code,
|
||||
NSDictionary *_Nullable userInfo,
|
||||
NSString *filePath,
|
||||
NSUInteger line,
|
||||
NSString *functionName,
|
||||
NSDictionary *_Nullable errorInfo,
|
||||
NSArray *stackTrace);
|
||||
|
||||
/**
|
||||
* The string for a generic error in EarlGrey.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYGenericErrorDomain;
|
||||
|
||||
/**
|
||||
* The code for a generic error in EarlGrey.
|
||||
*/
|
||||
GREY_EXTERN NSInteger const kGREYGenericErrorCode;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the failure name from an error object for a failed action.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDetailFailureNameKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the action name from an error object for a failed action.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDetailActionNameKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the assert criteria from an error object for a failed assertion.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDetailAssertCriteriaKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the detailed recovery suggestion from an error object.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDetailRecoverySuggestionKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the error domain from an error object.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDomainKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the error code from an error object.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorCodeKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the error description from an error object.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDescriptionKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the failure reason from an error object.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorFailureReasonKey;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the screenshot at failure from an error object's app screenshots.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kScreenshotAtFailure;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the visibility checker's most recent screenshot before failure
|
||||
* from an error object's app screenshots.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kScreenshotBeforeImage;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the expected visibility checker's most recent screenshot after failure
|
||||
* from an error object's app screenshots.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kScreenshotExpectedAfterImage;
|
||||
|
||||
/**
|
||||
* Key used to retrieve the actual visibility checker's most recent screenshot after failure
|
||||
* from an error object's app screenshots.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kScreenshotActualAfterImage;
|
||||
|
||||
/**
|
||||
* The error class for the error objects generated by EarlGrey.
|
||||
*/
|
||||
@interface GREYError : NSError
|
||||
|
||||
/**
|
||||
* The name of the test case class where the error is generated.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *testCaseClassName;
|
||||
|
||||
/**
|
||||
* The name of the test case method where the error is generated.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *testCaseMethodName;
|
||||
|
||||
/**
|
||||
* The source code file path where the error is generated.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *filePath;
|
||||
|
||||
/**
|
||||
* The source code line number where the error is generated.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSUInteger line;
|
||||
|
||||
/**
|
||||
* The source code function name where the error is generated.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *functionName;
|
||||
|
||||
/**
|
||||
* The error information dictionary that is associated with the error.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSDictionary *errorInfo;
|
||||
|
||||
/**
|
||||
* The bundle identifier where the error is generated in.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *bundleID;
|
||||
|
||||
/**
|
||||
* The stack trace when the error is generated.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSArray *stackTrace;
|
||||
|
||||
/**
|
||||
* The window hierarchy when the error is generated.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSString *appUIHierarchy;
|
||||
|
||||
/**
|
||||
* The screenshots for tha app when the error is generated;
|
||||
*/
|
||||
@property(nonatomic, readonly) NSDictionary *appScreenshots;
|
||||
|
||||
/**
|
||||
* Nested error within current error.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSError *nestedError;
|
||||
|
||||
/**
|
||||
* The description glossary dictionary that is associated with the error.
|
||||
*/
|
||||
@property(nonatomic) NSDictionary *descriptionGlossary;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* For a given @c error, creates an array of error dictionaries with its nested error.
|
||||
*
|
||||
* @return An array of error dictionaries for the given @c error.
|
||||
* If the given error does not contain nested error, an empty array will be returned.
|
||||
*/
|
||||
+ (NSArray *)grey_nestedErrorDictionariesForError:(NSError *)error;
|
||||
|
||||
/**
|
||||
* For a given @c error, creates a JSON-formatted description of the error and its nested error.
|
||||
*
|
||||
* @return The description of the error including its nested errors,
|
||||
* if error object was created and set. Otherwise, return @c NULL.
|
||||
*/
|
||||
+ (NSString *)grey_nestedDescriptionForError:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// Copyright 2017 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
/**
|
||||
* Extern variables specifying the error keys for a base action.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDetailElementDescriptionKey;
|
||||
GREY_EXTERN NSString *const kErrorDetailConstraintRequirementKey;
|
||||
GREY_EXTERN NSString *const kErrorDetailConstraintDetailsKey;
|
||||
|
||||
/**
|
||||
* Extern variables specifying the error domain for GREYElementInteraction.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYInteractionErrorDomain;
|
||||
GREY_EXTERN NSString *const kGREYWillPerformActionNotification;
|
||||
GREY_EXTERN NSString *const kGREYDidPerformActionNotification;
|
||||
GREY_EXTERN NSString *const kGREYWillPerformAssertionNotification;
|
||||
GREY_EXTERN NSString *const kGREYDidPerformAssertionNotification;
|
||||
|
||||
/**
|
||||
* Extern variables specifying the user info keys for any notifications.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYActionUserInfoKey;
|
||||
GREY_EXTERN NSString *const kGREYActionElementUserInfoKey;
|
||||
GREY_EXTERN NSString *const kGREYActionErrorUserInfoKey;
|
||||
GREY_EXTERN NSString *const kGREYAssertionUserInfoKey;
|
||||
GREY_EXTERN NSString *const kGREYAssertionElementUserInfoKey;
|
||||
GREY_EXTERN NSString *const kGREYAssertionErrorUserInfoKey;
|
||||
|
||||
/**
|
||||
* Internal variables specifying the detail keys for error details.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDetailElementMatcherKey;
|
||||
|
||||
/**
|
||||
* The error domain for pinch action related errors.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYPinchErrorDomain;
|
||||
|
||||
/**
|
||||
* Extern variables specifying the user info keys for a pinch action.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDetailElementKey;
|
||||
GREY_EXTERN NSString *const kErrorDetailWindowKey;
|
||||
|
||||
/**
|
||||
* Extern variables specifying the error keys for a change stepper action.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kErrorDetailStepperKey;
|
||||
GREY_EXTERN NSString *const kErrorDetailUserValueKey;
|
||||
GREY_EXTERN NSString *const kErrorDetailStepMaxValueKey;
|
||||
GREY_EXTERN NSString *const kErrorDetailStepMinValueKey;
|
||||
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
@class GREYError;
|
||||
@class XCTestCase;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Class to help formatting error objects for logging purposes.
|
||||
*/
|
||||
@interface GREYFailureFormatter : NSObject
|
||||
|
||||
/**
|
||||
* Format a given error object to a string for logging.
|
||||
* The formatted failure message will follow this order:
|
||||
*
|
||||
* FailureLabel: FailureName
|
||||
* Source File
|
||||
* Source Line
|
||||
* Bundle ID
|
||||
* Stack Trace
|
||||
* Screenshot
|
||||
* Window Hierarchy
|
||||
*
|
||||
* @param error The error object to be formatted.
|
||||
* @param excluding An array to exclude parts of the error from the output.
|
||||
* The key
|
||||
* @param failureLabel The label to be associated with the error.
|
||||
* @param failureName The name to be associated with the error.
|
||||
* @param format Extra message to be included in the message.
|
||||
*
|
||||
* @return Formatted error message string.
|
||||
*/
|
||||
+ (NSString *)formatFailureForError:(GREYError *)error
|
||||
excluding:(NSArray *_Nullable)excluding
|
||||
failureLabel:(NSString *)failureLabel
|
||||
failureName:(NSString *)failureName
|
||||
format:(NSString *)format, ... NS_FORMAT_FUNCTION(5, 6);
|
||||
/**
|
||||
* Format a failure happened in a given test case for logging.
|
||||
*
|
||||
* The formatted failure message will follow this order:
|
||||
*
|
||||
* FailureLabel: FailureName
|
||||
* Source File
|
||||
* Source Line
|
||||
* Bundle ID
|
||||
* Stack Trace
|
||||
* Screenshot
|
||||
* Window Hierarchy
|
||||
*
|
||||
* @param testCase The test case where the failure happens.
|
||||
* @param failureLabel The label to be associated with the error.
|
||||
* @param failureName The name to be associated with the error.
|
||||
* @param functionName The name of the function where the error is generated.
|
||||
* @param filePath The path to the source code file where the error happens.
|
||||
* @param lineNumber The line number of the source code file when the error happens.
|
||||
* @param stackTrace The stack trace of the executable when the error happens.
|
||||
* @param appScreenshots The dictionary of app screenshot names and image paths
|
||||
* when the error happens.
|
||||
* @param format Extra message to be included in the message.
|
||||
*
|
||||
* @return Formatted error message string.
|
||||
*/
|
||||
+ (NSString *)formatFailureForTestCase:(XCTestCase *)testCase
|
||||
failureLabel:(NSString *)failureLabel
|
||||
failureName:(NSString *)failureName
|
||||
filePath:(NSString *)filePath
|
||||
lineNumber:(NSUInteger)lineNumber
|
||||
functionName:(NSString *_Nullable)functionName
|
||||
stackTrace:(NSArray *)stackTrace
|
||||
appScreenshots:(NSDictionary *)appScreenshots
|
||||
format:(NSString *)format, ... NS_FORMAT_FUNCTION(9, 10);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GREYFailureScreenshotter : NSObject
|
||||
|
||||
/**
|
||||
* Generate app screenshot with given prefix and failure name.
|
||||
*
|
||||
* @param screenshotPrefix Prefix for the screenshots.
|
||||
* @param failureName Failure name associated with the screenshots.
|
||||
*
|
||||
* @return A dictionary of the screenshot names and their corresponding paths.
|
||||
*/
|
||||
|
||||
+ (NSDictionary *)generateAppScreenshotsWithPrefix:(NSString *_Nullable)screenshotPrefix
|
||||
failure:(NSString *)failureName;
|
||||
|
||||
/**
|
||||
* Generate app screenshot with given prefix and failure name.
|
||||
*
|
||||
* @param screenshotPrefix Prefix for the screenshots.
|
||||
* @param failureName Failure name associated with the screenshots.
|
||||
* @param screenshotDir The screenshot directory where the screenshots are placed.
|
||||
*
|
||||
* @return A dictionary of the screenshot names and their corresponding paths.
|
||||
*/
|
||||
+ (NSDictionary *)generateAppScreenshotsWithPrefix:(NSString *_Nullable)screenshotPrefix
|
||||
failure:(NSString *)failureName
|
||||
screenshotDir:(NSString *)screenshotDir;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
@protocol GREYProvider;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Provides data to a GREYInteraction.
|
||||
*/
|
||||
@protocol GREYInteractionDataSource<NSObject>
|
||||
|
||||
/**
|
||||
* The root element provider for an interaction. The entire hierarchies starting from the root
|
||||
* elements are searched to find the right element to interact with.
|
||||
*
|
||||
* @return A GREYProvider instance providing data for the interaction.
|
||||
*/
|
||||
- (id<GREYProvider>)rootElementProvider;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Provides ability to perform input actions using the iOS system keyboard and also track the
|
||||
* current keyboard visibility.
|
||||
*/
|
||||
@interface GREYKeyboard : NSObject
|
||||
|
||||
/**
|
||||
* Types @c string using the keyboard in the provided @c firstResponder. Keyboard must be shown
|
||||
* on the screen when this method is called.
|
||||
*
|
||||
* @param string Text to be typed using the keyboard.
|
||||
* @param firstResponder The element that the text is to be typed in.
|
||||
* @param[out] errorOrNil Error populated when any failure occurs during typing. If @c nil, then a
|
||||
* custom error with @c kGREYInteractionActionFailedErrorCode is logged.
|
||||
*
|
||||
* @return @c YES if typing succeeded, @c NO otherwise.
|
||||
*/
|
||||
+ (BOOL)typeString:(NSString *)string
|
||||
inFirstResponder:(id)firstResponder
|
||||
error:(__strong NSError **)errorOrNil;
|
||||
|
||||
/**
|
||||
* Waits until the keyboard is visible on the screen.
|
||||
* @return @c YES if the keyboard did appear after the wait, @c NO otherwise.
|
||||
*/
|
||||
+ (BOOL)waitForKeyboardToAppear;
|
||||
|
||||
/**
|
||||
* @return @c YES if the keyboard is present on the screen, @c NO otherwise.
|
||||
*/
|
||||
+ (BOOL)isKeyboardShown;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYLogger.h
|
||||
* @brief Macro for printing more logs for aiding in debugging.
|
||||
*/
|
||||
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
/**
|
||||
* Prints a log statement if @c kGREYAllowVerboseLogging is present and turned to @c YES in
|
||||
* @c NSUserDefaults. You can pass it in the command line arguments as:
|
||||
* To turn on, set @c kGREYAllowVerboseLogging key in @c NSUserDefaults to @c YES.
|
||||
* @code
|
||||
* [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kGREYAllowVerboseLogging];
|
||||
* @endcode
|
||||
*
|
||||
* @remark Once you set this, as with any @c NSUserDefault, you need to explicitly turn it off
|
||||
* or delete and re-install the app under test.
|
||||
*
|
||||
* @param format The string format to be printed.
|
||||
* @param ... The parameters to be added to the string format.
|
||||
*/
|
||||
#define GREYLogVerbose(format, ...) \
|
||||
({ \
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:kGREYAllowVerboseLogging]) { \
|
||||
NSLog((format), ##__VA_ARGS__); \
|
||||
} \
|
||||
})
|
||||
|
||||
|
||||
/**
|
||||
* Log an error generated by the system or EarlGrey to the console.
|
||||
*
|
||||
* @param error An error object to be logged. This can be an @c NSError object or
|
||||
* a @c GREYError object.
|
||||
*
|
||||
*/
|
||||
#define GREYLogError(error) \
|
||||
({ \
|
||||
I_GREYLogError(error, \
|
||||
[NSString stringWithUTF8String:__FILE__], \
|
||||
__LINE__, \
|
||||
[NSString stringWithUTF8String:__PRETTY_FUNCTION__], \
|
||||
[NSThread callStackSymbols]); \
|
||||
})
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Log an error generated by the system or EarlGrey to the console.
|
||||
*/
|
||||
GREY_EXPORT void I_GREYLogError(NSError *error,
|
||||
NSString *filePath,
|
||||
NSUInteger lineNumber,
|
||||
NSString *functionName,
|
||||
NSArray *stackTrace);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// Copyright 2017 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A GREYAction that swipes/flicks with multiple touches
|
||||
*/
|
||||
@interface GREYMultiFingerSwipeAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Performs a swipe with multiple parallel fingers in the given @c direction in the given
|
||||
* @c duration, the start of swipe is chosen to achieve maximum swipe, such as a point close to
|
||||
* bottom edge of the element is chosen in case of a swipe in up direction. Using this method will
|
||||
* infer a start percentage of x: 0.5, y: 0.5.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param duration The time interval for which the swipe takes place.
|
||||
* @param numberOfFingers The number of parallel fingers to use. Max value: 4.
|
||||
*
|
||||
* @return An instance of GREYMultiFingerSwipeAction, initialized with the provided direction,
|
||||
* duration and number of fingers to swipe with.
|
||||
*/
|
||||
- (instancetype)initWithDirection:(GREYDirection)direction
|
||||
duration:(CFTimeInterval)duration
|
||||
numberOfFingers:(NSUInteger)numberOfFingers;
|
||||
|
||||
/**
|
||||
* Performs a swipe with multiple parallel fingers in the given @c direction in the given
|
||||
* @c duration, the start of swipe is chosen based on @c startPercents. Since swipes must begin
|
||||
* inside the element and not on the edge of it x/y, startPercents must be in the range (0,1)
|
||||
* exclusive.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param duration The time interval for which the swipe takes place.
|
||||
* @param numberOfFingers The number of parallel fingers to use. Max Value: 4.
|
||||
* @param startPercents @c startPercents.x sets the value of the x-coordinate of the start point
|
||||
* by interpolating between left(for 0.0) and right(for 1.0) edge similarly
|
||||
* @c startPercents.y determines the y coordinate.
|
||||
*
|
||||
* @return An instance of GREYMultiFingerSwipeAction, initialized with the provided direction,
|
||||
* duration, information for the start point and number of fingers to swipe with.
|
||||
*/
|
||||
- (instancetype)initWithDirection:(GREYDirection)direction
|
||||
duration:(CFTimeInterval)duration
|
||||
numberOfFingers:(NSUInteger)numberOfFingers
|
||||
startPercents:(CGPoint)startPercents NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "Delegate/GREYSurrogateDelegate.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This is a proxy delegate for NSURLConnectionDelegate which allows us track status of
|
||||
* the connection.
|
||||
*
|
||||
* @todo Support NSURLConnectionDownloadDelegate.
|
||||
*/
|
||||
@interface GREYNSURLConnectionDelegate : GREYSurrogateDelegate
|
||||
<NSURLConnectionDelegate, NSURLConnectionDataDelegate>
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Creates an instance of GREYNSURLConnectionDelegate backed by the provided delegate.
|
||||
*
|
||||
* @param originalDelegate The original delegate being proxied.
|
||||
* @return an instance of GREYNSURLConnectionDelegate backed by the original delegate.
|
||||
*/
|
||||
- (instancetype)initWithOriginalNSURLConnectionDelegate:(id)originalDelegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Copyright 2017 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A utility class used for common runtime related operations.
|
||||
*/
|
||||
@interface GREYObjcRuntime : NSObject
|
||||
|
||||
/**
|
||||
* Adds the given method from the given class into the destination class.
|
||||
*
|
||||
* @param destination The destination class.
|
||||
* @param selector The method selector from source class that needs to be added to destination.
|
||||
* @param source The source class for the method to be added.
|
||||
*/
|
||||
+ (void)addInstanceMethodToClass:(Class)destination
|
||||
withSelector:(SEL)selector
|
||||
fromClass:(Class)source;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Copyright 2017 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class GREYObjectDeallocationTracker;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol GREYObjectDeallocationTrackerDelegate <NSObject>
|
||||
|
||||
/**
|
||||
* Delegate method that is called when the GREYObjectDeallocationTracker is deallocated.
|
||||
*
|
||||
* @param objectDeallocationTracker The GREYObjectDeallocationTracker instance that is being
|
||||
* deallocated.
|
||||
*/
|
||||
-(void)objectTrackerDidDeallocate:(GREYObjectDeallocationTracker *)objectDeallocationTracker;
|
||||
|
||||
@end
|
||||
|
||||
@interface GREYObjectDeallocationTracker : NSObject
|
||||
|
||||
/**
|
||||
* Initialize the GREYObjectDeallocationTracker with a delegate object.
|
||||
*
|
||||
* @param object The object that should be tracked by the GREYObjectDeallocationTracker.
|
||||
* @param delegate The object that conforms to the GREYObjectDeallocationTrackerDelegate protocol
|
||||
* and wants to receive the delegate callback.
|
||||
*/
|
||||
- (instancetype)initWithObject:(id)object
|
||||
delegate:(id<GREYObjectDeallocationTrackerDelegate> _Nullable)delegate;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializer.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Finds the GREYObjectDeallocationTracker associated with the @c object if one exists. Call this
|
||||
* method if the @c object is already being tracked by an instance of
|
||||
* GREYObjectDeallocationTracker.
|
||||
*
|
||||
* @param object The object that the GREYObjectDeallocationTracker is tracking.
|
||||
*
|
||||
* @return An instance of GREYObjectDeallocationTracker or nil if object's deallocation isn't
|
||||
* being tracked.
|
||||
*/
|
||||
+ (GREYObjectDeallocationTracker * _Nullable)deallocationTrackerRegisteredWithObject:(id)object;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
/**
|
||||
* Indent when perform object formation.
|
||||
*/
|
||||
GREY_EXTERN NSInteger const kGREYObjectFormatIndent;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GREYObjectFormatter : NSObject
|
||||
|
||||
/**
|
||||
* Serializes an array of objects into JSON string.
|
||||
* The supported objects are: NSString, NSNumber, NSArray, NSDictionary and GREYError.
|
||||
*
|
||||
* @param array The array to serialize.
|
||||
* @param indent The spaces that will be applied to each element of the serialized array.
|
||||
* @param keyOrder Output the key-value pair in the order of the keys specified
|
||||
* in the keyOrder array.
|
||||
*
|
||||
* @return JSON-ified string of the provided @c array.
|
||||
*/
|
||||
+ (NSString *)formatArray:(NSArray *)array indent:(NSInteger)indent keyOrder:(NSArray *)keyOrder;
|
||||
|
||||
/**
|
||||
* Serializes a dictionary of objects into JSON string.
|
||||
* The supported objects are: NSString, NSNumber, NSArray, NSDictionary and GREYError.
|
||||
*
|
||||
* @param dictionary The dictionary to serialize.
|
||||
* @param indent Number of spaces that will be applied to each element
|
||||
* of the serialized dictionary.
|
||||
* @param hideEmpty Hide the key-value pair if the value in the dictionary
|
||||
* when the key is empty.
|
||||
* @param keyOrder Output the key-value pair in the order of the keys specified
|
||||
* in the keyOrder array.
|
||||
*
|
||||
* @return JSON-ified string of the provided @c dictionary.
|
||||
*/
|
||||
+ (NSString *)formatDictionary:(NSDictionary *)dictionary
|
||||
indent:(NSInteger)indent
|
||||
hideEmpty:(BOOL)hideEmpty
|
||||
keyOrder:(NSArray *_Nullable)keyOrder;
|
||||
|
||||
/**
|
||||
* Serializes an array of objects into JSON-like string.
|
||||
* The supported objects are: NSString, NSNumber, NSArray, NSDictionary.
|
||||
*
|
||||
* @remark The serialized string is formatted as a JSON for presentation purposes but it doesn't
|
||||
* have the right escaping applied for special character as it hinders readability.
|
||||
*
|
||||
* @param array The array to serialize.
|
||||
* @param prefix A string that will be applied to each newline of the serialized array.
|
||||
* @param indent The spaces that will be applied to each element of the serialized array.
|
||||
* @param keyOrder Output the key-value pair in the order of the keys specified
|
||||
* in the keyOrder array.
|
||||
* @return Serialized JSON-like string of the provided @c array.
|
||||
*/
|
||||
+ (NSString *)formatArray:(NSArray *)array
|
||||
prefix:(NSString *_Nullable)prefix
|
||||
indent:(NSInteger)indent
|
||||
keyOrder:(NSArray *_Nullable)keyOrder;
|
||||
|
||||
/**
|
||||
* Serializes a dictionary of objects into JSON-like string.
|
||||
* The supported objects are: NSString, NSNumber, NSArray, NSDictionary.
|
||||
*
|
||||
* @remark The serialized string is formatted as a JSON for presentation purposes but it doesn't
|
||||
* have the right escaping applied for special character as it hinders readability.
|
||||
*
|
||||
* @param dictionary The dictionary to serialize.
|
||||
* @param prefix A string that will be applied to each newline
|
||||
* of the serialized dictionary.
|
||||
* @param indent Number of spaces that will be applied to each element (key and value)
|
||||
* of the serialized dictionary
|
||||
* @param hideEmpty Hide the key-value pair if the value in the dictionary
|
||||
* when the key is empty.
|
||||
* @param keyOrder Output the key-value pair in the order of the keys specified
|
||||
* in the keyOrder array.
|
||||
*
|
||||
* @return Serialized string of the provided @c dictionary.
|
||||
*/
|
||||
+ (NSString *)formatDictionary:(NSDictionary *)dictionary
|
||||
prefix:(NSString *_Nullable)prefix
|
||||
indent:(NSInteger)indent
|
||||
hideEmpty:(BOOL)hideEmpty
|
||||
keyOrder:(NSArray *_Nullable)keyOrder;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A utility class for creating and injecting gestures that involve touch paths, for example:
|
||||
* swipe, scroll etc.
|
||||
*/
|
||||
@interface GREYPathGestureUtils : NSObject
|
||||
|
||||
/**
|
||||
* Generates a touch path in the @c window from the start point, in the given direction to the
|
||||
* max possible extent.
|
||||
*
|
||||
* @param startPointInWindowCoordinates The start point within the given @c window
|
||||
* @param direction The direction of the touch path.
|
||||
* @param duration How long the gesture should last (in seconds).
|
||||
* @param window The window in which the touch path is generated.
|
||||
*
|
||||
* @return NSArray of CGPoints that denote the points in the touch path.
|
||||
*/
|
||||
+ (NSArray *)touchPathForGestureWithStartPoint:(CGPoint)startPointInWindowCoordinates
|
||||
andDirection:(GREYDirection)direction
|
||||
andDuration:(CFTimeInterval)duration
|
||||
inWindow:(UIWindow *)window;
|
||||
|
||||
/**
|
||||
* Generates a touch path in the @c window starting from a given @c view in a particular direction
|
||||
* for a certain amount in the window coordinates of the @c view. The start point of the path is
|
||||
* controlled by @c startPointPercents, which if specified as @c NAN, the start point will be
|
||||
* chosen to provide longest possible touch path, otherwise start point will be set to the percents
|
||||
* specified in the visible area of the given @c view. Note that the percent values must lie within
|
||||
* (0, 1) exclusive and the x and y axis are always the bottom and the left edge respectively of
|
||||
* the visible rect.
|
||||
*
|
||||
* @param view The view from which the touch path originates.
|
||||
* @param direction The direction of the touch.
|
||||
* @param length The length of the touch path. The length of the touch path
|
||||
* is restricted by the screen dimensions, position of the
|
||||
* view and the minimum scroll detection length (10 points as
|
||||
* of iOS 8.0).
|
||||
* @param startPointPercents The start point of the touch path specified as percents in
|
||||
* the visible area of the @c view. Must be (0, 1) exclusive.
|
||||
* @param[out] outRemainingAmountOrNull The difference of the length and the amount,
|
||||
* if the length falls short.
|
||||
*
|
||||
* @return Array of CGPoints that denote the points in the touch path. The touch path's length
|
||||
* will be at least the minimum scroll detection length, when that is not possible
|
||||
* (due to @c view position and/or size) @c nil is returned.
|
||||
*/
|
||||
+ (NSArray *)touchPathForGestureInView:(UIView *)view
|
||||
withDirection:(GREYDirection)direction
|
||||
length:(CGFloat)length
|
||||
startPointPercents:(CGPoint)startPointPercents
|
||||
outRemainingAmount:(CGFloat *_Nullable)outRemainingAmountOrNull;
|
||||
|
||||
/**
|
||||
* Generates a touch path in the @c window from the given @c startPoint and the given @c
|
||||
* endPoint.
|
||||
*
|
||||
* @param startPoint The starting point for touch path.
|
||||
* @param endPoint The end point for touch path.
|
||||
* @param cancelInertia A boolean value indicating whether intertial movement should be cancelled.
|
||||
*
|
||||
* @return NSArray of CGPoints that denote the points in the touch path.
|
||||
*/
|
||||
+ (NSArray *)touchPathForDragGestureWithStartPoint:(CGPoint)startPoint
|
||||
endPoint:(CGPoint)endPoint
|
||||
cancelInertia:(BOOL)cancelInertia;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Actions for manipulating a UIPickerView.
|
||||
*/
|
||||
@interface GREYPickerAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Selects a value in a given column of a UIPickerView.
|
||||
*
|
||||
* @param column Column of the UIPickerView to change.
|
||||
* @param value The value to set in the UIPickerView column.
|
||||
*
|
||||
* @return An instance of UIPickerAction, initialized with the @c column and @c value.
|
||||
*/
|
||||
- (instancetype)initWithColumn:(NSInteger)column value:(NSString *)value NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Error domain used for pinch related NSError objects.
|
||||
*/
|
||||
GREY_EXTERN NSString *const kGREYPinchErrorDomain;
|
||||
|
||||
/**
|
||||
* Error codes for pinch related failures.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYPinchErrorCode) {
|
||||
kGREYPinchFailedErrorCode = 0,
|
||||
};
|
||||
|
||||
/**
|
||||
* A @c GREYAction that performs the pinch gesture on the view on which it is called.
|
||||
*/
|
||||
@interface GREYPinchAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* Performs a pinch action in the given @c direction for the @c duration. The start of outward
|
||||
* pinch is from the center of the view and stops before 20% margin of the view's bounding rect.
|
||||
*
|
||||
* For an inward pinch the start point is at a 20% margin of the view's bounding rect on either
|
||||
* side and stops at the center. The default angle of the pinch action is 30 degrees to closely
|
||||
* match the average pinch angle of a natural right handed pinch.
|
||||
*
|
||||
* @param direction The direction of the pinch.
|
||||
* @param duration The time interval for which the pinch takes place.
|
||||
* @param pinchAngle Angle of the vector in radians to which the pinch direction is pointing.
|
||||
*
|
||||
* @returns An instance of @c GREYPinchAction, initialized with a provided direction and
|
||||
* duration and angle.
|
||||
*/
|
||||
- (instancetype)initWithDirection:(GREYPinchDirection)direction
|
||||
duration:(CFTimeInterval)duration
|
||||
pinchAngle:(double)pinchAngle;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* @brief Handles spinning the current run loop in the active mode with various configurations.
|
||||
* Similar to dispatch_sync calls on a thread, you cannot make nested spin calls to the same
|
||||
* spinner object, but it is OK to create and spin a separate spinner object within a
|
||||
* source/timer/block invoked by another spinner.
|
||||
*
|
||||
* The current run loop mode is the mode that a run loop is currently executing in. The active run
|
||||
* loop mode is (more or less) the mode that the run loop would be executing if we weren't
|
||||
* controlling the run loop's execution. Some events, like scrolling, will switch the current mode
|
||||
* under normal conditions but not while we are spinning the run loop. To make the app behave
|
||||
* closer to normal app conditions, the run loop spinner spins the run loop in the active mode not
|
||||
* the current mode.
|
||||
*
|
||||
* Draining (or doing a pass over) the run loop in a particular mode is running the run loop so
|
||||
* that it service all pending blocks, sources, or timers. Spinning the run loop means repeatedly
|
||||
* draining the run loop, possibly allowing the run loop to sleep between drains.
|
||||
*
|
||||
* While the run loop spinner is running the run loop in a particular mode, any source/timer/block
|
||||
* serviced by the run loop may itself start running the run loop in any mode of its choosing.
|
||||
* In that case, we consider run loop as not running in the mode that we started spinning, even
|
||||
* if the source/timer/block started running the run loop in the same mode (nesting the run loop
|
||||
* mode).
|
||||
*/
|
||||
@interface GREYRunLoopSpinner : NSObject
|
||||
|
||||
/**
|
||||
* The maximum time in seconds that the spinner will spin the run loop. Default is 0.
|
||||
*
|
||||
* The spinner will not initiate any run loop drains after @c timeout seconds, but it is possible
|
||||
* that an ongoing run loop drain will be executing after @c timeout. If @c timeout is 0, then the
|
||||
* spinner will only drain the run loop for its configured minimum number of run loop drains.
|
||||
*/
|
||||
@property(nonatomic) CFTimeInterval timeout;
|
||||
|
||||
/**
|
||||
* The maximum time in seconds that the current thread will be allowed to sleep while running in
|
||||
* the active mode that we started spinning. Default is 0.
|
||||
*
|
||||
* If set to 0, then the run loop will not be allowed to sleep in the active mode that it started
|
||||
* spinning.
|
||||
*
|
||||
* @remark Not allowing the run loop to sleep can be useful for some test scenarios but causes the
|
||||
* thread to use significantly more CPU.
|
||||
*/
|
||||
@property(nonatomic) CFTimeInterval maxSleepInterval;
|
||||
|
||||
/**
|
||||
* The minimum number of times that the run loop should be drained in the active mode before
|
||||
* checking the stop condition. Default is 2.
|
||||
*
|
||||
* @remark The default value is 2 because, as per the CFRunLoop implementation, some ports
|
||||
* (specifically the dispatch port) will only be serviced every other run loop drain.
|
||||
*/
|
||||
@property(nonatomic) NSUInteger minRunLoopDrains;
|
||||
|
||||
/**
|
||||
* This block is invoked in the active run loop mode if the stop condition evaluates to YES.
|
||||
* Default is a noop.
|
||||
*/
|
||||
@property(copy, nonatomic) void (^conditionMetHandler)(void);
|
||||
|
||||
/**
|
||||
* Spins the current thread's run loop in the active mode using the given stop condition.
|
||||
*
|
||||
* Will always spin the run loop for at least the minimum number of run loop drains. Will always
|
||||
* evaluate @c stopConditionBlock at least once after draining for minimum number of drains. After
|
||||
* draining for the minimum number of drains, the spinner will evaluate @c stopConditionBlock at
|
||||
* least once per run loop drain. The spinner will stop initiating drains and return if
|
||||
* @c stopConditionBlock evaluates to @c YES or if the timeout has elapsed.
|
||||
*
|
||||
* @remark This method should not be invoked on the same spinner object in nested calls (e.g.
|
||||
* sources that are serviced while it's spinning) or concurrently.
|
||||
*
|
||||
* @param stopConditionBlock The condition block used by the spinner to determine if it should
|
||||
* keep spinning the active run loop.
|
||||
*
|
||||
* @return @c YES if the spinner evaluated the @c stopConditionBlock to @c YES; @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)spinWithStopConditionBlock:(BOOL (^)(void))stopConditionBlock;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
/**
|
||||
* @file GREYScreenshotUtil+Internal.h
|
||||
* @brief Exposes GREYScreenshotUtil' interfaces and methods that are otherwise private
|
||||
* for testing purposes.
|
||||
*/
|
||||
|
||||
#import <EarlGrey/GREYScreenshotUtil.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GREYScreenshotUtil (Internal)
|
||||
|
||||
/**
|
||||
* Provides a UIImage that is a screenshot, immediately or after the screen updates as specified.
|
||||
*
|
||||
* @param afterScreenUpdates A Boolean specifying if the screenshot is to be taken immediately or
|
||||
* after a screen update.
|
||||
*
|
||||
* @return A UIImage containing a screenshot.
|
||||
*
|
||||
* @remark This is available only for internal testing purposes.
|
||||
*/
|
||||
+ (UIImage *)grey_takeScreenshotAfterScreenUpdates:(BOOL)afterScreenUpdates;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A GREYAction that implements the scroll action.
|
||||
*/
|
||||
@interface GREYScrollAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Creates a scroll action that scrolls the contents in the given @c direction for the
|
||||
* given @c amount.
|
||||
*
|
||||
* @param direction The direction of the scroll.
|
||||
* @param amount The amount specified in points. The units here are the same as the units
|
||||
* of the coordinate system of the element matched.
|
||||
*
|
||||
* @return An instance of GREYScrollAction, initialized with the provided
|
||||
* direction and scroll amount.
|
||||
*/
|
||||
- (instancetype)initWithDirection:(GREYDirection)direction amount:(CGFloat)amount;
|
||||
|
||||
/**
|
||||
* Creates a scroll action that scrolls the contents in the given @c direction for the
|
||||
* given @c amount with the start point specified by @c startPointPercents.
|
||||
*
|
||||
* @param direction The direction of the scroll.
|
||||
* @param amount The amount specified in points. The units here are the same as the
|
||||
* units of the coordinate system of the element matched.
|
||||
* @param startPointPercents The start point of the scroll specified as percents (0, 1) exclusive,
|
||||
* in the visible area of the scroll view or as @c NAN to pick a point
|
||||
* that provides maximum scroll length.
|
||||
*
|
||||
* @return An instance of GREYScrollAction, initialized with the provided
|
||||
* direction, scroll amount and start point.
|
||||
*/
|
||||
- (instancetype)initWithDirection:(GREYDirection)direction
|
||||
amount:(CGFloat)amount
|
||||
startPointPercents:(CGPoint)startPointPercents NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A GREYAction that implements a scroll action that scrolls the contents of the matched
|
||||
* UIScrollView to the given edge of its contents.
|
||||
*/
|
||||
@interface GREYScrollToContentEdgeAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Creates a scroll action that scrolls to the given @c edge of the contents in the selected
|
||||
* scroll view.
|
||||
*
|
||||
* @param edge The edge of the UIScrollView to scroll the contents.
|
||||
*
|
||||
* @return An instance of GREYScrollToContentEdgeAction, initialized with the provided @c edge.
|
||||
*/
|
||||
- (instancetype)initWithEdge:(GREYContentEdge)edge;
|
||||
|
||||
/**
|
||||
* Creates a scroll action that scrolls to the given @c edge of the contents in the selected
|
||||
* scroll view with the start point specified by @c startPointPercents.
|
||||
*
|
||||
* @param edge The edge of the UIScrollView to scroll the contents.
|
||||
* @param startPointPercents The start point of the scroll specified as percents (0, 1) exclusive,
|
||||
* in the visible area of the scroll view or as @c NAN to pick a point
|
||||
* that provides maximum scroll length.
|
||||
*
|
||||
* @return An instance of GREYScrollToContentEdgeAction, initialized with the provided @c edge.
|
||||
*/
|
||||
- (instancetype)initWithEdge:(GREYContentEdge)edge
|
||||
startPointPercents:(CGPoint)startPointPercents NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A GREYAction that changes the value on a UISlider.
|
||||
*/
|
||||
@interface GREYSlideAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Action for instances of UISlider that allow the thumb to be moved to a specific @c value.
|
||||
*
|
||||
* @param value Value to set on the Slider.
|
||||
*
|
||||
* @return An instance of GREYSlideAction, initialized with the provided slider value.
|
||||
*/
|
||||
- (instancetype)initWithSliderValue:(float)value NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A class that mimics a stopwatch for calculating code latency.
|
||||
*
|
||||
* Usage example:
|
||||
* @code
|
||||
* GREYStopwatch *stopwatch = [[GREYStopwatch alloc] init];
|
||||
* [stopwatch start];
|
||||
* -------code block-------
|
||||
* [stopwatch stop];
|
||||
* NSLog(@"Time it took to execute codeblock %f", [stopwatch elapsedTime]);
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
@interface GREYStopwatch : NSObject
|
||||
|
||||
/**
|
||||
* Set the start time of the stopwatch to the current time as obtained by @c mach_absolute_time().
|
||||
* Calling this multiple times will result in the start time being reset every single time. This
|
||||
* is the only way to set the start time of the stop watch.
|
||||
*/
|
||||
- (void)start;
|
||||
|
||||
/**
|
||||
* Set the stop time of the stopwatch to the current time as obtained by @c mach_absolute_time().
|
||||
* This also prevents subsequent calls to @c GREYStopwatch::lapAndReturnTime from being performed.
|
||||
* This does not affect the stopwatch's saved start time or lap time. Calling stop without first
|
||||
* calling @c GREYStopwatch::start will throw an exception.
|
||||
*/
|
||||
- (void)stop;
|
||||
|
||||
/**
|
||||
* Returns the time obtained by subtracting the time the stopwatch was last stopped and last
|
||||
* started. If the stopwatch is never started/stopped then it will throw an exception. This does
|
||||
* not cumulatively add up the times the stopwatch was started/stopped. If the user wants the
|
||||
* cumulative value of all start/stops, then the user will have to save the times and add them up.
|
||||
*
|
||||
* @return an NSTimeInterval with the interval from the time the stopwatch was started.
|
||||
*/
|
||||
- (NSTimeInterval)elapsedTime;
|
||||
|
||||
/**
|
||||
* Obtain the time interval from subtracting the current time as obtained by
|
||||
* @c mach_absolute_time() from the reference time that @c GREYStopwatch::lapAndReturnTime was
|
||||
* last called at. In case @c GREYStopwatch::lapAndReturnTime was never called, then this will
|
||||
* return the interval from the start time. Similar to @c GREYStopwatch::elapsedTime, this will
|
||||
* throw an exception if the stopwatch was never started.
|
||||
*
|
||||
* @return an NSTimeInterval with the interval from the time the stopwatch was started.
|
||||
*/
|
||||
- (NSTimeInterval)lapAndReturnTime;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDescription.h>
|
||||
|
||||
/**
|
||||
* A string based implementation of GREYDescription protocol.
|
||||
*/
|
||||
@interface GREYStringDescription : NSObject<GREYDescription>
|
||||
@end
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class is used as a common base class for proxy delegates.
|
||||
* Primarily used to hold needed message forwarding methods.
|
||||
*/
|
||||
@interface GREYSurrogateDelegate : NSObject
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializer that takes the original delegate and provides a surrogate backed by the original.
|
||||
*
|
||||
* @param originalDelegate The original delegate being proxied. This can be @c nil.
|
||||
* @param shouldBeWeak Specifies whether the delegate should be weak or strong.
|
||||
*
|
||||
* @return an instance of GREYSurrogateDelegate backed by the provided delegate.
|
||||
*/
|
||||
- (instancetype)initWithOriginalDelegate:(id)originalDelegate
|
||||
isWeak:(BOOL)shouldBeWeak NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* @return The original delegate that's being proxied.
|
||||
*/
|
||||
- (id)originalDelegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A GREYAction that swipes/flicks the matched element.
|
||||
*/
|
||||
@interface GREYSwipeAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Performs a swipe in the given @c direction in the given @c duration, the start of swipe is
|
||||
* chosen to achieve maximum swipe, such as a point close to bottom edge of the element is chosen
|
||||
* in case of a swipe in up direction
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param duration The time interval for which the swipe takes place.
|
||||
*
|
||||
* @return An instance of GREYSwipeAction, initialized with the provided direction and duration.
|
||||
*/
|
||||
- (instancetype)initWithDirection:(GREYDirection)direction
|
||||
duration:(CFTimeInterval)duration;
|
||||
|
||||
/**
|
||||
* Performs a swipe in the given @c direction in the given @c duration, the start of swipe is
|
||||
* chosen based on @c startPercents. Since swipes must begin inside the element and not
|
||||
* on the edge of it x/y startPercents must be in the range (0,1) exclusive.
|
||||
*
|
||||
* @param direction The direction of the swipe.
|
||||
* @param duration The time interval for which the swipe takes place.
|
||||
* @param startPercents @c startPercents.x sets the value of the x-coordinate of the start point
|
||||
* by interpolating between left(for 0.0) and right(for 1.0) edge similarly
|
||||
* @c startPercents.y determines the y coordinate.
|
||||
*
|
||||
* @return An instance of GREYSwipeAction, initialized with the provided direction, duration
|
||||
* and information for the start point.
|
||||
*/
|
||||
- (instancetype)initWithDirection:(GREYDirection)direction
|
||||
duration:(CFTimeInterval)duration
|
||||
startPercents:(CGPoint)startPercents;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,340 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A utility class used for swizzling class and instance methods.
|
||||
*/
|
||||
@interface GREYSwizzler : NSObject
|
||||
|
||||
/**
|
||||
* Resets @c methodSelector to the original implementation if it's implementation was swapped using
|
||||
* this swizzler.
|
||||
*
|
||||
* @remark If the same method was swizzled multiple times, resetting will restore to the very first
|
||||
* implementation before any swizzling.
|
||||
*
|
||||
* @param methodSelector The selector of the method that was originally swizzled.
|
||||
* @param klass The class that the class-method belongs to.
|
||||
*
|
||||
* @return @c YES if reset was successful, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)resetClassMethod:(SEL)methodSelector class:(Class)klass;
|
||||
|
||||
/**
|
||||
* Resets @c methodSelector to the original implementation if it's implementation was swapped using
|
||||
* this swizzler.
|
||||
*
|
||||
* @remark If the same method was swizzled multiple times using this swizzler, resetting will
|
||||
* restore to the very first implementation before any swizzling performed with this
|
||||
* swizzler.
|
||||
*
|
||||
* @param methodSelector The selector of the method that was originally swizzled.
|
||||
* @param klass The class that the instance-method belongs to.
|
||||
*
|
||||
* @return @c YES if reset was successful, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)resetInstanceMethod:(SEL)methodSelector class:(Class)klass;
|
||||
|
||||
/**
|
||||
* Resets implementation of all the selectors swapped using this swizzler.
|
||||
*/
|
||||
- (void)resetAll;
|
||||
|
||||
/**
|
||||
* Swizzle class methods of a class. The first time a method is swizzled, its current
|
||||
* implementation will be saved. If @c klass does not directly implement @c methodSelector1
|
||||
* (inherits it from a superclass), we dynamically override @c methodSelector1 with a
|
||||
* copy of @c methodSelector2's implementation. This is to avoid swizzling the superclass's
|
||||
* implementation. The same happens for @c methodSelector2, if @c klass does not directly
|
||||
* implement @c methodSelector2, it is added to @c klass before swizzling.
|
||||
*
|
||||
* @param klass The class whose methods are to be swizzled.
|
||||
* @param methodSelector1 Selector of the method which is to be replaced.
|
||||
* @param methodSelector2 Selector of the method which is to be replaced with.
|
||||
*
|
||||
* @return @c YES if methods were successfully swizzled, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)swizzleClass:(Class)klass
|
||||
replaceClassMethod:(SEL)methodSelector1
|
||||
withMethod:(SEL)methodSelector2;
|
||||
|
||||
/**
|
||||
* Swizzle instance methods of a class. The first time a method is swizzled, its current
|
||||
* implementation will be saved. If @c klass does not directly implement @c methodSelector1
|
||||
* (inherits it from a superclass), we dynamically override @c methodSelector1 with a
|
||||
* copy of @c methodSelector2's implementation. This is to avoid swizzling the superclass's
|
||||
* implementation. The same happens for @c methodSelector2, if @c klass does not directly
|
||||
* implement @c methodSelector2, it is added to @c klass before swizzling.
|
||||
*
|
||||
* @param klass The class whose methods are to be swizzled.
|
||||
* @param methodSelector1 Selector of the method which is to be replaced.
|
||||
* @param methodSelector2 Selector of the method which is to be replaced with.
|
||||
*
|
||||
* @return @c YES if methods were successfully swizzled, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)swizzleClass:(Class)klass
|
||||
replaceInstanceMethod:(SEL)methodSelector1
|
||||
withMethod:(SEL)methodSelector2;
|
||||
|
||||
/**
|
||||
* Adds @c methodSelector with implementation @c imp to @c klass. After that, swizzles
|
||||
* @c methodSelector with @c sel. @c sel must be an instance method of @c klass and
|
||||
* @c methodSelector must have the same signature as @c sel.
|
||||
*
|
||||
* @param klass The class whose methods are to be swizzled.
|
||||
* @param addSelector The selector to add to @c klass.
|
||||
* @param addIMP Implementation of @c methodSelector when it's added to @c klass.
|
||||
* @param instanceSelector Selector of the method which will be swizzled with @c methodSelector.
|
||||
*
|
||||
* @return @c YES if the given method could be successfully added and swizzled, @c NO otherwise.
|
||||
*/
|
||||
- (BOOL)swizzleClass:(Class)klass
|
||||
addInstanceMethod:(SEL)addSelector
|
||||
withImplementation:(IMP)addIMP
|
||||
andReplaceWithInstanceMethod:(SEL)instanceSelector;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
# pragma mark - Original Method Invocation Macros
|
||||
|
||||
/**
|
||||
* Invokes the original implementation from inside a swizzled implementation.
|
||||
*
|
||||
* @param __returnType The return type of the original implementation.
|
||||
* @param __swizzledSEL The selector used for swizzling.
|
||||
*/
|
||||
#define INVOKE_ORIGINAL_IMP(__returnType, \
|
||||
__swizzledSEL) \
|
||||
((__returnType(*)(id, \
|
||||
SEL)) \
|
||||
[self methodForSelector:__swizzledSEL])(self, \
|
||||
_cmd)
|
||||
|
||||
/**
|
||||
* Invokes the original implementation from inside a swizzled implementation. Use this instead of
|
||||
* INVOKE_ORIGINAL_IMP when the original selector takes one argument.
|
||||
*
|
||||
* @param __returnType The return type of the original implementation.
|
||||
* @param __swizzledSEL The selector used for swizzling.
|
||||
* @param __arg1 The first argument to be passed to the original implementation.
|
||||
*/
|
||||
#define INVOKE_ORIGINAL_IMP1(__returnType, \
|
||||
__swizzledSEL, \
|
||||
__arg1) \
|
||||
((__returnType(*)(id, \
|
||||
SEL, \
|
||||
__typeof__(__arg1))) \
|
||||
[self methodForSelector:__swizzledSEL])(self, \
|
||||
_cmd, \
|
||||
__arg1)
|
||||
|
||||
/**
|
||||
* Invokes the original implementation from inside a swizzled implementation. Use this instead of
|
||||
* INVOKE_ORIGINAL_IMP when the original selector takes two arguments.
|
||||
*
|
||||
* @param __returnType The return type of the original implementation.
|
||||
* @param __swizzledSEL The selector used for swizzling.
|
||||
* @param __arg1 The first argument to be passed to the original implementation.
|
||||
* @param __arg2 The second argument to be passed to the original implementation.
|
||||
*/
|
||||
#define INVOKE_ORIGINAL_IMP2(__returnType, \
|
||||
__swizzledSEL, \
|
||||
__arg1, \
|
||||
__arg2) \
|
||||
((__returnType(*)(id, \
|
||||
SEL, \
|
||||
__typeof__(__arg1), \
|
||||
__typeof__(__arg2))) \
|
||||
[self methodForSelector:__swizzledSEL])(self, \
|
||||
_cmd, \
|
||||
__arg1, \
|
||||
__arg2)
|
||||
|
||||
/**
|
||||
* Invokes the original implementation from inside a swizzled implementation. Use this instead of
|
||||
* INVOKE_ORIGINAL_IMP when the original selector takes three arguments.
|
||||
*
|
||||
* @param __returnType The return type of the original implementation.
|
||||
* @param __swizzledSEL The selector used for swizzling.
|
||||
* @param __arg1 The first argument to be passed to the original implementation.
|
||||
* @param __arg2 The second argument to be passed to the original implementation.
|
||||
* @param __arg3 The third argument to be passed to the original implementation.
|
||||
*/
|
||||
#define INVOKE_ORIGINAL_IMP3(__returnType, \
|
||||
__swizzledSEL, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3) \
|
||||
((__returnType(*)(id, \
|
||||
SEL, \
|
||||
__typeof__(__arg1), \
|
||||
__typeof__(__arg2), \
|
||||
__typeof__(__arg3))) \
|
||||
[self methodForSelector:__swizzledSEL])(self, \
|
||||
_cmd, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3)
|
||||
|
||||
/**
|
||||
* Invokes the original implementation from inside a swizzled implementation. Use this instead of
|
||||
* INVOKE_ORIGINAL_IMP when the original selector takes four arguments.
|
||||
*
|
||||
* @param __returnType The return type of the original implementation.
|
||||
* @param __swizzledSEL The selector used for swizzling.
|
||||
* @param __arg1 The first argument to be passed to the original implementation.
|
||||
* @param __arg2 The second argument to be passed to the original implementation.
|
||||
* @param __arg3 The third argument to be passed to the original implementation.
|
||||
* @param __arg4 The forth argument to be passed to the original implementation.
|
||||
*/
|
||||
#define INVOKE_ORIGINAL_IMP4(__returnType, \
|
||||
__swizzledSEL, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3, \
|
||||
__arg4) \
|
||||
((__returnType(*)(id, \
|
||||
SEL, \
|
||||
__typeof__(__arg1), \
|
||||
__typeof__(__arg2), \
|
||||
__typeof__(__arg3), \
|
||||
__typeof__(__arg4))) \
|
||||
[self methodForSelector:__swizzledSEL])(self, \
|
||||
_cmd, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3, \
|
||||
__arg4)
|
||||
|
||||
/**
|
||||
* Invokes the original implementation from inside a swizzled implementation. Use this instead of
|
||||
* INVOKE_ORIGINAL_IMP when the original selector takes five arguments.
|
||||
*
|
||||
* @param __returnType The return type of the original implementation.
|
||||
* @param __swizzledSEL The selector used for swizzling.
|
||||
* @param __arg1 The first argument to be passed to the original implementation.
|
||||
* @param __arg2 The second argument to be passed to the original implementation.
|
||||
* @param __arg3 The third argument to be passed to the original implementation.
|
||||
* @param __arg4 The forth argument to be passed to the original implementation.
|
||||
* @param __arg5 The fifth argument to be passed to the original implementation.
|
||||
*/
|
||||
#define INVOKE_ORIGINAL_IMP5(__returnType, \
|
||||
__swizzledSEL, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3, \
|
||||
__arg4, \
|
||||
__arg5) \
|
||||
((__returnType(*)(id, \
|
||||
SEL, \
|
||||
__typeof__(__arg1), \
|
||||
__typeof__(__arg2), \
|
||||
__typeof__(__arg3), \
|
||||
__typeof__(__arg4), \
|
||||
__typeof__(__arg5))) \
|
||||
[self methodForSelector:__swizzledSEL])(self, \
|
||||
_cmd, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3, \
|
||||
__arg4, \
|
||||
__arg5)
|
||||
|
||||
/**
|
||||
* Invokes the original implementation from inside a swizzled implementation. Use this instead of
|
||||
* INVOKE_ORIGINAL_IMP when the original selector takes sixth arguments.
|
||||
*
|
||||
* @param __returnType The return type of the original implementation.
|
||||
* @param __swizzledSEL The selector used for swizzling.
|
||||
* @param __arg1 The first argument to be passed to the original implementation.
|
||||
* @param __arg2 The second argument to be passed to the original implementation.
|
||||
* @param __arg3 The third argument to be passed to the original implementation.
|
||||
* @param __arg4 The forth argument to be passed to the original implementation.
|
||||
* @param __arg5 The fifth argument to be passed to the original implementation.
|
||||
* @param __arg6 The sixth argument to be passed to the original implementation.
|
||||
*/
|
||||
#define INVOKE_ORIGINAL_IMP6(__returnType, \
|
||||
__swizzledSEL, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3, \
|
||||
__arg4, \
|
||||
__arg5, \
|
||||
__arg6) \
|
||||
((__returnType(*)(id, \
|
||||
SEL, \
|
||||
__typeof__(__arg1), \
|
||||
__typeof__(__arg2), \
|
||||
__typeof__(__arg3), \
|
||||
__typeof__(__arg4), \
|
||||
__typeof__(__arg5), \
|
||||
__typeof__(__arg6))) \
|
||||
[self methodForSelector:__swizzledSEL])(self, \
|
||||
_cmd, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3, \
|
||||
__arg4, \
|
||||
__arg5, \
|
||||
__arg6)
|
||||
|
||||
/**
|
||||
* Invokes the original implementation from inside a swizzled implementation. Use this instead of
|
||||
* INVOKE_ORIGINAL_IMP when the original selector takes seven arguments.
|
||||
*
|
||||
* @param __returnType The return type of the original implementation.
|
||||
* @param __swizzledSEL The selector used for swizzling.
|
||||
* @param __arg1 The first argument to be passed to the original implementation.
|
||||
* @param __arg2 The second argument to be passed to the original implementation.
|
||||
* @param __arg3 The third argument to be passed to the original implementation.
|
||||
* @param __arg4 The forth argument to be passed to the original implementation.
|
||||
* @param __arg5 The fifth argument to be passed to the original implementation.
|
||||
* @param __arg6 The sixth argument to be passed to the original implementation.
|
||||
* @param __arg7 The seventh argument to be passed to the original implementation.
|
||||
*/
|
||||
#define INVOKE_ORIGINAL_IMP7(__returnType, \
|
||||
__swizzledSEL, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3, \
|
||||
__arg4, \
|
||||
__arg5, \
|
||||
__arg6, \
|
||||
__arg7) \
|
||||
((__returnType(*)(id, \
|
||||
SEL, \
|
||||
__typeof__(__arg1), \
|
||||
__typeof__(__arg2), \
|
||||
__typeof__(__arg3), \
|
||||
__typeof__(__arg4), \
|
||||
__typeof__(__arg5), \
|
||||
__typeof__(__arg6), \
|
||||
__typeof__(__arg7))) \
|
||||
[self methodForSelector:__swizzledSEL])(self, \
|
||||
_cmd, \
|
||||
__arg1, \
|
||||
__arg2, \
|
||||
__arg3, \
|
||||
__arg4, \
|
||||
__arg5, \
|
||||
__arg6, \
|
||||
__arg7)
|
||||
@@ -0,0 +1,161 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - Error domain and codes
|
||||
|
||||
GREY_EXTERN NSString *const kGREYSyntheticEventInjectionErrorDomain;
|
||||
|
||||
/**
|
||||
* Error codes for synthetic event injection failures.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYSyntheticEventInjectionErrorCode) {
|
||||
kGREYOrientationChangeFailedErrorCode = 0, // Device orientation change has failed.
|
||||
};
|
||||
|
||||
#pragma mark - Interface
|
||||
|
||||
/**
|
||||
* Utility to deliver user actions such as touches, taps, gestures and device rotation to the
|
||||
* application under test
|
||||
*/
|
||||
@interface GREYSyntheticEvents : NSObject
|
||||
|
||||
/**
|
||||
* Rotate the device to a given @c deviceOrientation. All device orientations except for
|
||||
* @c UIDeviceOrientationUnknown are supported. If a non-nil @c errorOrNil is provided, it will
|
||||
* be populated with the failure reason if the orientation change fails, otherwise a test failure
|
||||
* will be registered.
|
||||
*
|
||||
* @param deviceOrientation The desired orientation of the device.
|
||||
* @param[out] errorOrNil Error that will be populated on failure. If @c nil, the a test
|
||||
* failure will be reported if the rotation attempt fails.
|
||||
*
|
||||
* @throws GREYFrameworkException if the action fails and @c errorOrNil is @c nil.
|
||||
* @return @c YES if the rotation was successful, @c NO otherwise. If @c errorOrNil is @c nil and
|
||||
* the operation fails, it will throw an exception.
|
||||
*/
|
||||
+ (BOOL)rotateDeviceToOrientation:(UIDeviceOrientation)deviceOrientation
|
||||
errorOrNil:(__strong NSError **)errorOrNil;
|
||||
|
||||
/**
|
||||
* Shakes the device. If a non-nil @c errorOrNil is provided, it will
|
||||
* be populated with the failure reason if the orientation change fails, otherwise a test failure
|
||||
* will be registered.
|
||||
*
|
||||
* @param[out] errorOrNil Error that will be populated on failure. If @c nil, the a test
|
||||
* failure will be reported if the shake attempt fails.
|
||||
*
|
||||
* @throws GREYFrameworkException if the action fails and @c errorOrNil is @c nil.
|
||||
* @return @c YES if the shake was successful, @c NO otherwise. If @c errorOrNil is @c nil and
|
||||
* the operation fails, it will throw an exception.
|
||||
*/
|
||||
+ (BOOL)shakeDeviceWithError:(__strong NSError **)errorOrNil;
|
||||
|
||||
/**
|
||||
* Touch along a specified path in a @c CGPoint array.
|
||||
* This method blocks until all touches are delivered.
|
||||
*
|
||||
* @param touchPath An array of @c CGPoints. The first point in @c touchPath is the point where
|
||||
touch begins, and the last point in @c touchPath is the final touch point
|
||||
where touch ends. Points in @c touchPath must be in @c window coordinates.
|
||||
* @param window The UIWindow that contains the points in the @c touchPath where
|
||||
* the touches are performed. Interaction will begin on the view inside
|
||||
* @c window which passes the hit-test for the first point in @c touchPath.
|
||||
* @param duration The time interval over which to space the touches evenly. If 0, all
|
||||
* touches will be sent one after the other without any delay in-between them.
|
||||
* @param expendable @c YES indicates if the touch path must be delivered with accurate timing even
|
||||
* if a few touch objects (excluding the last one) have to be skipped,
|
||||
* use it to model time sensitive gestures like swipes where timing is more
|
||||
* important than accuracy. Is ignored if @c NO.
|
||||
*/
|
||||
+ (void)touchAlongPath:(NSArray *)touchPath
|
||||
relativeToWindow:(UIWindow *)window
|
||||
forDuration:(NSTimeInterval)duration
|
||||
expendable:(BOOL)expendable;
|
||||
|
||||
/**
|
||||
* Injects a multi touch sequence specified by the array of @c touchPaths in the specified @c
|
||||
* duration.
|
||||
* Note that a single touch path is an array of CGPoint structs identifying the path taken by it
|
||||
* relative to the specified @c window. Here @c expendable indicates if the touch path must be
|
||||
* delivered with accurate timing even if a few touch objects (excluding the last one) have to be
|
||||
* skipped. Use it to model time sensitive gestures like pinch where timing is more important than
|
||||
* accuracy.
|
||||
*
|
||||
* @param touchPaths An array of @c touchpaths each of which are array of @c CGPoints.
|
||||
* The first point in @c touchPath is the point where touch begins, and the last
|
||||
* point in @c touchPath is the final touch point where touch ends. Points in @c
|
||||
* touchPath Points in @c touchPath must be in @c window coordinates.
|
||||
* @param window The UIWindow that contains the points in the @c touchPath where
|
||||
* the touches are performed. Interaction will begin on the view inside
|
||||
* @c window which passes the hit-test for the first point in @c touchPath.
|
||||
* @param duration The time interval over which to space the touches evenly. If 0, all
|
||||
* touches will be sent one after the other without any delay in-between them.
|
||||
* @param expendable @c YES indicates if the touch path must be delivered with accurate timing even
|
||||
* if a few touch objects (excluding the last one) have to be skipped,
|
||||
* use it to model time sensitive gestures like swipes where timing is more
|
||||
* important than accuracy. Is ignored if @c NO.
|
||||
*/
|
||||
+ (void)touchAlongMultiplePaths:(NSArray *)touchPaths
|
||||
relativeToWindow:(UIWindow *)window
|
||||
forDuration:(NSTimeInterval)duration
|
||||
expendable:(BOOL)expendable;
|
||||
|
||||
/**
|
||||
* Begins interaction with a new touch starting at a specified point within a specified
|
||||
* window's coordinates.
|
||||
*
|
||||
* @param point The point where the touch is to start.
|
||||
* @param window The window that contains the coordinates of the touch points.
|
||||
* @param immediate If @c YES, this method blocks until touch is delivered, otherwise the touch is
|
||||
* enqueued for delivery the next time runloop drains.
|
||||
*/
|
||||
- (void)beginTouchAtPoint:(CGPoint)point
|
||||
relativeToWindow:(UIWindow *)window
|
||||
immediateDelivery:(BOOL)immediate;
|
||||
|
||||
/**
|
||||
* Continues the current interaction by moving touch to a new point. Providing the same point
|
||||
* in consecutive calls is intepreted as stationary touches. While delivering these touch points,
|
||||
* they may be buffered and during delivery if there are multiple stale touch points that
|
||||
* are time sensitive some of them may be dropped.
|
||||
*
|
||||
* @param point The point to move the touch to.
|
||||
* @param immediate If @c YES, this method blocks until touch is delivered, otherwise the touch is
|
||||
* enqueued for delivery the next time runloop drains.
|
||||
* @param expendable @c YES indicates that this touch point is intended to be delivered in a timely
|
||||
* manner rather than reliably. Is ignored if @c NO.
|
||||
*/
|
||||
- (void)continueTouchAtPoint:(CGPoint)point
|
||||
immediateDelivery:(BOOL)immediate
|
||||
expendable:(BOOL)expendable;
|
||||
|
||||
/**
|
||||
* Ends interaction started by GREYSyntheticEvents::beginTouchAtPoint:relativeToWindow.
|
||||
* This method will block until all the touches since the beginning of the interaction have been
|
||||
* delivered.
|
||||
*/
|
||||
- (void)endTouch;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYBaseAction.h>
|
||||
#import <EarlGrey/GREYConstants.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A GREYAction that taps on a given element.
|
||||
*/
|
||||
@interface GREYTapAction : GREYBaseAction
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* @remark initWithName::constraints: is overridden from its superclass.
|
||||
*/
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
constraints:(id<GREYMatcher>)constraints NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* A GREYAction that taps the given element.
|
||||
*
|
||||
* @param tapType The type of tap to be performed.
|
||||
*
|
||||
* @return An instance of GREYTapAction, initialized with the tap type to be performed.
|
||||
*/
|
||||
- (instancetype)initWithType:(GREYTapType)tapType;
|
||||
|
||||
/**
|
||||
* A GREYAction that taps the given element for a given number of times.
|
||||
*
|
||||
* @param tapType The type of tap to be performed.
|
||||
* @param numberOfTaps Number of times the element should be tapped.
|
||||
*
|
||||
* @return An instance of GREYTapAction, initialized with the tap type and
|
||||
the number of times it should be performed.
|
||||
*/
|
||||
- (instancetype)initWithType:(GREYTapType)tapType numberOfTaps:(NSUInteger)numberOfTaps;
|
||||
|
||||
/**
|
||||
* A GREYAction that taps the given element for a given number of times at the given location.
|
||||
*
|
||||
* @param tapType The type of tap to be performed.
|
||||
* @param numberOfTaps Number of times the element should be tapped.
|
||||
* @param tapLocation The location to be tapped, relative to the view being tapped.
|
||||
*
|
||||
* @return An instance of GREYTapAction, initialized with the tap type and
|
||||
the number of times it should be performed and the location to be tapped.
|
||||
*/
|
||||
- (instancetype)initWithType:(GREYTapType)tapType
|
||||
numberOfTaps:(NSUInteger)numberOfTaps
|
||||
location:(CGPoint)tapLocation;
|
||||
|
||||
/**
|
||||
* A GREYAction that performs a long press with a given duration.
|
||||
*
|
||||
* @param duration The duration of the long press.
|
||||
*
|
||||
* @return An instance of GREYTapAction, initialized with the duration of the long press.
|
||||
*/
|
||||
- (instancetype)initLongPressWithDuration:(CFTimeInterval)duration;
|
||||
|
||||
/**
|
||||
* A GREYAction that performs a long press with a given @c duration at the given @c location.
|
||||
*
|
||||
* @param duration The duration of the long press.
|
||||
* @param location The location of the long press relative to the element recieving the touch
|
||||
* event.
|
||||
*
|
||||
* @return An instance of GREYTapAction, initialized with the @c duration and @c location of
|
||||
* the long press.
|
||||
*/
|
||||
- (instancetype)initLongPressWithDuration:(CFTimeInterval)duration location:(CGPoint)location;
|
||||
|
||||
/**
|
||||
* A GREYAction that performs a tap of the specified @c type for the speficied @c numberOfTaps at
|
||||
* the @c location, with each tap in case of time based touch events like long press lasting for
|
||||
* the given @c duration.
|
||||
*
|
||||
* @param tapType The type of the tap.
|
||||
* @param numberOfTaps Number of times the element should be tapped.
|
||||
* @param duration The duration of the tap event if applicable.
|
||||
* @param tapLocation The location of the tap relative to the element recieving the touch
|
||||
* event.
|
||||
*
|
||||
* @return An initialized (to the given parameters) instance of GREYTapAction.
|
||||
*/
|
||||
- (instancetype)initWithType:(GREYTapType)tapType
|
||||
numberOfTaps:(NSUInteger)numberOfTaps
|
||||
duration:(CFTimeInterval)duration
|
||||
location:(CGPoint)tapLocation NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* Class used for invoking a test case method and updating the status of the test case
|
||||
*/
|
||||
@interface GREYTestCaseInvocation : NSInvocation
|
||||
@end
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <EarlGrey/GREYIdlingResource.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* An idling resource that changes to busy state for a specified amount of time.
|
||||
*/
|
||||
@interface GREYTimedIdlingResource : NSObject<GREYIdlingResource>
|
||||
|
||||
/**
|
||||
* An idling resouce for any @c object whose idleness is time-dependent. The resource reports
|
||||
* busy until @c seconds has elapsed.
|
||||
*
|
||||
* This idling resource self-registers with GREYUIThreadExecutor on creation and deregisters when
|
||||
* it idles or is forcefully stopped using GREYTimedIdlingResource::stopMonitoring.
|
||||
*
|
||||
* @param object The object to monitor.
|
||||
* @param seconds The amount of time after which object will be in idle state.
|
||||
* @param name A descriptive name for the idling resource.
|
||||
*
|
||||
* @return A new idling resource instance for @c object.
|
||||
*/
|
||||
+ (instancetype)resourceForObject:(NSObject *)object
|
||||
thatIsBusyForDuration:(CFTimeInterval)seconds
|
||||
name:(NSString *)name;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Forcefully stops monitoring.
|
||||
* Subsequent invocations to GREYIdlingResource::isIdleNow return @c YES.
|
||||
*/
|
||||
- (void)stopMonitoring;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/**
|
||||
* An enum for what phase of a touch action a @c GREYTouchInfo object is in.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, GREYTouchInfoPhase) {
|
||||
GREYTouchInfoPhaseTouchBegan,
|
||||
GREYTouchInfoPhaseTouchMoved,
|
||||
GREYTouchInfoPhaseTouchEnded,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* An object to encapsulate essential information about a touch.
|
||||
*/
|
||||
@interface GREYTouchInfo : NSObject
|
||||
|
||||
/**
|
||||
* Points where touch should be delivered.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSArray *points;
|
||||
|
||||
/**
|
||||
* The phase (began, moved etc) of the touch object.
|
||||
*/
|
||||
@property(nonatomic, assign) GREYTouchInfoPhase phase;
|
||||
|
||||
/**
|
||||
* Delays this touch for specified value since the last touch delivery.
|
||||
*/
|
||||
@property(nonatomic, readonly) NSTimeInterval deliveryTimeDeltaSinceLastTouch;
|
||||
/**
|
||||
* Indicates that this touch can be dropped if system delivering the touches experiences a
|
||||
* lag causing it to miss the expected delivery time.
|
||||
*/
|
||||
@property(nonatomic, readonly, getter=isExpendable) BOOL expendable;
|
||||
|
||||
/**
|
||||
* Initializes this object to represent a touch at the the given @c points.
|
||||
*
|
||||
* @param points The CGPoints where the touches are to be delivered.
|
||||
* @param phase The current phase of each touch point.
|
||||
* @param timeDeltaSinceLastTouchSeconds The relative injection time from the time last
|
||||
* touch point was injected. It is also used as the
|
||||
* expected delivery time.
|
||||
* @param expendable Used for time sensitive touches, it specified if the
|
||||
* touch can be dropped if system lag causes the system to
|
||||
* miss the expected delivery time. If @c NO, then the touch
|
||||
* will be delivered regardless.
|
||||
*
|
||||
* @return An instance of GREYTouchInfo, initialized with all required data.
|
||||
*/
|
||||
- (instancetype)initWithPoints:(NSArray *)points
|
||||
phase:(GREYTouchInfoPhase)phase
|
||||
deliveryTimeDeltaSinceLastTouch:(NSTimeInterval)timeDeltaSinceLastTouchSeconds
|
||||
expendable:(BOOL)expendable NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// Copyright 2016 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <EarlGrey/GREYDefines.h>
|
||||
#import "Event/GREYTouchInfo.h"
|
||||
|
||||
/**
|
||||
* The frequency at which touches will be injected per second. Currently set to 60Hz.
|
||||
*/
|
||||
GREY_EXTERN const NSTimeInterval kGREYTouchInjectionFrequency;
|
||||
|
||||
/**
|
||||
* State for touch injector.
|
||||
*/
|
||||
typedef NS_ENUM(NSInteger, GREYTouchInjectorState) {
|
||||
/**
|
||||
* Touch injection hasn't started yet.
|
||||
*/
|
||||
kGREYTouchInjectorPendingStart,
|
||||
/**
|
||||
* Injection has started injecting touches.
|
||||
*/
|
||||
kGREYTouchInjectorStarted,
|
||||
/**
|
||||
* Touch injection has stopped. This state is reached when injector has
|
||||
* finished injecting all the queued touches.
|
||||
*/
|
||||
kGREYTouchInjectorStopped,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A touch injector that delivers a complete touch sequence for single finger interactions.
|
||||
* Buffers all touch events until @c startInjecting: is called.
|
||||
* Once injection is complete, this injector should be discarded.
|
||||
*/
|
||||
@interface GREYTouchInjector : NSObject
|
||||
/**
|
||||
* @remark init is not an available initializer. Use the other initializers.
|
||||
*/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Initializes with the @c window to which touches will be delivered.
|
||||
*
|
||||
* @param window The window that receives the touches.
|
||||
*
|
||||
* @return An instance of GREYSingleSequenceTouchInjector, initialized with the window to be
|
||||
* touched.
|
||||
*/
|
||||
- (instancetype)initWithWindow:(UIWindow *)window NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Enqueues @c touchInfo that will be materialized into a UITouch and delivered to application.
|
||||
*
|
||||
* @param touchInfo The info that is used to create the UITouch. If it represents a last touch
|
||||
* in a sequence, the specified @c point value is ignored and injector
|
||||
* automatically picks the previous point where touch occured to deliver
|
||||
* the last touch.
|
||||
*/
|
||||
- (void)enqueueTouchInfoForDelivery:(GREYTouchInfo *)touchInfo;
|
||||
|
||||
/**
|
||||
* @return The state of this injector.
|
||||
*/
|
||||
- (GREYTouchInjectorState)state;
|
||||
|
||||
/**
|
||||
* Starts delivering touches to current application.
|
||||
*/
|
||||
- (void)startInjecting;
|
||||
|
||||
/**
|
||||
* Wait until the touch injection has stopped.
|
||||
*/
|
||||
- (void)waitUntilAllTouchesAreDeliveredUsingInjector;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Copyright 2017 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* A private wrapper used to store information that is essential for printing the UI hierarchy
|
||||
* appropriately and in correct order.
|
||||
*/
|
||||
@interface GREYTraversalObject : NSObject
|
||||
|
||||
/**
|
||||
* An NSUInteger representing the number of parent-child relationships from the root element
|
||||
* to the current element.
|
||||
*/
|
||||
@property(nonatomic) NSUInteger level;
|
||||
|
||||
/**
|
||||
* The UI element that the GREYHierarchyObject is wrapped around.
|
||||
*/
|
||||
@property(nonatomic, strong) id element;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Private class to traverse the UI Hierarchy.
|
||||
* Provides helper methods to access the various elements present in the hierarchy.
|
||||
*/
|
||||
@interface GREYTraversal : NSObject
|
||||
|
||||
/**
|
||||
* Instance method that returns the next object from the hierarchy. Needs to be implemented by
|
||||
* subclasses. This class provides an empty implementation.
|
||||
*
|
||||
* @return An instance of the UI element that is next in the hierarchy.
|
||||
*/
|
||||
- (id _Nullable)nextObject NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* Explores the immediate children of the @c element that is passed in.
|
||||
*
|
||||
* @param element The UI element whose children are to be explored.
|
||||
*
|
||||
* @return Creates a new array that contains the immediate children of @c element. The children are
|
||||
* ordered from front to back, meaning subviews that were added first are present later
|
||||
* in the array. If no children exist, then an empty array is returned.
|
||||
*/
|
||||
- (NSArray *)exploreImmediateChildren:(id)element;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// Copyright 2017 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import "Traversal/GREYTraversal.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GREYTraversalBFS : GREYTraversal
|
||||
|
||||
/**
|
||||
* Instance method that returns the next object from the hierarchy in a Breadth First Search
|
||||
* fashion.
|
||||
*
|
||||
* @return An instance of the UI element that is next in the hierarchy.
|
||||
*/
|
||||
- (id _Nullable)nextObject;
|
||||
|
||||
/**
|
||||
* Class method to initialize the object. The hierarchy is unrolled in a BFS fashion and
|
||||
* an internal representation is created.
|
||||
*
|
||||
* @param element Single UI element whose UI hierarchy is to be parsed.
|
||||
*
|
||||
* @return An instance of GREYTraversalBFS.
|
||||
*/
|
||||
+ (instancetype)hierarchyForElementWithBFSTraversal:(id)element;
|
||||
|
||||
/**
|
||||
* Enumerates through the entire hierarchy and calls the @c block on each element in the hierarchy.
|
||||
* This method enumerates through the hierarchy only once.
|
||||
*
|
||||
* @param block A completion block that will be invoked on each element.
|
||||
*/
|
||||
- (void)enumerateUsingBlock:(void (^)(id view, NSUInteger level))block;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// Copyright 2017 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import "Traversal/GREYTraversal.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface GREYTraversalDFS : GREYTraversal
|
||||
|
||||
/**
|
||||
* Instance method that returns the next object from the hierarchy in a Depth First Search fashion.
|
||||
*
|
||||
* @return An instance of the UI element that is next in the hierarchy.
|
||||
*/
|
||||
- (id _Nullable)nextObject;
|
||||
|
||||
/**
|
||||
* Class method to initialize the object. The hierarchy is unrolled in a DFS fashion and
|
||||
* an internal represenation is created.
|
||||
*
|
||||
* @param element Single UI element whose UI hierarchy needs to be unrolled.
|
||||
*
|
||||
* @return An instance of the GREYTraversalDFS class.
|
||||
*/
|
||||
+ (instancetype)hierarchyForElementWithDFSTraversal:(id)element;
|
||||
|
||||
/**
|
||||
* Enumerates through the entire hierarchy and calls the @c block on each element in the hierarchy.
|
||||
* This method enumerates through the hierarchy only once.
|
||||
*
|
||||
* @param block A completion block that will be invoked on each element.
|
||||
*/
|
||||
- (void)enumerateUsingBlock:(void (^)(id view, NSUInteger level))block;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user