calabash 2.0.0.pre10 → 2.0.0.pre11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -17
- data/bin/calabash +3 -4
- data/lib/calabash.rb +53 -10
- data/lib/calabash/android.rb +89 -28
- data/lib/calabash/android/adb.rb +32 -20
- 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 +22 -66
- data/lib/calabash/android/device/helper_application.rb +95 -0
- data/lib/calabash/android/environment.rb +14 -1
- data/lib/calabash/android/gestures.rb +6 -22
- data/lib/calabash/android/interactions.rb +14 -17
- data/lib/calabash/android/lib/.irbrc +9 -1
- data/lib/calabash/android/lib/AndroidManifest.xml +23 -2
- data/lib/calabash/android/lib/HelperApplication.apk +0 -0
- data/lib/calabash/android/lib/HelperApplicationTestServer.apk +0 -0
- 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 +19 -16
- data/lib/calabash/android/server.rb +1 -1
- data/lib/calabash/android/text.rb +12 -12
- data/lib/calabash/android/web.rb +12 -0
- data/lib/calabash/application.rb +3 -0
- data/lib/calabash/cli/generate.rb +8 -18
- data/lib/calabash/cli/helpers.rb +4 -9
- data/lib/calabash/cli/run.rb +1 -1
- data/lib/calabash/console_helpers.rb +179 -11
- data/lib/calabash/device.rb +4 -19
- data/lib/calabash/gestures.rb +292 -198
- data/lib/calabash/interactions.rb +3 -40
- data/lib/calabash/internal.rb +48 -0
- data/lib/calabash/ios.rb +76 -16
- data/lib/calabash/ios/automator.rb +9 -0
- data/lib/calabash/ios/automator/automator.rb +217 -0
- data/lib/calabash/ios/automator/coordinates.rb +37 -0
- data/lib/calabash/ios/automator/device_agent.rb +379 -0
- data/lib/calabash/ios/conditions.rb +1 -1
- data/lib/calabash/ios/console_helpers.rb +2 -2
- data/lib/calabash/ios/date_picker.rb +10 -8
- data/lib/calabash/ios/device.rb +0 -1
- data/lib/calabash/ios/device/device_implementation.rb +9 -21
- data/lib/calabash/ios/device/gestures_mixin.rb +53 -55
- data/lib/calabash/ios/device/keyboard_mixin.rb +21 -0
- data/lib/calabash/ios/device/rotation_mixin.rb +3 -65
- data/lib/calabash/ios/gestures.rb +24 -90
- data/lib/calabash/ios/interactions.rb +1 -6
- data/lib/calabash/ios/lib/.irbrc +9 -2
- data/lib/calabash/ios/orientation.rb +8 -8
- data/lib/calabash/ios/runtime.rb +14 -14
- data/lib/calabash/ios/scroll.rb +25 -17
- data/lib/calabash/ios/slider.rb +11 -18
- data/lib/calabash/ios/text.rb +20 -74
- data/lib/calabash/ios/uia.rb +1 -1
- data/lib/calabash/ios/web.rb +10 -0
- data/lib/calabash/lib/skeleton/{Gemfile → Gemfile.skeleton} +0 -0
- data/lib/calabash/lib/skeleton/config/{cucumber.yml → cucumber.yml.skeleton} +0 -0
- data/lib/calabash/lib/skeleton/features/{sample.feature → sample.feature.skeleton} +0 -0
- data/lib/calabash/lib/skeleton/features/step_definitions/{calabash_steps.rb → sample_steps.rb.skeleton} +8 -8
- data/lib/calabash/lib/skeleton/features/support/{dry_run.rb → dry_run.rb.skeleton} +2 -5
- data/lib/calabash/lib/skeleton/features/support/{env.rb → env.rb.skeleton} +2 -8
- data/lib/calabash/lib/skeleton/features/support/hooks.rb.skeleton +34 -0
- data/lib/calabash/life_cycle.rb +16 -8
- data/lib/calabash/location.rb +14 -15
- data/lib/calabash/orientation.rb +8 -8
- data/lib/calabash/page.rb +1 -4
- data/lib/calabash/retry.rb +33 -0
- data/lib/calabash/screenshot.rb +3 -3
- data/lib/calabash/stubs.rb +21 -0
- data/lib/calabash/text.rb +31 -19
- data/lib/calabash/utility.rb +41 -8
- data/lib/calabash/version.rb +1 -1
- data/lib/calabash/wait.rb +177 -192
- data/lib/calabash/web.rb +44 -0
- metadata +39 -32
- data/lib/calabash/ios/device/text_mixin.rb +0 -21
- data/lib/calabash/lib/skeleton/features/support/hooks.rb +0 -83
data/lib/calabash/web.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module Calabash
|
2
|
+
module Web
|
3
|
+
# Evaluate javascript in a Web View. On iOS, an implicit return is
|
4
|
+
# inserted, on Android an explicit return is needed.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
# # iOS
|
8
|
+
# cal.evaluate_javascript_in("UIWebView", "2+2")
|
9
|
+
#
|
10
|
+
# # Android
|
11
|
+
# cal.evaluate_javascript_in("WebView", "return 2+2")
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# # iOS
|
15
|
+
# cal.evaluate_javascript_in("WKWebView",
|
16
|
+
# "document.body.style.backgroundColor = 'red';")
|
17
|
+
#
|
18
|
+
# # Android
|
19
|
+
# cal.evaluate_javascript_in("XWalkContent",
|
20
|
+
# "document.body.style.backgroundColor = 'red';")
|
21
|
+
#
|
22
|
+
# @note No error will be raised if the javascript given is invalid, or
|
23
|
+
# throws an exception.
|
24
|
+
#
|
25
|
+
# @param [String, Hash, Calabash::Query] query Query that matches the
|
26
|
+
# webview
|
27
|
+
# @param [String] javascript The javascript to evaluate
|
28
|
+
#
|
29
|
+
# @raise ViewNotFoundError If no views are found matching `query`
|
30
|
+
def evaluate_javascript_in(query, javascript)
|
31
|
+
wait_for_view(query,
|
32
|
+
timeout: Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT)
|
33
|
+
|
34
|
+
_evaluate_javascript_in(query, javascript)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
# @!visibility private
|
40
|
+
define_method(:_evaluate_javascript_in) do |query, javascript|
|
41
|
+
abstract_method!
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,16 @@
|
|
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.pre11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Jonas Maturana Larsen
|
8
7
|
- Karl Krukow
|
9
8
|
- Tobias Røikjer
|
10
9
|
- Joshua Moody
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2016-
|
13
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: edn
|
@@ -93,7 +92,7 @@ dependencies:
|
|
93
92
|
requirements:
|
94
93
|
- - ">="
|
95
94
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2.
|
95
|
+
version: 2.2.2
|
97
96
|
- - "<"
|
98
97
|
- !ruby/object:Gem::Version
|
99
98
|
version: '3.0'
|
@@ -103,7 +102,7 @@ dependencies:
|
|
103
102
|
requirements:
|
104
103
|
- - ">="
|
105
104
|
- !ruby/object:Gem::Version
|
106
|
-
version: 2.
|
105
|
+
version: 2.2.2
|
107
106
|
- - "<"
|
108
107
|
- !ruby/object:Gem::Version
|
109
108
|
version: '3.0'
|
@@ -239,20 +238,6 @@ dependencies:
|
|
239
238
|
- - ">="
|
240
239
|
- !ruby/object:Gem::Version
|
241
240
|
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'
|
256
241
|
- !ruby/object:Gem::Dependency
|
257
242
|
name: pry
|
258
243
|
requirement: !ruby/object:Gem::Requirement
|
@@ -323,6 +308,20 @@ dependencies:
|
|
323
308
|
- - ">="
|
324
309
|
- !ruby/object:Gem::Version
|
325
310
|
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
|
326
325
|
- !ruby/object:Gem::Dependency
|
327
326
|
name: growl
|
328
327
|
requirement: !ruby/object:Gem::Requirement
|
@@ -352,13 +351,12 @@ dependencies:
|
|
352
351
|
- !ruby/object:Gem::Version
|
353
352
|
version: '0'
|
354
353
|
description: |-
|
355
|
-
Calabash is a
|
356
|
-
|
354
|
+
Calabash is a mobile automation tool used for automatic UI-testing.
|
355
|
+
It supports Android and iOS, both native and hybrid app testing.
|
357
356
|
|
358
357
|
It is developed and maintained by Xamarin and is released under the Eclipse
|
359
358
|
Public License.
|
360
359
|
email:
|
361
|
-
- jonaspec.larsen@xamarin.com
|
362
360
|
- karl.krukow@xamarin.com
|
363
361
|
- tobias.roikjer@xamarin.com
|
364
362
|
- joshua.moody@xamarin.com
|
@@ -386,6 +384,7 @@ files:
|
|
386
384
|
- lib/calabash/android/console_helpers.rb
|
387
385
|
- lib/calabash/android/defaults.rb
|
388
386
|
- lib/calabash/android/device.rb
|
387
|
+
- lib/calabash/android/device/helper_application.rb
|
389
388
|
- lib/calabash/android/environment.rb
|
390
389
|
- lib/calabash/android/gestures.rb
|
391
390
|
- lib/calabash/android/interactions.rb
|
@@ -417,6 +416,7 @@ files:
|
|
417
416
|
- lib/calabash/android/scroll.rb
|
418
417
|
- lib/calabash/android/server.rb
|
419
418
|
- lib/calabash/android/text.rb
|
419
|
+
- lib/calabash/android/web.rb
|
420
420
|
- lib/calabash/application.rb
|
421
421
|
- lib/calabash/cli.rb
|
422
422
|
- lib/calabash/cli/build.rb
|
@@ -438,8 +438,13 @@ files:
|
|
438
438
|
- lib/calabash/http/request.rb
|
439
439
|
- lib/calabash/http/retriable_client.rb
|
440
440
|
- lib/calabash/interactions.rb
|
441
|
+
- lib/calabash/internal.rb
|
441
442
|
- lib/calabash/ios.rb
|
442
443
|
- 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
|
443
448
|
- lib/calabash/ios/conditions.rb
|
444
449
|
- lib/calabash/ios/console_helpers.rb
|
445
450
|
- lib/calabash/ios/date_picker.rb
|
@@ -461,7 +466,6 @@ files:
|
|
461
466
|
- lib/calabash/ios/device/routes/uia_route_mixin.rb
|
462
467
|
- lib/calabash/ios/device/runtime_attributes.rb
|
463
468
|
- lib/calabash/ios/device/status_bar_mixin.rb
|
464
|
-
- lib/calabash/ios/device/text_mixin.rb
|
465
469
|
- lib/calabash/ios/device/uia_keyboard_mixin.rb
|
466
470
|
- lib/calabash/ios/device/uia_mixin.rb
|
467
471
|
- lib/calabash/ios/environment.rb
|
@@ -492,15 +496,16 @@ files:
|
|
492
496
|
- lib/calabash/ios/slider.rb
|
493
497
|
- lib/calabash/ios/text.rb
|
494
498
|
- lib/calabash/ios/uia.rb
|
499
|
+
- lib/calabash/ios/web.rb
|
495
500
|
- lib/calabash/legacy.rb
|
496
501
|
- lib/calabash/lib/skeleton/.gitignore
|
497
|
-
- lib/calabash/lib/skeleton/Gemfile
|
498
|
-
- lib/calabash/lib/skeleton/config/cucumber.yml
|
499
|
-
- lib/calabash/lib/skeleton/features/sample.feature
|
500
|
-
- lib/calabash/lib/skeleton/features/step_definitions/
|
501
|
-
- lib/calabash/lib/skeleton/features/support/dry_run.rb
|
502
|
-
- lib/calabash/lib/skeleton/features/support/env.rb
|
503
|
-
- lib/calabash/lib/skeleton/features/support/hooks.rb
|
502
|
+
- lib/calabash/lib/skeleton/Gemfile.skeleton
|
503
|
+
- lib/calabash/lib/skeleton/config/cucumber.yml.skeleton
|
504
|
+
- lib/calabash/lib/skeleton/features/sample.feature.skeleton
|
505
|
+
- lib/calabash/lib/skeleton/features/step_definitions/sample_steps.rb.skeleton
|
506
|
+
- lib/calabash/lib/skeleton/features/support/dry_run.rb.skeleton
|
507
|
+
- lib/calabash/lib/skeleton/features/support/env.rb.skeleton
|
508
|
+
- lib/calabash/lib/skeleton/features/support/hooks.rb.skeleton
|
504
509
|
- lib/calabash/life_cycle.rb
|
505
510
|
- lib/calabash/location.rb
|
506
511
|
- lib/calabash/logger.rb
|
@@ -510,12 +515,15 @@ files:
|
|
510
515
|
- lib/calabash/patch/array.rb
|
511
516
|
- lib/calabash/query.rb
|
512
517
|
- lib/calabash/query_result.rb
|
518
|
+
- lib/calabash/retry.rb
|
513
519
|
- lib/calabash/screenshot.rb
|
514
520
|
- lib/calabash/server.rb
|
521
|
+
- lib/calabash/stubs.rb
|
515
522
|
- lib/calabash/text.rb
|
516
523
|
- lib/calabash/utility.rb
|
517
524
|
- lib/calabash/version.rb
|
518
525
|
- lib/calabash/wait.rb
|
526
|
+
- lib/calabash/web.rb
|
519
527
|
homepage: https://xamarin.com/test-cloud
|
520
528
|
licenses:
|
521
529
|
- EPL-1.0
|
@@ -536,9 +544,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
536
544
|
version: 1.3.1
|
537
545
|
requirements: []
|
538
546
|
rubyforge_project:
|
539
|
-
rubygems_version: 2.
|
547
|
+
rubygems_version: 2.5.1
|
540
548
|
signing_key:
|
541
549
|
specification_version: 4
|
542
550
|
summary: Automated Acceptance Testing for Mobile Apps
|
543
551
|
test_files: []
|
544
|
-
has_rdoc:
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Calabash
|
2
|
-
module IOS
|
3
|
-
# @!visibility private
|
4
|
-
module TextMixin
|
5
|
-
|
6
|
-
# @!visibility private
|
7
|
-
def enter_text(text)
|
8
|
-
wait_for_keyboard(Calabash::Wait.default_options[:timeout])
|
9
|
-
existing_text = text_from_keyboard_first_responder
|
10
|
-
options = { existing_text: existing_text }
|
11
|
-
uia_type_string(text, options)
|
12
|
-
end
|
13
|
-
|
14
|
-
# @!visibility private
|
15
|
-
def _enter_text_in(query, text)
|
16
|
-
_tap(query)
|
17
|
-
enter_text(text)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'calabash'
|
2
|
-
|
3
|
-
Before do |scenario|
|
4
|
-
if scenario.respond_to?(:scenario_outline)
|
5
|
-
scenario = scenario.scenario_outline
|
6
|
-
end
|
7
|
-
|
8
|
-
AppLifeCycle.on_new_scenario(scenario)
|
9
|
-
|
10
|
-
start_app
|
11
|
-
end
|
12
|
-
|
13
|
-
After do
|
14
|
-
stop_app
|
15
|
-
end
|
16
|
-
|
17
|
-
module AppLifeCycle
|
18
|
-
# Since this is a module, the methods in the Cucumber World are not
|
19
|
-
# available inside the scope of this module. We can safely include Calabash
|
20
|
-
# because we will not affect the scope outside this module. The methods are
|
21
|
-
# loaded as class (static) methods.
|
22
|
-
class << self
|
23
|
-
include Calabash
|
24
|
-
end
|
25
|
-
|
26
|
-
DEFAULT_RESET_BETWEEN = #!DEFAULT_RESET_BETWEEN#! # Filled in by calabash generate
|
27
|
-
DEFAULT_RESET_METHOD = #!DEFAULT_RESET_METHOD#! # Filled in by calabash generate
|
28
|
-
|
29
|
-
RESET_BETWEEN = if Calabash::Environment.variable('RESET_BETWEEN')
|
30
|
-
Calabash::Environment.variable('RESET_BETWEEN').downcase.to_sym
|
31
|
-
else
|
32
|
-
DEFAULT_RESET_BETWEEN
|
33
|
-
end
|
34
|
-
|
35
|
-
RESET_METHOD = if Calabash::Environment.variable('RESET_METHOD')
|
36
|
-
Calabash::Environment.variable('RESET_METHOD').downcase.to_sym
|
37
|
-
else
|
38
|
-
DEFAULT_RESET_METHOD
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.on_new_scenario(scenario)
|
42
|
-
# Ensure the app is installed at the beginning of the test,
|
43
|
-
# if we never reset
|
44
|
-
if @last_feature.nil? && RESET_BETWEEN == :never
|
45
|
-
ensure_app_installed
|
46
|
-
end
|
47
|
-
|
48
|
-
if should_reset?(scenario)
|
49
|
-
reset
|
50
|
-
end
|
51
|
-
|
52
|
-
@last_feature = scenario.feature
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
|
57
|
-
def self.should_reset?(scenario)
|
58
|
-
case RESET_BETWEEN
|
59
|
-
when :scenarios
|
60
|
-
true
|
61
|
-
when :features
|
62
|
-
scenario.feature != @last_feature
|
63
|
-
when :never
|
64
|
-
false
|
65
|
-
else
|
66
|
-
raise "Invalid reset between option '#{RESET_BETWEEN}'"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.reset
|
71
|
-
case RESET_METHOD
|
72
|
-
when :reinstall
|
73
|
-
install_app
|
74
|
-
when :clear
|
75
|
-
ensure_app_installed
|
76
|
-
clear_app_data
|
77
|
-
when '', nil
|
78
|
-
raise 'No reset method given'
|
79
|
-
else
|
80
|
-
raise "Invalid reset method '#{RESET_METHOD}'"
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|