Skip to content

Commit

Permalink
Use EarlGrey and SocketRocket as sub-modules. Update EarlGrey to the …
Browse files Browse the repository at this point in the history
…latest release version. Update detox code using EarlGrey.
  • Loading branch information
LeoNatan committed Oct 12, 2016
1 parent 7a2b27e commit 510045b
Show file tree
Hide file tree
Showing 408 changed files with 215 additions and 52,795 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "detox/ios/SocketRocket"]
path = detox/ios/SocketRocket
url = https://github.com/facebook/SocketRocket.git
[submodule "detox/ios/EarlGrey"]
path = detox/ios/EarlGrey
url = https://github.com/google/EarlGrey.git
300 changes: 131 additions & 169 deletions detox/ios/Detox.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions detox/ios/Detox/EarlGreyExtensions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// EarlGreyExtensions.h
// Detox
//
// Created by Leo Natan (Wix) on 12/10/2016.
// Copyright © 2016 Wix. All rights reserved.
//

#import <EarlGrey/EarlGrey.h>

/**
Expose provate Earl Grey methods
*/
@interface GREYUIThreadExecutor ()

- (void)registerIdlingResource:(id<GREYIdlingResource>)resource;
- (void)deregisterIdlingResource:(id<GREYIdlingResource>)resource;

@end

FOUNDATION_EXPORT id HC_hasProperty(NSString *propertyName, id valueMatcher);

static inline id hasProperty(NSString *propertyName, id valueMatcher)
{
return HC_hasProperty(propertyName, valueMatcher);
}
2 changes: 1 addition & 1 deletion detox/ios/Detox/GREYMatchers+Detox.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import "GREYMatchers+Detox.h"
#import <OCHamcrest/OCHamcrest.h>
#import "EarlGreyExtensions.h"

@implementation GREYMatchers (Detox)

Expand Down
4 changes: 2 additions & 2 deletions detox/ios/Detox/ReactNativeBridgeIdlingResource.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#import "ReactNativeHeaders.h"
#import "ReactNativeBridgeIdlingResource.h"
#import "Common/GREYDefines.h"
#import "Common/GREYPrivate.h"

#import "EarlGreyExtensions.h"

static const CGFloat MOVING_AVERAGE_WEIGHT = 0.2;
static const CGFloat MIN_THRESHOLD_FOR_IDLE = 10;
Expand Down
11 changes: 6 additions & 5 deletions detox/ios/Detox/ReactNativeUIManagerIdlingResource.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

#import "ReactNativeHeaders.h"
#import "ReactNativeUIManagerIdlingResource.h"
#import "Common/GREYDefines.h"
#import "Common/GREYPrivate.h"

#import "EarlGreyExtensions.h"

@interface GREYDispatchQueueIdlingResource (ReactNativeUIManagerIdlingResource)
- (instancetype)initWithDispatchQueue:(dispatch_queue_t)queue name:(NSString *)name;
@end

extern dispatch_queue_t RCTGetUIManagerQueue(void);


@implementation ReactNativeUIManagerIdlingResource
{
Expand All @@ -29,10 +30,10 @@ + (dispatch_queue_t)getUIQueueFromBridge:(id)bridge
}

// this is a hack since we don't have a public API to check this and we crash over an assertion if we install twice
+ (GREYDispatchQueueIdlingResource*)checkIfDispatchQueueIdlingResourceAlreadyInstalled:(id)bridge
+ (GREYDispatchQueueIdlingResource*)checkIfDispatchQueueIdlingResourceAlreadyInstalled:(id)bridge name:(NSString*)name
{
dispatch_queue_t queue = [self getUIQueueFromBridge:bridge];
return [[GREYDispatchQueueIdlingResource class] performSelector:@selector(grey_resourceForCurrentlyTrackedDispatchQueue:) withObject:queue];
return [[GREYDispatchQueueIdlingResource class] performSelector:@selector(resourceWithDispatchQueue:name:) withObject:queue withObject:name];
}

+ (instancetype)idlingResourceForBridge:(id)bridge name:(NSString *)name
Expand All @@ -47,7 +48,7 @@ + (instancetype)idlingResourceForBridge:(id)bridge name:(NSString *)name
if (bridge == nil) return nil;

// we have an issue that calling unregister on the idling resource (sometimes?)
GREYDispatchQueueIdlingResource *existing = [self checkIfDispatchQueueIdlingResourceAlreadyInstalled:bridge];
GREYDispatchQueueIdlingResource *existing = [self checkIfDispatchQueueIdlingResourceAlreadyInstalled:bridge name:name];
if (existing != nil)
{
// I suspect that we have a race condition and deregister doesn't free the idling resource immediately, need to investigate further
Expand Down

This file was deleted.

137 changes: 0 additions & 137 deletions detox/ios/Detox/SocketRocket/Internal/Delegate/SRDelegateController.m

This file was deleted.

40 changes: 0 additions & 40 deletions detox/ios/Detox/SocketRocket/Internal/IOConsumer/SRIOConsumer.h

This file was deleted.

36 changes: 0 additions & 36 deletions detox/ios/Detox/SocketRocket/Internal/IOConsumer/SRIOConsumer.m

This file was deleted.

This file was deleted.

Loading

0 comments on commit 510045b

Please sign in to comment.