calabash 2.0.0.pre11 → 2.0.0.prelegacy
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 +4 -4
- data/README.md +17 -5
- data/bin/calabash +4 -3
- data/lib/calabash/android/adb.rb +37 -34
- data/lib/calabash/android/application.rb +1 -1
- data/lib/calabash/android/build/builder.rb +1 -1
- data/lib/calabash/android/build/java_keystore.rb +1 -1
- data/lib/calabash/android/build/resigner.rb +1 -1
- data/lib/calabash/android/device.rb +46 -204
- data/lib/calabash/android/environment.rb +1 -14
- data/lib/calabash/android/gestures.rb +22 -6
- data/lib/calabash/android/interactions.rb +17 -14
- data/lib/calabash/android/legacy.rb +141 -4
- data/lib/calabash/android/lib/.irbrc +1 -9
- data/lib/calabash/android/lib/AndroidManifest.xml +2 -23
- data/lib/calabash/android/lib/TestServer.apk +0 -0
- data/lib/calabash/android/life_cycle.rb +3 -3
- data/lib/calabash/android/orientation.rb +8 -8
- data/lib/calabash/android/physical_buttons.rb +16 -19
- data/lib/calabash/android/server.rb +1 -6
- data/lib/calabash/android/text.rb +12 -12
- data/lib/calabash/android.rb +26 -92
- data/lib/calabash/application.rb +0 -3
- data/lib/calabash/cli/generate.rb +18 -8
- data/lib/calabash/cli/helpers.rb +9 -4
- data/lib/calabash/cli/run.rb +1 -1
- data/lib/calabash/console_helpers.rb +11 -179
- data/lib/calabash/device.rb +19 -4
- data/lib/calabash/gestures.rb +198 -292
- data/lib/calabash/http/retriable_client.rb +3 -18
- data/lib/calabash/http.rb +0 -1
- data/lib/calabash/interactions.rb +40 -3
- data/lib/calabash/ios/conditions.rb +1 -1
- data/lib/calabash/ios/console_helpers.rb +2 -2
- data/lib/calabash/ios/date_picker.rb +8 -10
- data/lib/calabash/ios/device/device_implementation.rb +21 -9
- data/lib/calabash/ios/device/gestures_mixin.rb +55 -53
- data/lib/calabash/ios/device/keyboard_mixin.rb +0 -21
- data/lib/calabash/ios/device/rotation_mixin.rb +65 -3
- data/lib/calabash/ios/device/text_mixin.rb +21 -0
- data/lib/calabash/ios/device.rb +1 -0
- data/lib/calabash/ios/gestures.rb +90 -24
- data/lib/calabash/ios/interactions.rb +6 -1
- data/lib/calabash/ios/lib/.irbrc +2 -9
- data/lib/calabash/ios/orientation.rb +8 -8
- data/lib/calabash/ios/runtime.rb +14 -14
- data/lib/calabash/ios/scroll.rb +17 -25
- data/lib/calabash/ios/slider.rb +18 -11
- data/lib/calabash/ios/text.rb +74 -20
- data/lib/calabash/ios/uia.rb +1 -1
- data/lib/calabash/ios.rb +16 -77
- data/lib/calabash/legacy.rb +6 -9
- data/lib/calabash/lib/skeleton/{Gemfile.skeleton → Gemfile} +0 -0
- data/lib/calabash/lib/skeleton/config/{cucumber.yml.skeleton → cucumber.yml} +0 -0
- data/lib/calabash/lib/skeleton/features/{sample.feature.skeleton → sample.feature} +0 -0
- data/lib/calabash/lib/skeleton/features/step_definitions/{sample_steps.rb.skeleton → calabash_steps.rb} +8 -8
- data/lib/calabash/lib/skeleton/features/support/{dry_run.rb.skeleton → dry_run.rb} +5 -2
- data/lib/calabash/lib/skeleton/features/support/{env.rb.skeleton → env.rb} +8 -2
- data/lib/calabash/lib/skeleton/features/support/hooks.rb +83 -0
- data/lib/calabash/life_cycle.rb +8 -16
- data/lib/calabash/location.rb +15 -14
- data/lib/calabash/orientation.rb +8 -8
- data/lib/calabash/page.rb +4 -1
- data/lib/calabash/screenshot.rb +3 -3
- data/lib/calabash/text.rb +19 -31
- data/lib/calabash/utility.rb +8 -41
- data/lib/calabash/version.rb +1 -1
- data/lib/calabash/wait.rb +192 -177
- data/lib/calabash.rb +10 -53
- metadata +32 -43
- data/lib/calabash/android/device/helper_application.rb +0 -95
- data/lib/calabash/android/lib/HelperApplication.apk +0 -0
- data/lib/calabash/android/lib/HelperApplicationTestServer.apk +0 -0
- data/lib/calabash/android/web.rb +0 -12
- data/lib/calabash/http/forwarding_client.rb +0 -23
- data/lib/calabash/internal.rb +0 -48
- data/lib/calabash/ios/automator/automator.rb +0 -217
- data/lib/calabash/ios/automator/coordinates.rb +0 -37
- data/lib/calabash/ios/automator/device_agent.rb +0 -379
- data/lib/calabash/ios/automator.rb +0 -9
- data/lib/calabash/ios/legacy.rb +0 -6
- data/lib/calabash/ios/web.rb +0 -10
- data/lib/calabash/lib/skeleton/features/support/hooks.rb.skeleton +0 -34
- data/lib/calabash/retry.rb +0 -33
- data/lib/calabash/stubs.rb +0 -21
- data/lib/calabash/web.rb +0 -44
data/lib/calabash.rb
CHANGED
@@ -1,18 +1,14 @@
|
|
1
|
-
# Calabash is a
|
2
|
-
# It supports
|
1
|
+
# Calabash is a Behavior-driven development (BDD) framework for Android and
|
2
|
+
# iOS. It supports both native and hybrid app testing.
|
3
3
|
#
|
4
4
|
# It is developed and maintained by Xamarin and is released under the Eclipse
|
5
5
|
# Public License.
|
6
6
|
module Calabash
|
7
|
-
class RequiredBothPlatformsError < LoadError
|
8
|
-
end
|
9
|
-
|
10
7
|
require 'calabash/version'
|
11
8
|
require 'calabash/environment'
|
12
9
|
require 'calabash/logger'
|
13
10
|
require 'calabash/color'
|
14
11
|
require 'calabash/utility'
|
15
|
-
require 'calabash/retry'
|
16
12
|
require 'calabash/application'
|
17
13
|
require 'calabash/device'
|
18
14
|
require 'calabash/http'
|
@@ -28,11 +24,9 @@ module Calabash
|
|
28
24
|
require 'calabash/query'
|
29
25
|
require 'calabash/text'
|
30
26
|
require 'calabash/interactions'
|
31
|
-
require 'calabash/web'
|
32
27
|
require 'calabash/defaults'
|
33
28
|
require 'calabash/legacy'
|
34
29
|
require 'calabash/console_helpers'
|
35
|
-
require 'calabash/internal'
|
36
30
|
|
37
31
|
|
38
32
|
require 'calabash/patch'
|
@@ -48,7 +42,6 @@ module Calabash
|
|
48
42
|
include Calabash::Orientation
|
49
43
|
include Calabash::Text
|
50
44
|
include Calabash::Interactions
|
51
|
-
include Calabash::Web
|
52
45
|
extend Calabash::Defaults
|
53
46
|
|
54
47
|
require 'calabash/page'
|
@@ -61,9 +54,9 @@ module Calabash
|
|
61
54
|
# @example
|
62
55
|
# # android/pages/my_page.rb
|
63
56
|
# class Android::MyPage < Calabash::Page
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
57
|
+
# include Calabash::Android
|
58
|
+
#
|
59
|
+
# # [...]
|
67
60
|
# end
|
68
61
|
#
|
69
62
|
# # step definition
|
@@ -78,7 +71,7 @@ module Calabash
|
|
78
71
|
# # pages/abstract_login_page.rb
|
79
72
|
# class AbstractLoginPage < Calabash::Page
|
80
73
|
# def login(username, password)
|
81
|
-
#
|
74
|
+
# enter_text_in(username_field, username)
|
82
75
|
# # [...]
|
83
76
|
# end
|
84
77
|
#
|
@@ -91,6 +84,8 @@ module Calabash
|
|
91
84
|
#
|
92
85
|
# # pages/android_login_page.rb
|
93
86
|
# class Android::LoginPage < SharedLoginPage
|
87
|
+
# include Calabash::Android
|
88
|
+
#
|
94
89
|
# private
|
95
90
|
#
|
96
91
|
# def username_field
|
@@ -127,9 +122,8 @@ module Calabash
|
|
127
122
|
if page_class.is_a?(Class)
|
128
123
|
modules = page_class.included_modules.map(&:to_s)
|
129
124
|
|
130
|
-
|
131
|
-
|
132
|
-
Logger.warn("Use cal.<method> for cross-platform methods, cal_android.<method> for Android-only and cal_ios.<method> for iOS-only")
|
125
|
+
unless modules.include?("Calabash::#{platform_module}")
|
126
|
+
raise "Page '#{page_class}' does not include Calabash::#{platform_module}"
|
133
127
|
end
|
134
128
|
|
135
129
|
if modules.include?('Calabash::Android') &&
|
@@ -137,10 +131,6 @@ module Calabash
|
|
137
131
|
raise "Page '#{page_class}' includes both Calabash::Android and Calabash::IOS"
|
138
132
|
end
|
139
133
|
|
140
|
-
unless page_class.ancestors.include?(Calabash::Page)
|
141
|
-
raise "Page '#{page_class}' is not a Calabash::Page"
|
142
|
-
end
|
143
|
-
|
144
134
|
page = page_class.send(:new, self)
|
145
135
|
|
146
136
|
if page.is_a?(Calabash::Page)
|
@@ -327,36 +317,3 @@ if Calabash::Environment::DEBUG_CALLED_METHODS
|
|
327
317
|
|
328
318
|
set_trace_func(trace_func)
|
329
319
|
end
|
330
|
-
|
331
|
-
# @!visibility private
|
332
|
-
class CalabashMethodsInternal
|
333
|
-
include ::Calabash
|
334
|
-
end
|
335
|
-
|
336
|
-
# @!visibility private
|
337
|
-
class CalabashMethods < BasicObject
|
338
|
-
include ::Calabash
|
339
|
-
|
340
|
-
instance_methods.each do |method_name|
|
341
|
-
define_method(method_name) do |*args, &block|
|
342
|
-
::CalabashMethodsInternal.new.send(method_name, *args, &block)
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
# Returns a object that exposes all of the public Calabash cross-platform API.
|
348
|
-
# This method should *always* be used to access the Calabash API. By default,
|
349
|
-
# all methods are executed using the default device and the default
|
350
|
-
# application.
|
351
|
-
#
|
352
|
-
# For OS specific methods use {cal_android} and {cal_ios}
|
353
|
-
#
|
354
|
-
# All API methods are available with documentation in {Calabash}
|
355
|
-
#
|
356
|
-
# @see {Calabash}
|
357
|
-
#
|
358
|
-
# @return [Object] Instance responding to all cross-platform Calabash methods
|
359
|
-
# in the API.
|
360
|
-
def cal
|
361
|
-
CalabashMethods.new
|
362
|
-
end
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.prelegacy
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Jonas Maturana Larsen
|
7
8
|
- Karl Krukow
|
8
9
|
- Tobias Røikjer
|
9
10
|
- Joshua Moody
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2016-
|
14
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: edn
|
@@ -92,7 +93,7 @@ dependencies:
|
|
92
93
|
requirements:
|
93
94
|
- - ">="
|
94
95
|
- !ruby/object:Gem::Version
|
95
|
-
version: 2.
|
96
|
+
version: 2.0.2
|
96
97
|
- - "<"
|
97
98
|
- !ruby/object:Gem::Version
|
98
99
|
version: '3.0'
|
@@ -102,7 +103,7 @@ dependencies:
|
|
102
103
|
requirements:
|
103
104
|
- - ">="
|
104
105
|
- !ruby/object:Gem::Version
|
105
|
-
version: 2.
|
106
|
+
version: 2.0.2
|
106
107
|
- - "<"
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: '3.0'
|
@@ -238,6 +239,20 @@ dependencies:
|
|
238
239
|
- - ">="
|
239
240
|
- !ruby/object:Gem::Version
|
240
241
|
version: '0'
|
242
|
+
- !ruby/object:Gem::Dependency
|
243
|
+
name: travis
|
244
|
+
requirement: !ruby/object:Gem::Requirement
|
245
|
+
requirements:
|
246
|
+
- - ">="
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '0'
|
249
|
+
type: :development
|
250
|
+
prerelease: false
|
251
|
+
version_requirements: !ruby/object:Gem::Requirement
|
252
|
+
requirements:
|
253
|
+
- - ">="
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
version: '0'
|
241
256
|
- !ruby/object:Gem::Dependency
|
242
257
|
name: pry
|
243
258
|
requirement: !ruby/object:Gem::Requirement
|
@@ -308,20 +323,6 @@ dependencies:
|
|
308
323
|
- - ">="
|
309
324
|
- !ruby/object:Gem::Version
|
310
325
|
version: '0'
|
311
|
-
- !ruby/object:Gem::Dependency
|
312
|
-
name: listen
|
313
|
-
requirement: !ruby/object:Gem::Requirement
|
314
|
-
requirements:
|
315
|
-
- - '='
|
316
|
-
- !ruby/object:Gem::Version
|
317
|
-
version: 3.0.6
|
318
|
-
type: :development
|
319
|
-
prerelease: false
|
320
|
-
version_requirements: !ruby/object:Gem::Requirement
|
321
|
-
requirements:
|
322
|
-
- - '='
|
323
|
-
- !ruby/object:Gem::Version
|
324
|
-
version: 3.0.6
|
325
326
|
- !ruby/object:Gem::Dependency
|
326
327
|
name: growl
|
327
328
|
requirement: !ruby/object:Gem::Requirement
|
@@ -351,12 +352,13 @@ dependencies:
|
|
351
352
|
- !ruby/object:Gem::Version
|
352
353
|
version: '0'
|
353
354
|
description: |-
|
354
|
-
Calabash is a
|
355
|
-
|
355
|
+
Calabash is a Behavior-driven development (BDD)
|
356
|
+
framework for Android and iOS. It supports both native and hybrid app testing.
|
356
357
|
|
357
358
|
It is developed and maintained by Xamarin and is released under the Eclipse
|
358
359
|
Public License.
|
359
360
|
email:
|
361
|
+
- jonaspec.larsen@xamarin.com
|
360
362
|
- karl.krukow@xamarin.com
|
361
363
|
- tobias.roikjer@xamarin.com
|
362
364
|
- joshua.moody@xamarin.com
|
@@ -384,15 +386,12 @@ files:
|
|
384
386
|
- lib/calabash/android/console_helpers.rb
|
385
387
|
- lib/calabash/android/defaults.rb
|
386
388
|
- lib/calabash/android/device.rb
|
387
|
-
- lib/calabash/android/device/helper_application.rb
|
388
389
|
- lib/calabash/android/environment.rb
|
389
390
|
- lib/calabash/android/gestures.rb
|
390
391
|
- lib/calabash/android/interactions.rb
|
391
392
|
- lib/calabash/android/legacy.rb
|
392
393
|
- lib/calabash/android/lib/.irbrc
|
393
394
|
- lib/calabash/android/lib/AndroidManifest.xml
|
394
|
-
- lib/calabash/android/lib/HelperApplication.apk
|
395
|
-
- lib/calabash/android/lib/HelperApplicationTestServer.apk
|
396
395
|
- lib/calabash/android/lib/TestServer.apk
|
397
396
|
- lib/calabash/android/lib/calmd5/arm64-v8a/calmd5
|
398
397
|
- lib/calabash/android/lib/calmd5/arm64-v8a/calmd5-pie
|
@@ -416,7 +415,6 @@ files:
|
|
416
415
|
- lib/calabash/android/scroll.rb
|
417
416
|
- lib/calabash/android/server.rb
|
418
417
|
- lib/calabash/android/text.rb
|
419
|
-
- lib/calabash/android/web.rb
|
420
418
|
- lib/calabash/application.rb
|
421
419
|
- lib/calabash/cli.rb
|
422
420
|
- lib/calabash/cli/build.rb
|
@@ -434,17 +432,11 @@ files:
|
|
434
432
|
- lib/calabash/gestures.rb
|
435
433
|
- lib/calabash/http.rb
|
436
434
|
- lib/calabash/http/error.rb
|
437
|
-
- lib/calabash/http/forwarding_client.rb
|
438
435
|
- lib/calabash/http/request.rb
|
439
436
|
- lib/calabash/http/retriable_client.rb
|
440
437
|
- lib/calabash/interactions.rb
|
441
|
-
- lib/calabash/internal.rb
|
442
438
|
- lib/calabash/ios.rb
|
443
439
|
- lib/calabash/ios/application.rb
|
444
|
-
- lib/calabash/ios/automator.rb
|
445
|
-
- lib/calabash/ios/automator/automator.rb
|
446
|
-
- lib/calabash/ios/automator/coordinates.rb
|
447
|
-
- lib/calabash/ios/automator/device_agent.rb
|
448
440
|
- lib/calabash/ios/conditions.rb
|
449
441
|
- lib/calabash/ios/console_helpers.rb
|
450
442
|
- lib/calabash/ios/date_picker.rb
|
@@ -466,12 +458,12 @@ files:
|
|
466
458
|
- lib/calabash/ios/device/routes/uia_route_mixin.rb
|
467
459
|
- lib/calabash/ios/device/runtime_attributes.rb
|
468
460
|
- lib/calabash/ios/device/status_bar_mixin.rb
|
461
|
+
- lib/calabash/ios/device/text_mixin.rb
|
469
462
|
- lib/calabash/ios/device/uia_keyboard_mixin.rb
|
470
463
|
- lib/calabash/ios/device/uia_mixin.rb
|
471
464
|
- lib/calabash/ios/environment.rb
|
472
465
|
- lib/calabash/ios/gestures.rb
|
473
466
|
- lib/calabash/ios/interactions.rb
|
474
|
-
- lib/calabash/ios/legacy.rb
|
475
467
|
- lib/calabash/ios/lib/.irbrc
|
476
468
|
- lib/calabash/ios/lib/recordings/rotate_left_home_down_ipad.base64
|
477
469
|
- lib/calabash/ios/lib/recordings/rotate_left_home_down_iphone.base64
|
@@ -496,16 +488,15 @@ files:
|
|
496
488
|
- lib/calabash/ios/slider.rb
|
497
489
|
- lib/calabash/ios/text.rb
|
498
490
|
- lib/calabash/ios/uia.rb
|
499
|
-
- lib/calabash/ios/web.rb
|
500
491
|
- lib/calabash/legacy.rb
|
501
492
|
- lib/calabash/lib/skeleton/.gitignore
|
502
|
-
- lib/calabash/lib/skeleton/Gemfile
|
503
|
-
- lib/calabash/lib/skeleton/config/cucumber.yml
|
504
|
-
- lib/calabash/lib/skeleton/features/sample.feature
|
505
|
-
- lib/calabash/lib/skeleton/features/step_definitions/
|
506
|
-
- lib/calabash/lib/skeleton/features/support/dry_run.rb
|
507
|
-
- lib/calabash/lib/skeleton/features/support/env.rb
|
508
|
-
- lib/calabash/lib/skeleton/features/support/hooks.rb
|
493
|
+
- lib/calabash/lib/skeleton/Gemfile
|
494
|
+
- lib/calabash/lib/skeleton/config/cucumber.yml
|
495
|
+
- lib/calabash/lib/skeleton/features/sample.feature
|
496
|
+
- lib/calabash/lib/skeleton/features/step_definitions/calabash_steps.rb
|
497
|
+
- lib/calabash/lib/skeleton/features/support/dry_run.rb
|
498
|
+
- lib/calabash/lib/skeleton/features/support/env.rb
|
499
|
+
- lib/calabash/lib/skeleton/features/support/hooks.rb
|
509
500
|
- lib/calabash/life_cycle.rb
|
510
501
|
- lib/calabash/location.rb
|
511
502
|
- lib/calabash/logger.rb
|
@@ -515,15 +506,12 @@ files:
|
|
515
506
|
- lib/calabash/patch/array.rb
|
516
507
|
- lib/calabash/query.rb
|
517
508
|
- lib/calabash/query_result.rb
|
518
|
-
- lib/calabash/retry.rb
|
519
509
|
- lib/calabash/screenshot.rb
|
520
510
|
- lib/calabash/server.rb
|
521
|
-
- lib/calabash/stubs.rb
|
522
511
|
- lib/calabash/text.rb
|
523
512
|
- lib/calabash/utility.rb
|
524
513
|
- lib/calabash/version.rb
|
525
514
|
- lib/calabash/wait.rb
|
526
|
-
- lib/calabash/web.rb
|
527
515
|
homepage: https://xamarin.com/test-cloud
|
528
516
|
licenses:
|
529
517
|
- EPL-1.0
|
@@ -544,8 +532,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
544
532
|
version: 1.3.1
|
545
533
|
requirements: []
|
546
534
|
rubyforge_project:
|
547
|
-
rubygems_version: 2.5.1
|
535
|
+
rubygems_version: 2.4.5.1
|
548
536
|
signing_key:
|
549
537
|
specification_version: 4
|
550
538
|
summary: Automated Acceptance Testing for Mobile Apps
|
551
539
|
test_files: []
|
540
|
+
has_rdoc:
|
@@ -1,95 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
module Calabash
|
4
|
-
module Android
|
5
|
-
class Device
|
6
|
-
module HelperApplication
|
7
|
-
def ensure_helper_application_started
|
8
|
-
unless $_calabash_helper_application_started
|
9
|
-
$stdout.puts "NEW DEBUG: IN HERE"
|
10
|
-
$stdout.puts "NEW DEBUG: INSTALLING"
|
11
|
-
install_helper_application
|
12
|
-
$stdout.puts "NEW DEBUG: STARTING"
|
13
|
-
begin
|
14
|
-
start_helper_application
|
15
|
-
rescue => e
|
16
|
-
$stdout.puts "NEW DEBUG EXCERPICON: #{e.backtrace.join("\n")}"
|
17
|
-
raise e
|
18
|
-
end
|
19
|
-
|
20
|
-
$stdout.puts "NEW DEBUG: DONE STARTING"
|
21
|
-
$_calabash_helper_application_started = true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def helper_application_server
|
26
|
-
Calabash::Android::Server.default_helper
|
27
|
-
end
|
28
|
-
|
29
|
-
def helper_application
|
30
|
-
Calabash::Android::Application.new(Calabash::Android::HELPER_APPLICATION,
|
31
|
-
Calabash::Android::HELPER_APPLICATION_TEST_SERVER)
|
32
|
-
end
|
33
|
-
|
34
|
-
def helper_application_http_client
|
35
|
-
@helper_application_http_client ||= lambda do
|
36
|
-
server = Calabash::HTTP::RetriableClient.new(helper_application_server)
|
37
|
-
port_forward(helper_application_server.endpoint, helper_application_server.test_server_port)
|
38
|
-
|
39
|
-
server.on_error(Errno::ECONNREFUSED) do |s|
|
40
|
-
port_forward(s.endpoint.port, s.test_server_port)
|
41
|
-
end
|
42
|
-
|
43
|
-
server
|
44
|
-
end.call
|
45
|
-
end
|
46
|
-
|
47
|
-
# @!visibility private
|
48
|
-
def install_helper_application
|
49
|
-
begin
|
50
|
-
@logger.log "Ensuring helper application is installed"
|
51
|
-
ensure_app_installed(helper_application)
|
52
|
-
rescue => e
|
53
|
-
@logger.log("Unable to install helper application!", :error)
|
54
|
-
raise e
|
55
|
-
end
|
56
|
-
|
57
|
-
$_calabash_helper_application_installed = true
|
58
|
-
end
|
59
|
-
|
60
|
-
# @!visibility private
|
61
|
-
def has_installed_helper_application?
|
62
|
-
$_calabash_helper_application_installed
|
63
|
-
end
|
64
|
-
|
65
|
-
# @!visibility private
|
66
|
-
def helper_application_responding?
|
67
|
-
begin
|
68
|
-
helper_application_http_client.post(HTTP::Request.new('ping'), retries: 1).body == 'pong'
|
69
|
-
rescue HTTP::Error => e
|
70
|
-
$stdout.puts "SH NEW DEBUG: PING ERROR #{e.backtrace.join("\n")}"
|
71
|
-
false
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def start_helper_application
|
76
|
-
cmd = ["am start",
|
77
|
-
"-e testServerPort 0",
|
78
|
-
"-e port 8081",
|
79
|
-
"sh.calaba.calabashhelper/sh.calaba.calabashhelper.MainActivity"].join(" ")
|
80
|
-
|
81
|
-
adb.shell(cmd)
|
82
|
-
|
83
|
-
100.times do |i|
|
84
|
-
if i == 99
|
85
|
-
raise "Unable to start helper application"
|
86
|
-
end
|
87
|
-
|
88
|
-
break if helper_application_responding?
|
89
|
-
sleep 1
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
Binary file
|
Binary file
|
data/lib/calabash/android/web.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
module Calabash
|
2
|
-
module Android
|
3
|
-
module Web
|
4
|
-
# @!visibility private
|
5
|
-
define_method(:_evaluate_javascript_in) do |query, javascript|
|
6
|
-
Calabash::Internal.with_default_device(required_os: :android) do |device|
|
7
|
-
device.evaluate_javascript_in(query, javascript)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Calabash
|
2
|
-
module HTTP
|
3
|
-
class ForwardingClient
|
4
|
-
HEADER_FORWARD = 'X-FORWARD-PORT'
|
5
|
-
ROUTES = [:get, :post, :put, :delete]
|
6
|
-
|
7
|
-
def initialize(client, forward_to_port)
|
8
|
-
@client = client
|
9
|
-
@forward_to_port = forward_to_port
|
10
|
-
end
|
11
|
-
|
12
|
-
ROUTES.each do |route|
|
13
|
-
define_method(route) do |request, options = {}|
|
14
|
-
new_options = options.clone
|
15
|
-
new_options[:header] ||= {}
|
16
|
-
new_options[:header][HEADER_FORWARD] = @forward_to_port.to_s
|
17
|
-
|
18
|
-
@client.send(route, request, new_options)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/lib/calabash/internal.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
module Calabash
|
2
|
-
# @!visibility private
|
3
|
-
# Internal usage, NOT a public API
|
4
|
-
module Internal
|
5
|
-
def self.with_default_device(required_os: nil, &block)
|
6
|
-
unless block
|
7
|
-
raise ArgumentError, "No block given"
|
8
|
-
end
|
9
|
-
|
10
|
-
device = Calabash.default_device
|
11
|
-
|
12
|
-
if device.nil?
|
13
|
-
raise "The default device is not set. Set it using Calabash.default_device = ..."
|
14
|
-
end
|
15
|
-
|
16
|
-
if required_os
|
17
|
-
required_class = nil
|
18
|
-
required_type = nil
|
19
|
-
current_type = nil
|
20
|
-
|
21
|
-
case required_os
|
22
|
-
when :ios
|
23
|
-
required_class = Calabash::IOS::Device
|
24
|
-
required_type = 'iOS'
|
25
|
-
when :android
|
26
|
-
required_class = Calabash::Android::Device
|
27
|
-
required_type = 'Android'
|
28
|
-
else
|
29
|
-
raise ArgumentError, "Unknown OS '#{required_os}'"
|
30
|
-
end
|
31
|
-
|
32
|
-
if Calabash::Android.const_defined?(:Device, false) && device.is_a?(Calabash::Android::Device)
|
33
|
-
current_type = 'Android'
|
34
|
-
elsif Calabash::IOS.const_defined?(:Device, false) && device.is_a?(Calabash::IOS::Device)
|
35
|
-
current_type = 'iOS'
|
36
|
-
else
|
37
|
-
current_type = 'unknown'
|
38
|
-
end
|
39
|
-
|
40
|
-
unless device.is_a?(required_class)
|
41
|
-
raise "The default device is not set to an #{required_type} device, it is an #{current_type} device."
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
block.call(device)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|