google / earlgrey Goto Github PK
View Code? Open in Web Editor NEW:tea: iOS UI Automation Test Framework
Home Page: http://google.github.io/EarlGrey/
License: Apache License 2.0
:tea: iOS UI Automation Test Framework
Home Page: http://google.github.io/EarlGrey/
License: Apache License 2.0
Facing the problem below :
Test target IntegrationTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
This error occurs when attempting to use the action to type text into a textfield.
If you chain responder status between textfields, EarlGrey will fail, reporting that "Keyboard did not disappear after resigning first responder status". This is because when your client implementation immediately moves firstResponder to a new textfield, the keyboard will not disappear (nor should it).
This error occurs because EarlGrey checks for Auto Correction on the textfield, disables autocorrection on the textfield, and then calls "resignFirstResponder" followed by "becomeFirstResponder", in order to effect the change. If your app chains firstResponder status, then the first call to "resignFirstResponder" will cause your app to pass responder status to the next text field.
Inspecting the EarlGrey source, it looks like the issue could be on line 182 in GREYActions.m. Here, we aren't checking to see that auto correction status is actually on. So even if your text field doesn't use auto correction, this will always invoke "resignFirstResponder" followed by "becomeFirstResponder". We should actually check to make sure that the prior value was "on" before performing this dance.
| |--<_UIAlertControllerView:0x7a7b4600; AX=N; AX.label='Login Failure';
EarlGrey().selectElementWithMatcher(grey_allOfMatchers(
grey_accessibilityLabel("Login Failure"),
grey_kindOfClass("_UIAlertControllerView")))
Why can't I use a string for grey_kindOfClass
? I can't reference _UIAlertControllerView directly as it appears to be a private class.
Is it possible to use EarlGrey with Swift? If so, are there any plans for an example repository to demonstrate simple usage?
It'd be nice if configure_earlgrey_pods.rb was published as a gem and supported carthage. Manual setup with carthage is painful.
Two unit tests are failing on Travis:
See full failure logs here:
https://s3.amazonaws.com/archive.travis-ci.org/jobs/110559080/log.txt
It'd be nice to have a simple example of how to do a custom action using Swift.
When a test fails, both a failure is recorded and an exception is raised by EarlGrey. This ends up logging the failure twice.
When I install the EarlGrey with the command pod install --verbose --no-repo-update
, I got the failure.
Downloading dependencies
-> Installing EarlGrey (1.0.0)
Http download
$ /usr/bin/curl -f -L -o
/var/folders/f8/40y7v4md00xdlvxnfy00stm40000gn/T/d20160219-30346-1tpz669/file.zip
http://www.github.com/google/EarlGrey/releases/download/1.0.0/EarlGrey-1.0.0.zip --create-dirs
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0curl: (56) Recv failure: Connection reset by peer
While downloading EarlGrey, the request is http not https.
In the file EarlGrey.podspec.json, the source is the http request
"source": {
"http": "http://www.github.com/google/EarlGrey/releases/download/1.0.0/EarlGrey-1.0.0.zip"
},
How can I change the path to https?
i want to go to other's page ,because i need to test UI element on other page
I tried to do an example test in my test project with below code.
[EarlGrey selectElementWithMatcher:grey_keyWindow()];
[[EarlGrey selectElementWithMatcher:grey_keyWindow()] assertWithMatcher:grey_sufficientlyVisible()];
The first line worked fine but the second one got crash. Any idea why this happen?
Env: iOS 9.2, iPhone 5s simulator + Xcode 7.2.1
In my test setup, the line
[[[XCUIApplication alloc] init] launch];
never returns.
If I remove it the tests run correctly. Is this line needed ?
On devices, the following code which tries to perform a Pan-From-Edge gesture fails:
[[EarlGrey selectElementWithMatcher:grey_keyWindow()] performAction:grey_swipeSlowInDirectionWithStartPoint(kGREYDirectionRight, 0.001f, 0.5f)]
I've verified it fails on at least the following devices:
I updated the docs and was surprised to see all the Travis failures.
The job exceeded the maxmimum time limit for jobs, and has been terminated.
Executed 208 tests, with 2 failures (2 unexpected) in 2361.286 (2361.643) seconds
When I'm trying to run 'pod install' the following error pops up
[!] Invalid Podfile
file: undefined method `project' for #Pod::Podfile:0x007fe73c1918f8. Updating CocoaPods might fix the issue.
I've tried this on multiple combinations of Cocoapods (using both stable and latest --pre) and Ruby, nothing seems to work.
The switch keyplane key's accessibilityLabel on Software keyboard triggered by normal UITextField is "more, numbers" or "more, letters" in any language setting.
But with secureTextEntry enabled, the accessibilityLabel of the key will be localized, which failed every test related to this.
Currently I'm using KIF's mechanism to bypass this, which directly calls the first responder view's "setText:" method.
Great solution for UITesting,thx:)
G
Since we have a wrapper around OCHamcrest, we do not need an explicit import nor any linking against it in the Test Projects themselves.
Remove all instances of -f OCHamcrest
from the UnitTests.xcodeproj
and FunctionalTest.xcodeproj
. Also, remove any uneeded imports containing import <OCHamcrest/...>
.
How does synchronization work,such as how to judge UI loading completed?
Is this the correct way to handle pointers with Swift?
I think this would be useful as a FAQ entry. It works in my test suite.
GREYCondition(name: "Wait for collection view to populate", block: { _ in
let errorOrNil = UnsafeMutablePointer<NSError?>.alloc(1)
errorOrNil.initialize(nil)
EarlGrey().selectElementWithMatcher(collectionViewMatcher)
.assertWithMatcher(grey_notNil(), error: errorOrNil)
let success = errorOrNil.memory == nil
errorOrNil.destroy()
errorOrNil.dealloc(1)
return success
}).waitWithTimeout(20.0)
As can be seen in EarlGreyExampleSwiftTests.m, grey_allOf and grey_anyOf are not exported to Swift. Instead, we have to use them by calling their init
methods. This needs to be investigated and the function calls fixed.
Whenever I try running a couple tests, the first one always fails when it should pass. When I rename methods to change execution order, the test that was failing now passes, and the passing test that is now running.
Running on the 5S(8.4) sim. Initially on Xcode 7.3, but reverted to 7.0.1 and still had this issue (side note: execution was a lot faster on 7.0.1).
I'd like to set text directly on the UITextField without using the keyboard. This doesn't seem possible to do with the existing API. In Espresso, there's a replaceText() action.
UITextField
has a setText
method.
From https://travis-ci.org/google/EarlGrey/jobs/118931370
The following tests take an enormous amount of time to complete:
I installed the project by manual and with object c project. After I followed the install document and try to do something, the above error occured and I can click the EarlGreay keyword goto the file.
Also @import module will failed.
I created a new project and the .xcodeproj file in under the root dic. But the one which failed the orignal .xcodeproj is under e.g. source/projectname/ After I set the file path in settings like "$(SRCROOT)/EarlGrey.xcodeproj" the full file path is like ..../source/projectname/...earlGrey.xcodeproj. So maybe this is the issue? How do I drag the xcodeproj to the project and how to set the ring file path here? Thanks.
Hi, I set the accessibilityId of a button in the storyboard, it seems in iPhone 6P it is ok, but for iPhone 5s, it was crashed.
Reproduce steps:
Device: iPhone 5s
Version: iOS 8.3
Condition: set a button accessibilityIdentifer in the storyboard.
Result: button tap event crash with the error "no element found".
Now that Carthage is able to fetch and build EarlGrey, it'd be nice to have an example similar to the existing cocoapods demo. Also the install-and-run
doc should be updated to include the steps necessary to get started with carthage.
In EarlGrey.swift
, EarlGrey is defined as:
public func EarlGrey() -> EarlGreyImpl! {
return EarlGreyImpl.invokedFromFile(#file, lineNumber: #line)
}
I define a login page object:
public class LoginPage {
//# MARK: - Login Page Elements
private var domainField: GREYElementInteraction {
return EarlGrey().selectElementWithMatcher(grey_accessibilityID("domain_field"))
}
which is then used:
func assertPageObjects() {
domainField.assertWithMatcher(grey_sufficientlyVisible())
}
The line number is wrong because EarlGrey()
sets it to be on the EarlGrey().selectElementWithMatcher...
line.
I've had to update EarlGrey.swift
like this:
//# MARK: - Custom EarlGrey file/line
extension EarlGreyImpl {
// Use @nonobjc to fix A declaration cannot be both 'final' and 'dynamic' error
@nonobjc public static var file: String = ""
@nonobjc public static var line: UInt = 0
public static func setFromFile(file: String, _ line: UInt) {
self.file = file
self.line = line
}
}
public func grey_invokedFromFile(file: String, _ line: UInt) {
EarlGreyImpl.setFromFile(file, line)
}
public func EarlGrey() -> EarlGreyImpl! {
return EarlGreyImpl.invokedFromFile(EarlGreyImpl.file, lineNumber: EarlGreyImpl.line)
}
and update the page object:
func assertPageObjects(file: String = #file, _ line: UInt = #line) {
grey_invokedFromFile(file, line)
domainField.assertWithMatcher(grey_sufficientlyVisible())
}
now the line number is correctly identified in the test. Thoughts on how to best update EarlGrey.swift
to handle this use case?
Description
when EarlGrey tries to open a viewController where the MFMailComposeViewController has been initialized, many warning messages start being printed on the console. and earlgrey keeps waiting forever until the test is marked as failed.
The warning message is:
AX Exchange error: Error Domain=Accessibility Code=0 "Remote service does not respond to _accessibilityMachPort" UserInfo={NSLocalizedDescription=Remote service does not respond to _accessibilityMachPort}
observations:
If you turn off synchronization the test continues until it finish, which marks the test as success. but the warning messages keeps appearing.
build_universal_static_framework.sh is missing
Hi,
I tried the EarlGrey, if you want to test non-English app, some keys can not be tapped, like "space". I tried with "fr", the space key should be "espace".
Besides of that, EarlGrey is great, thanks for making this.
The EarlGrey project is not building. [Xcode ver 6.4(6E35b)]
Steps:
Error:
GREYTapAction.m - Semantic Issue Method override for the designated initializer of the superclass '-initWithName:constraints:' not found
I was wondering what the command is to run the EarlGrey UI tests in Jenkins?
Is it the same as this?
"-sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' test"
I use that command for XCUITest.
I am evaluating frameworks for my work and we need it to run in Jenkins.
Thanks!
Integrate EarlGrey with XC UI Testing. Please follow this issue for progress updates.
I keep getting this issue where I navigate to another view controller then then nothing works,
I do have a custom matcher and I can see that it does match the element I'm looking but I cannot do anything with it. As this is the error I'm getting.
For some reason it's only on a specific view controller where it doesn't work but everything else works fine.
*** Assertion failure in -[GREYElementProvider dataEnumerator], /Users/tirodkar/egg/google3/third_party/objective_c/EarlGrey/EarlGrey/Provider/GREYElementProvider.m:152
0 CoreFoundation 0x000000010cba8e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010c61edeb objc_exception_throw + 48
2 CoreFoundation 0x000000010cba8cca +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010c0344de -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 EarlGrey 0x0000000121017437 __37-[GREYElementProvider dataEnumerator]_block_invoke + 2711
5 EarlGrey 0x0000000121015708 -[GREYDataEnumerator nextObject] + 72
6 CoreFoundation 0x000000010cabd2f5 -[NSEnumerator countByEnumeratingWithState:objects:count:] + 53
7 EarlGrey 0x0000000120ff1e79 -[GREYElementFinder elementsMatchedInProvider:] + 1817
8 EarlGrey 0x0000000120ff280d -[GREYElementInteraction matchedElementsWithTimeout:error:] + 1117
9 EarlGrey 0x0000000120ff42e6 __46-[GREYElementInteraction performAction:error:]_block_invoke + 502
10 EarlGrey 0x00000001210248bd __59-[GREYUIThreadExecutor executeSyncWithTimeout:block:error:]_block_invoke + 429
11 CoreFoundation 0x000000010cad4a1c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
12 CoreFoundation 0x000000010caca6a5 __CFRunLoopDoBlocks + 341
13 CoreFoundation 0x000000010cac9e02 __CFRunLoopRun + 850
14 CoreFoundation 0x000000010cac9828 CFRunLoopRunSpecific + 488
15 EarlGrey 0x000000012102338c -[GREYUIThreadExecutor executeSyncWithTimeout:block:error:] + 1932
16 EarlGrey 0x0000000120ff3981 -[GREYElementInteraction performAction:error:] + 2049
17 EarlGrey 0x0000000120ff310c -[GREYElementInteraction performAction:] + 76
18 mip_write_review_test 0x0000000120f87380 -[MIPWriteReviewTest test14TapReviewFromProfileScreen] + 240
19 CoreFoundation 0x000000010ca971cc __invoking___ + 140
What's the recommend approach for resetting the application state before each test? I'm thinking of issues such as:
Related to #30, xcode-build fails because the signing is set to Don't Code Sign
$ xcodebuild -project EarlGrey.xcodeproj -configuration Release -target EarlGrey CONFIGURATION_BUILD_DIR=../..
=== BUILD TARGET EarlGrey OF PROJECT EarlGrey WITH CONFIGURATION Release ===
Check dependencies
CodeSign error: code signing is required for product type 'Framework' in SDK 'iOS 9.3'
** BUILD FAILED **
How should people be making builds of EarlGrey? I think the setting should be set to automatic.
Project (EarlGrey) → Code Signing → Code Signing Identity → Automatic ...
code:
-(id)matcherForTextFieldWithPlaceHolder:(NSString*) placeholder{
MatchesBlock matches = ^BOOL(UITextField *textfield) {
return [textfield.placeholder isEqualToString:placeholder];
};
DescribeToBlock describe = ^void(id<GREYDescription> description) {
[description appendText:@"matcherForTextFieldWithPlaceHolder"];
};
return [[GREYElementMatcherBlock alloc] initWithMatchesBlock:matches
descriptionBlock:describe];
}
Thanks for your attention,
How to fix this issue ?
Espresso has a cool cheat sheet. I used their visual style to make one for EarlGrey. Feedback welcome.
It'd be nice to document how to use EarlGrey with Carthage.
I read through configure_earlgrey_pods and my guess is that Carthage isn't supported at this time.
I tried running setup-earlgrey.sh several times.
But, it says - "There was an issue moving Fishhook as per the EarlGrey specification.".
What's wrong ?
I am having trouble using EarlGrey with Carthage. I managed to build it with carthage by specifying master branch as source but then when I try to run it I get " Failed to read file or folder at"
which I found similar to issue Carthage/Carthage#1096
I was looking at EarlGrey-Info.plist and did not find CFBundlePackageType
property with FMWK value instead there is APPL.
Should we create another .plist for the xcscheme for Carthage or can we just change APPL to FMWK?
I followed all the steps mentioned here - https://github.com/google/EarlGrey/blob/master/docs/install-and-run.md.
I followed Github installation, but when i tried to import earlgrey using this @import EarlGrey
, it shows me an error saying "Module 'EarlGrey' not found".
I followed those steps exactly as they are mentioned.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.