earlgrey 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e2c1475df8675f191c0fbf6eb330bb3bd33b824
4
- data.tar.gz: 329f733ec79f4c3c480b867a65ac0c1c56ba8c66
3
+ metadata.gz: 11cbb8397c02fad28c1a9540138d60fec164964c
4
+ data.tar.gz: 56cdee3bd95121a638c3da2c68b1ed2a4959fb17
5
5
  SHA512:
6
- metadata.gz: de03ac8b34e3cd50a69616829b1ae517966950ea23559231da09018f9984635b646b6d6f6a5c1c948cf1ebb7a467c51c98d3b3f67f39d0c0478bcd79ee8a6084
7
- data.tar.gz: 4df7deec361904a5b7696a7a561b946f34f69ae0446574bb30e74da19caac4b32b69eb3ba0c3f5a7714f6f7e43489b000b4130ffff90081d582710b5657dd221
6
+ metadata.gz: bde9b7f311fc7355be93dd48e27dfdd7e5ec13954a6815ab30f55c56bbad8e436742f8c2490ca126daf81d40bc63c296330401e38dc788d09346064a2d0ec279
7
+ data.tar.gz: ff4b8ae1225ae473f0cf4c0a6c85e9b90cb56298fd1c29bfec5ec8172c66d4fcceb20d26eb38bff42ec966e00bc06ebaa20beef1fb706e070818517c08f46d0a
@@ -120,8 +120,7 @@ module EarlGrey
120
120
  scheme = modify_scheme_for_actions
121
121
 
122
122
  # Add a Copy Files Build Phase for EarlGrey.framework to embed it into the app under test.
123
- # carthage uses carthage copy-frameworks instead of a copy files build phase.
124
- add_earlgrey_copy_files_script unless carthage
123
+ add_earlgrey_copy_files_script
125
124
 
126
125
  # Add header/framework search paths for carthage
127
126
  add_carthage_search_paths
@@ -375,7 +374,7 @@ module EarlGrey
375
374
  target_files = test_target_group.files
376
375
  earlgrey_swift_file_ref = target_files.find { |f| f.display_name == src_swift_name }
377
376
  raise 'EarlGrey.swift not found in testing target' unless earlgrey_swift_file_ref
378
- test_target.source_build_phase.add_file_reference earlgrey_swift_file_ref
377
+ test_target.source_build_phase.add_file_reference(earlgrey_swift_file_ref, true)
379
378
  end
380
379
 
381
380
  # Link Binary With Libraries - frameworks_build_phase - Add EarlGrey.framework
@@ -383,18 +382,8 @@ module EarlGrey
383
382
  existing_frameworks = test_target.frameworks_build_phase.files.map(&:display_name)
384
383
  unless existing_frameworks.include? earlgrey_framework
385
384
  framework_ref = add_earlgrey_product
386
- test_target.frameworks_build_phase.add_file_reference framework_ref
387
- end
388
-
389
- if carthage
390
- # Add shell script phase
391
- shell_script_name = 'Carthage copy-frameworks Run Script'
392
- unless test_target.shell_script_build_phases.map(&:name).include?(shell_script_name)
393
- shell_script = test_target.new_shell_script_build_phase shell_script_name
394
- shell_script.shell_path = '/bin/bash'
395
- shell_script.shell_script = '/usr/local/bin/carthage copy-frameworks'
396
- shell_script.input_paths = ['$(SRCROOT)/Carthage/Build/iOS/EarlGrey.framework']
397
- end
385
+ # must pass 'true' to avoid duplicates
386
+ test_target.frameworks_build_phase.add_file_reference(framework_ref, true)
398
387
  end
399
388
 
400
389
  user_project.save
@@ -102,6 +102,7 @@ public func GREYFailWithDetails(reason: String, details: String) {
102
102
  private func GREYAssert(@autoclosure expression: () -> BooleanType,
103
103
  _ reason: String, details: String) {
104
104
  GREYSetCurrentAsFailable()
105
+ GREYWaitUntilIdle()
105
106
  if !expression().boolValue {
106
107
  greyFailureHandler.handleException(GREYFrameworkException(name: kGREYAssertionFailedException,
107
108
  reason: reason),
@@ -109,6 +110,10 @@ private func GREYAssert(@autoclosure expression: () -> BooleanType,
109
110
  }
110
111
  }
111
112
 
113
+ private func GREYWaitUntilIdle() {
114
+ GREYUIThreadExecutor.sharedInstance().drainUntilIdle()
115
+ }
116
+
112
117
  private func GREYSetCurrentAsFailable(file: String = #file, line: UInt = #line) {
113
118
  let greyFailureHandlerSelector =
114
119
  #selector(GREYFailureHandler.setInvocationFile(_:andInvocationLine:))
@@ -74,6 +74,7 @@ public func GREYFailWithDetails(_ reason: String, details: String) {
74
74
  private func GREYAssert(_ expression: @autoclosure () -> Bool,
75
75
  _ reason: String, details: String) {
76
76
  GREYSetCurrentAsFailable()
77
+ GREYWaitUntilIdle()
77
78
  if !expression() {
78
79
  EarlGrey.handle(exception: GREYFrameworkException(name: kGREYAssertionFailedException,
79
80
  reason: reason),
@@ -91,6 +92,10 @@ private func GREYSetCurrentAsFailable() {
91
92
  }
92
93
  }
93
94
 
95
+ private func GREYWaitUntilIdle() {
96
+ GREYUIThreadExecutor.sharedInstance().drainUntilIdle()
97
+ }
98
+
94
99
  open class EarlGrey: NSObject {
95
100
  open class func select(elementWithMatcher matcher:GREYMatcher,
96
101
  file: StaticString = #file,
@@ -115,13 +120,13 @@ open class EarlGrey: NSObject {
115
120
  }
116
121
 
117
122
  @discardableResult open class func rotateDeviceTo(orientation: UIDeviceOrientation,
118
- errorOrNil: UnsafeMutablePointer<NSError?>!,
119
- file: StaticString = #file,
120
- line: UInt = #line)
123
+ errorOrNil: UnsafeMutablePointer<NSError?>!,
124
+ file: StaticString = #file,
125
+ line: UInt = #line)
121
126
  -> Bool {
122
127
  return EarlGreyImpl.invoked(fromFile: file.description, lineNumber: line)
123
- .rotateDevice(to: orientation,
124
- errorOrNil: errorOrNil)
128
+ .rotateDevice(to: orientation,
129
+ errorOrNil: errorOrNil)
125
130
  }
126
131
  }
127
132
 
@@ -140,3 +145,14 @@ extension GREYInteraction {
140
145
  return self.usingSearch(searchAction, onElementWith: matcher)
141
146
  }
142
147
  }
148
+
149
+ extension GREYCondition {
150
+ open func waitWithTimeout(seconds: CFTimeInterval) -> Bool {
151
+ return self.wait(withTimeout: seconds)
152
+ }
153
+
154
+ open func waitWithTimeout(seconds: CFTimeInterval, pollInterval: CFTimeInterval)
155
+ -> Bool {
156
+ return self.wait(withTimeout: seconds, pollInterval: pollInterval)
157
+ }
158
+ }
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
 
16
16
  module EarlGrey
17
- VERSION = '0.1.5'.freeze unless defined? ::EarlGrey::VERSION
17
+ VERSION = '0.1.6'.freeze unless defined? ::EarlGrey::VERSION
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earlgrey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - khandpur
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-01-07 00:00:00.000000000 Z
13
+ date: 2017-03-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: colored
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.5.2
162
+ rubygems_version: 2.6.8
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: EarlGrey installer gem