cs-bdd 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Rakefile +1 -2
- data/bin/cs-bdd +61 -20
- data/bin/cs-bdd-helpers.rb +39 -30
- data/cs-bdd.gemspec +13 -14
- data/lib/cs/bdd.rb +2 -1
- data/lib/cs/bdd/locales/pt.yml +1 -1
- data/lib/cs/bdd/version.rb +1 -1
- data/lib/skeleton/.gitignore +1 -0
- data/lib/skeleton/Gemfile +6 -7
- data/lib/skeleton/config/load_classes.rb +19 -0
- data/lib/skeleton/config/scripts/check_if_tests_failed.sh +3 -5
- data/lib/skeleton/config/scripts/ios/run_tests_all_devices.sh +1 -1
- data/lib/skeleton/features/android/support/app_installation_hooks.rb +16 -17
- data/lib/skeleton/features/android/support/app_life_cycle_hooks.rb +3 -5
- data/lib/skeleton/features/ios/support/01_launch.rb +17 -104
- data/lib/skeleton/features/support/env.rb +2 -2
- data/lib/templates/android_screen_base.tt +50 -38
- data/lib/templates/ios_screen_base.tt +77 -79
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 083aada0c6d56dc360cb8d8edc5e4b22051ce66d
|
4
|
+
data.tar.gz: e1dae588adee75ca80bbe0561dfb97cf5c9996ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00cd5a0d3823e74a8e608bf0640d54bfc318a23113e6b2e182984800d1e54afe1c63921c010bb0cee1e6ecc46c10c15cc7ddc18e07597b29ad3ad7fa1d0abf8e
|
7
|
+
data.tar.gz: 3a9c49162395cd0cc3519022aa07cdfa6f56e549e778e908010df6bbc66230d0434f5e0997c25c8c1fe996e71af58ad9b38d79e25a0b1b3a08635942e27ab226
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/cs-bdd
CHANGED
@@ -17,7 +17,9 @@ module CS
|
|
17
17
|
include Thor::Actions
|
18
18
|
|
19
19
|
desc 'feature [RESOURCE_NAME]', 'Generates an OS independent feature'
|
20
|
-
option :lang,
|
20
|
+
option :lang,
|
21
|
+
banner: 'any of the gherkin supported languages',
|
22
|
+
default: :en
|
21
23
|
def feature(name)
|
22
24
|
I18n.config.default_locale = options[:lang]
|
23
25
|
in_root_project_folder?
|
@@ -29,7 +31,9 @@ module CS
|
|
29
31
|
end
|
30
32
|
|
31
33
|
desc 'aFeature [RESOURCE_NAME]', 'Generates an Android dependent feature'
|
32
|
-
option :lang,
|
34
|
+
option :lang,
|
35
|
+
banner: 'any of the gherkin supported languages',
|
36
|
+
default: :en
|
33
37
|
def aFeature(name)
|
34
38
|
I18n.config.default_locale = options[:lang]
|
35
39
|
in_root_project_folder?
|
@@ -40,7 +44,9 @@ module CS
|
|
40
44
|
end
|
41
45
|
|
42
46
|
desc 'iFeature [RESOURCE_NAME]', 'Generates an iOS dependent feature'
|
43
|
-
option :lang,
|
47
|
+
option :lang,
|
48
|
+
banner: 'any of the gherkin supported languages',
|
49
|
+
default: :en
|
44
50
|
def iFeature(name)
|
45
51
|
I18n.config.default_locale = options[:lang]
|
46
52
|
in_root_project_folder?
|
@@ -51,7 +57,9 @@ module CS
|
|
51
57
|
end
|
52
58
|
|
53
59
|
desc 'step [RESOURCE_NAME]', 'Generates an OS independent step'
|
54
|
-
option :lang,
|
60
|
+
option :lang,
|
61
|
+
banner: 'any of the gherkin supported languages',
|
62
|
+
default: :en
|
55
63
|
def step(name)
|
56
64
|
I18n.config.default_locale = options[:lang]
|
57
65
|
in_root_project_folder?
|
@@ -59,7 +67,9 @@ module CS
|
|
59
67
|
end
|
60
68
|
|
61
69
|
desc 'aStep [RESOURCE_NAME]', 'Generates an Android dependent step'
|
62
|
-
option :lang,
|
70
|
+
option :lang,
|
71
|
+
banner: 'any of the gherkin supported languages',
|
72
|
+
default: :en
|
63
73
|
def aStep(name)
|
64
74
|
I18n.config.default_locale = options[:lang]
|
65
75
|
in_root_project_folder?
|
@@ -67,15 +77,20 @@ module CS
|
|
67
77
|
end
|
68
78
|
|
69
79
|
desc 'iStep [RESOURCE_NAME]', 'Generates an iOS dependent step'
|
70
|
-
option :lang,
|
80
|
+
option :lang,
|
81
|
+
banner: 'any of the gherkin supported languages',
|
82
|
+
default: :en
|
71
83
|
def iStep(name)
|
72
84
|
I18n.config.default_locale = options[:lang]
|
73
85
|
in_root_project_folder?
|
74
86
|
create_steps_file name, 'IOS'
|
75
87
|
end
|
76
88
|
|
77
|
-
desc 'screen [RESOURCE_NAME]',
|
78
|
-
|
89
|
+
desc 'screen [RESOURCE_NAME]',
|
90
|
+
'Generates the Android and iOS dependent screens'
|
91
|
+
option :lang,
|
92
|
+
banner: 'any of the gherkin supported languages',
|
93
|
+
default: :en
|
79
94
|
def screen(name)
|
80
95
|
I18n.config.default_locale = options[:lang]
|
81
96
|
in_root_project_folder?
|
@@ -84,7 +99,9 @@ module CS
|
|
84
99
|
end
|
85
100
|
|
86
101
|
desc 'aScreen [RESOURCE_NAME]', 'Generates an Android dependent screen'
|
87
|
-
option :lang,
|
102
|
+
option :lang,
|
103
|
+
banner: 'any of the gherkin supported languages',
|
104
|
+
default: :en
|
88
105
|
def aScreen(name)
|
89
106
|
I18n.config.default_locale = options[:lang]
|
90
107
|
in_root_project_folder?
|
@@ -92,7 +109,9 @@ module CS
|
|
92
109
|
end
|
93
110
|
|
94
111
|
desc 'iScreen [RESOURCE_NAME]', 'Generates an iOS dependent screen'
|
95
|
-
option :lang,
|
112
|
+
option :lang,
|
113
|
+
banner: 'any of the gherkin supported languages',
|
114
|
+
default: :en
|
96
115
|
def iScreen(name)
|
97
116
|
I18n.config.default_locale = options[:lang]
|
98
117
|
in_root_project_folder?
|
@@ -117,12 +136,20 @@ module CS
|
|
117
136
|
|
118
137
|
default_task :help
|
119
138
|
|
120
|
-
register CS::BDD::Generate, 'generate',
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
139
|
+
register CS::BDD::Generate, 'generate',
|
140
|
+
'generate [GENERATOR] [RESOURCE_NAME]',
|
141
|
+
'Generates various resources'
|
142
|
+
register CS::BDD::Generate, 'g',
|
143
|
+
'g [GENERATOR] [RESOURCE_NAME]',
|
144
|
+
'Generates various resources'
|
145
|
+
|
146
|
+
desc 'new PROJECT_NAME',
|
147
|
+
'Generates the structure of a new project that uses '\
|
148
|
+
'Calabash in both Android and iOS apps'
|
149
|
+
option :lang,
|
150
|
+
banner: 'any of the gherkin supported languages',
|
151
|
+
default: :en
|
152
|
+
def new(name)
|
126
153
|
I18n.config.default_locale = options[:lang]
|
127
154
|
# Thor will be responsible to look for identical
|
128
155
|
# files and possibles conflicts
|
@@ -156,18 +183,32 @@ module CS
|
|
156
183
|
def initialize(*args)
|
157
184
|
super
|
158
185
|
# Loading gherkin accepted translations
|
159
|
-
translations_file_path = File.join(
|
186
|
+
translations_file_path = File.join(
|
187
|
+
Gem.loaded_specs['gherkin'].full_gem_path,
|
188
|
+
'lib',
|
189
|
+
'gherkin',
|
190
|
+
'i18n.json'
|
191
|
+
)
|
160
192
|
# Parsing the JSON file
|
161
193
|
# Removing the sequence *| and all the alternative
|
162
194
|
# options for the gherkin translations
|
163
|
-
translations_json = JSON.parse(
|
195
|
+
translations_json = JSON.parse(
|
196
|
+
File.read(translations_file_path)
|
197
|
+
.gsub(/\*\|/, '')
|
198
|
+
.gsub(/\|.*\"/, '"'))
|
164
199
|
# Converting the translations to YAML and storing in a temp file
|
165
200
|
translations_temp_file = Tempfile.new(['translations', '.yml'])
|
166
201
|
File.write(translations_temp_file, translations_json.to_yaml)
|
167
202
|
# Loading the translations from gherkin and from the
|
168
203
|
# locales folder of this gem
|
169
|
-
locales_folder_path = File.join(
|
170
|
-
|
204
|
+
locales_folder_path = File.join(
|
205
|
+
File.dirname(__FILE__),
|
206
|
+
'..', 'lib', 'cs', 'bdd', 'locales'
|
207
|
+
)
|
208
|
+
I18n.load_path = Dir[
|
209
|
+
translations_temp_file,
|
210
|
+
File.join(locales_folder_path, '*.yml')
|
211
|
+
]
|
171
212
|
I18n.backend.load_translations
|
172
213
|
I18n.config.enforce_available_locales = true
|
173
214
|
end
|
data/bin/cs-bdd-helpers.rb
CHANGED
@@ -1,68 +1,77 @@
|
|
1
|
-
def create_feature_file
|
2
|
-
|
1
|
+
def create_feature_file(name, platform = nil)
|
3
2
|
# options used to generate the file in the template function
|
4
|
-
opts = {:
|
3
|
+
opts = { name: camelize(name) }
|
5
4
|
|
6
5
|
# If platform is not nil than the feature is OS dependent
|
7
|
-
file_path =
|
6
|
+
file_path = ''
|
8
7
|
if platform.nil?
|
9
|
-
file_path = File.join(
|
10
|
-
opts[:platform] =
|
8
|
+
file_path = File.join(FileUtils.pwd, 'features', "#{name.downcase}.feature")
|
9
|
+
opts[:platform] = ''
|
11
10
|
else
|
12
|
-
file_path = File.join(
|
11
|
+
file_path = File.join(
|
12
|
+
FileUtils.pwd, 'features', platform.downcase, 'features',
|
13
|
+
"#{name.downcase}.feature"
|
14
|
+
)
|
13
15
|
opts[:platform] = platform
|
14
16
|
end
|
15
17
|
|
16
18
|
# Thor creates a file based on the templates/feature.tt template
|
17
|
-
template(
|
19
|
+
template('feature', file_path, opts)
|
18
20
|
end
|
19
21
|
|
20
|
-
def create_steps_file
|
21
|
-
|
22
|
+
def create_steps_file(name, platform = nil)
|
22
23
|
# options used to generate the file in the template function
|
23
|
-
opts = {:
|
24
|
+
opts = { name: camelize(name) }
|
24
25
|
|
25
26
|
# If platform is not nil than the step is OS dependent
|
26
27
|
file_path = nil
|
27
28
|
if platform.nil?
|
28
|
-
file_path = File.join(
|
29
|
-
|
29
|
+
file_path = File.join(
|
30
|
+
FileUtils.pwd, 'features', 'step_definitions',
|
31
|
+
"#{name.downcase}_steps.rb"
|
32
|
+
)
|
33
|
+
opts[:platform] = ''
|
30
34
|
else
|
31
|
-
file_path = File.join(
|
35
|
+
file_path = File.join(
|
36
|
+
FileUtils.pwd, 'features', platform.downcase, 'step_definitions',
|
37
|
+
"#{name.downcase}_steps.rb"
|
38
|
+
)
|
32
39
|
opts[:platform] = platform
|
33
40
|
end
|
34
41
|
|
35
42
|
# Thor creates a file based on the templates/steps.tt template
|
36
|
-
template(
|
43
|
+
template('steps', file_path, opts)
|
37
44
|
end
|
38
45
|
|
39
|
-
def create_screen_file
|
40
|
-
|
46
|
+
def create_screen_file(name, platform)
|
41
47
|
# options used to generate the file in the template function
|
42
|
-
opts = {:
|
48
|
+
opts = { name: camelize(name), platform: platform }
|
43
49
|
|
44
50
|
# Thor creates a file based on the templates/screen.tt template
|
45
|
-
template(
|
51
|
+
template('screen',
|
52
|
+
File.join(
|
53
|
+
FileUtils.pwd, 'features', platform.downcase, 'screens',
|
54
|
+
"#{name.downcase}_screen.rb"),
|
55
|
+
opts)
|
46
56
|
end
|
47
57
|
|
48
|
-
def camelize
|
58
|
+
def camelize(string)
|
59
|
+
camelized = ''
|
49
60
|
|
50
|
-
|
51
|
-
|
52
|
-
string.split("_").each do |s|
|
53
|
-
camelized = camelized + s.capitalize
|
61
|
+
string.split('_').each do |s|
|
62
|
+
camelized += s.capitalize
|
54
63
|
end
|
55
64
|
|
56
|
-
|
65
|
+
camelized
|
57
66
|
end
|
58
67
|
|
59
68
|
def in_root_project_folder?
|
60
69
|
# Looks if the user is in the root folder of the project
|
61
|
-
if !Dir.
|
62
|
-
!Dir.
|
63
|
-
puts
|
70
|
+
if !Dir.exist?(File.join(FileUtils.pwd, 'features', 'android', 'features')) ||
|
71
|
+
!Dir.exist?(File.join(FileUtils.pwd, 'features', 'ios', 'features'))
|
72
|
+
puts 'Please run this command on the root folder of the project'
|
64
73
|
exit 1
|
65
74
|
end
|
66
75
|
|
67
|
-
|
68
|
-
end
|
76
|
+
true
|
77
|
+
end
|
data/cs-bdd.gemspec
CHANGED
@@ -4,24 +4,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'cs/bdd/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'cs-bdd'
|
8
8
|
spec.version = CS::BDD::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
9
|
+
spec.authors = ['Oscar Tanner']
|
10
|
+
spec.email = ['oscar.tanner@concretesolutions.com.br']
|
11
|
+
spec.summary = 'Generates an android and iOS calabash project.'
|
12
12
|
spec.description = %q{A simple gem to generate all files needed in a project that will support Calabash for both Android and iOS.}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/CSOscarTanner/cs-bdd'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = [
|
17
|
+
spec.executables = ['cs-bdd']
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
20
|
-
|
21
|
-
spec.add_runtime_dependency "bundler", "~> 1.7"
|
22
|
-
spec.add_runtime_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_runtime_dependency "thor", "~> 0.19.1"
|
24
|
-
spec.add_runtime_dependency "i18n", "~> 0.6.11"
|
25
|
-
spec.add_runtime_dependency "gherkin", "~> 2.12.2"
|
19
|
+
spec.require_paths = ['lib']
|
26
20
|
|
21
|
+
spec.add_runtime_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_runtime_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_runtime_dependency 'thor', '~> 0.19.1'
|
24
|
+
spec.add_runtime_dependency 'i18n', '~> 0.6.11'
|
25
|
+
spec.add_runtime_dependency 'gherkin', '~> 2.12.2'
|
27
26
|
end
|
data/lib/cs/bdd.rb
CHANGED
data/lib/cs/bdd/locales/pt.yml
CHANGED
@@ -6,7 +6,7 @@ pt:
|
|
6
6
|
trait: "Identificador da tela"
|
7
7
|
insert_steps: "Insira os passos"
|
8
8
|
elements: "Declare todos os elementos da tela"
|
9
|
-
actions: "Declare todas as
|
9
|
+
actions: "Declare todas as acoes da tela"
|
10
10
|
steps:
|
11
11
|
drag_until: 'que Eu (?:arrastei|arrasto) a tela para (baixo|cima|esquerda|direita) até ver o elemento "(.*?)"'
|
12
12
|
page_contains: "que Eu estou em uma página que contem '(.*?)'"
|
data/lib/cs/bdd/version.rb
CHANGED
data/lib/skeleton/.gitignore
CHANGED
data/lib/skeleton/Gemfile
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# Gemfile to help setting up the initial development environment
|
2
|
-
source
|
2
|
+
source 'https://rubygems.org'
|
3
3
|
|
4
4
|
gem 'calabash-common', '~> 0.0.1'
|
5
|
-
gem 'calabash-android', '~> 0.5.
|
5
|
+
gem 'calabash-android', '~> 0.5.14'
|
6
6
|
|
7
7
|
# Gems that will only be used with the computer is a Mac
|
8
8
|
group :mac_os do
|
9
|
-
#
|
10
|
-
# that you need to update
|
11
|
-
# doing the update manually
|
12
|
-
gem 'calabash-cucumber', '~> 0.
|
9
|
+
# Remenber to fix the calabash-cucumber version. The update of this gem is
|
10
|
+
# a proccess that you need to update the Calabash Server on your iOS
|
11
|
+
# application code. So I suggest doing the update manually
|
12
|
+
gem 'calabash-cucumber', '~> 0.16.4'
|
13
13
|
gem 'cocoapods', '~> 0.35.0'
|
14
14
|
end
|
15
|
-
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Choosing the platform using the current context LOAD PATH
|
2
|
+
# and looking for the gems of calabash
|
3
|
+
platform = ''
|
4
|
+
$LOAD_PATH.each do |path|
|
5
|
+
platform = 'android' if path.include? 'calabash-android'
|
6
|
+
platform = 'ios' if path.include? 'calabash-cucumber'
|
7
|
+
end
|
8
|
+
|
9
|
+
platform_path = File.join(File.expand_path('.', Dir.pwd), 'features', platform)
|
10
|
+
|
11
|
+
# Loading all ruby files in the base screen path
|
12
|
+
Dir[File.join(platform_path, '*.rb')].each do |file|
|
13
|
+
load file
|
14
|
+
end
|
15
|
+
|
16
|
+
# Loading all screens files
|
17
|
+
Dir[File.join(platform_path, 'screens', '*.rb')].each do |screen|
|
18
|
+
load screen
|
19
|
+
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
# Looking for errors on the report files and returns an error
|
2
2
|
cd "$WORKSPACE/reports-cal"
|
3
|
-
|
3
|
+
|
4
|
+
export TESTS_RESULT="Ok"
|
4
5
|
for folder in *
|
5
6
|
do
|
6
|
-
if egrep '
|
7
|
+
if egrep '[0-9]+ failed' "$folder/reports.html"
|
7
8
|
then
|
8
|
-
[ "$TESTS_RESULT" == "Failed" ] && continue
|
9
|
-
export TESTS_RESULT="Ok"
|
10
|
-
else
|
11
9
|
export TESTS_RESULT="Failed"
|
12
10
|
fi
|
13
11
|
done
|
@@ -1,33 +1,32 @@
|
|
1
1
|
require 'calabash-android/management/app_installation'
|
2
2
|
|
3
|
-
AfterConfiguration do
|
3
|
+
AfterConfiguration do
|
4
4
|
FeatureNameMemory.feature_name = nil
|
5
5
|
end
|
6
6
|
|
7
|
-
Before('@reinstall') do
|
7
|
+
Before('@reinstall') do
|
8
8
|
uninstall_apps
|
9
|
-
install_app(ENV[
|
10
|
-
install_app(ENV[
|
9
|
+
install_app(ENV['TEST_APP_PATH'])
|
10
|
+
install_app(ENV['APP_PATH'])
|
11
11
|
end
|
12
12
|
|
13
13
|
Before do |scenario|
|
14
|
-
@scenario_is_outline =
|
15
|
-
|
16
|
-
|
17
|
-
end
|
14
|
+
@scenario_is_outline =
|
15
|
+
(scenario.class == Cucumber::Ast::OutlineTable::ExampleRow)
|
16
|
+
scenario = scenario.scenario_outline if @scenario_is_outline
|
18
17
|
|
19
18
|
feature_name = scenario.feature.title
|
20
|
-
if FeatureNameMemory.feature_name != feature_name
|
21
|
-
|
22
|
-
if ENV[
|
23
|
-
log
|
19
|
+
if FeatureNameMemory.feature_name != feature_name ||
|
20
|
+
ENV['RESET_BETWEEN_SCENARIOS'] == '1'
|
21
|
+
if ENV['RESET_BETWEEN_SCENARIOS'] == '1'
|
22
|
+
log 'New scenario - reinstalling apps'
|
24
23
|
else
|
25
|
-
log
|
24
|
+
log 'First scenario in feature - reinstalling apps'
|
26
25
|
end
|
27
|
-
|
26
|
+
|
28
27
|
uninstall_apps
|
29
|
-
install_app(ENV[
|
30
|
-
install_app(ENV[
|
28
|
+
install_app(ENV['TEST_APP_PATH'])
|
29
|
+
install_app(ENV['APP_PATH'])
|
31
30
|
|
32
31
|
FeatureNameMemory.feature_name = feature_name
|
33
32
|
FeatureNameMemory.invocation = 1
|
@@ -40,4 +39,4 @@ FeatureNameMemory = Class.new
|
|
40
39
|
class << FeatureNameMemory
|
41
40
|
@feature_name = nil
|
42
41
|
attr_accessor :feature_name, :invocation
|
43
|
-
end
|
42
|
+
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'calabash-android/management/adb'
|
2
2
|
require 'calabash-android/operations'
|
3
3
|
|
4
|
-
Before do
|
4
|
+
Before do
|
5
5
|
start_test_server_in_background
|
6
6
|
end
|
7
7
|
|
8
8
|
After do |scenario|
|
9
|
-
if scenario.failed?
|
10
|
-
screenshot_embed
|
11
|
-
end
|
9
|
+
screenshot_embed if scenario.failed?
|
12
10
|
shutdown_test_server
|
13
|
-
end
|
11
|
+
end
|
@@ -14,43 +14,34 @@
|
|
14
14
|
|
15
15
|
require 'calabash-cucumber/launcher'
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
# However the recommended approach is to let Calabash find the app itself
|
20
|
-
# or set the environment variable APP_BUNDLE_PATH
|
17
|
+
Before do |scenario|
|
18
|
+
@calabash_launcher = Calabash::Cucumber::Launcher.new
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
@scenario_is_outline =
|
21
|
+
(scenario.class == Cucumber::Ast::OutlineTable::ExampleRow)
|
22
|
+
scenario = scenario.scenario_outline if @scenario_is_outline
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
# Looks if is a new feature that will be executed
|
35
|
-
if ENV['FEATURE_NAME'] != scenario.feature.title # ENV['FEATURE_NAME'] is just an aux created to store the feature name
|
36
|
-
reinstall_app # always reinstall the app before a the execution of a new feature
|
24
|
+
scenario_tags = scenario.source_tag_names
|
25
|
+
# Resetting the app between scenarios
|
26
|
+
# ENV['FEATURE_NAME'] is just an aux created to store the feature name
|
27
|
+
if ENV['FEATURE_NAME'] != scenario.feature.title ||
|
28
|
+
ENV['RESET_BETWEEN_SCENARIOS'] == '1' ||
|
29
|
+
scenario_tags.include?('@reinstall')
|
30
|
+
|
31
|
+
@calabash_launcher.reset_app_jail
|
37
32
|
ENV['FEATURE_NAME'] = scenario.feature.title
|
38
|
-
end
|
33
|
+
end
|
39
34
|
|
40
|
-
@calabash_launcher = Calabash::Cucumber::Launcher.new
|
41
35
|
unless @calabash_launcher.calabash_no_launch?
|
42
|
-
@calabash_launcher.relaunch
|
36
|
+
@calabash_launcher.relaunch
|
43
37
|
@calabash_launcher.calabash_notify(self)
|
44
38
|
end
|
45
|
-
|
46
39
|
end
|
47
40
|
|
48
|
-
After do
|
41
|
+
After do
|
49
42
|
unless @calabash_launcher.calabash_no_stop?
|
50
43
|
calabash_exit
|
51
|
-
if @calabash_launcher.active?
|
52
|
-
@calabash_launcher.stop
|
53
|
-
end
|
44
|
+
@calabash_launcher.stop if @calabash_launcher.active?
|
54
45
|
end
|
55
46
|
end
|
56
47
|
|
@@ -60,81 +51,3 @@ at_exit do
|
|
60
51
|
launcher.simulator_launcher.stop unless launcher.calabash_no_stop?
|
61
52
|
end
|
62
53
|
end
|
63
|
-
|
64
|
-
# Install or reinstall the app on the device
|
65
|
-
def reinstall_app
|
66
|
-
|
67
|
-
if !is_simulator? ENV['DEVICE_TARGET']
|
68
|
-
|
69
|
-
system "echo 'Installing the app...'"
|
70
|
-
|
71
|
-
# Trying to reinstall the app
|
72
|
-
success = system "ios-deploy -r -b #{ENV['APP_BUNDLE_PATH']} -i #{ENV['DEVICE_TARGET']} -t 5 > /dev/null"
|
73
|
-
|
74
|
-
# If the app is not installed the above command will throw an error
|
75
|
-
# So we just install the app
|
76
|
-
if !success
|
77
|
-
success = system "ios-deploy -b #{ENV['APP_BUNDLE_PATH']} -i #{ENV['DEVICE_TARGET']} -t 5 > /dev/null"
|
78
|
-
if !success # If there is any error raises an exception
|
79
|
-
raise 'Error. Could not install the app.'
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
system "echo 'Installed.'"
|
84
|
-
|
85
|
-
sleep(3) # Gives to the iphone a time to finish the installation of the app
|
86
|
-
else # If test is in a simulator
|
87
|
-
|
88
|
-
# Shutdown all the booted simulators to avoid problems with the switch of simulatores
|
89
|
-
# on the automated tests (like when on jenkins)
|
90
|
-
shutdown_booted_simulators
|
91
|
-
|
92
|
-
# APP_BUNDLE_ID must be set in order to uninstall the app from the simulator
|
93
|
-
# You can either pass it as a parameter in the cucumber command or set it here
|
94
|
-
#ENV["APP_BUNDLE_ID"] = "bundle_id"
|
95
|
-
|
96
|
-
# Booting the device to avoid problems with the app installation
|
97
|
-
%x(open -a 'iOS Simulator' --args -CurrentDeviceUDID #{ENV['DEVICE_TARGET']} > /dev/null)
|
98
|
-
sleep(7)
|
99
|
-
|
100
|
-
# Reinstalling the app using terminal commands
|
101
|
-
system "echo 'Installing the app...'"
|
102
|
-
|
103
|
-
# Removing the app
|
104
|
-
%x(xcrun simctl uninstall #{ENV['DEVICE_TARGET']} #{ENV['APP_BUNDLE_ID']} > /dev/null)
|
105
|
-
|
106
|
-
# Installing the app
|
107
|
-
%x(xcrun simctl install #{ENV['DEVICE_TARGET']} #{ENV['APP_BUNDLE_PATH']} > /dev/null)
|
108
|
-
|
109
|
-
system "echo 'Installed.'"
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
# Checks if the UUID belongs to a Device or a Simulator
|
116
|
-
def is_simulator? uuid
|
117
|
-
# Check if UUID is from a device or a simulator
|
118
|
-
# Getting all the simulator's UUID
|
119
|
-
uuids = `xcrun simctl list`
|
120
|
-
return true if uuids.include? uuid
|
121
|
-
return false
|
122
|
-
end
|
123
|
-
|
124
|
-
# Kill all simulators process, lists all the booted simulators and shut them down
|
125
|
-
def shutdown_booted_simulators
|
126
|
-
|
127
|
-
# Closing all Simulators running
|
128
|
-
%x(killall "iOS Simulator")
|
129
|
-
|
130
|
-
# Listing all the booted devices
|
131
|
-
booted_simulators = `xcrun simctl list | grep 'Booted'`
|
132
|
-
|
133
|
-
# Getting the UUIDs
|
134
|
-
booted_simulators.split("\n").each do |simulator|
|
135
|
-
uuid = simulator.split("(")[1].gsub(")", "").gsub(" ","")
|
136
|
-
# Shuting the simulator down
|
137
|
-
%x(xcrun simctl shutdown #{uuid})
|
138
|
-
end
|
139
|
-
|
140
|
-
end
|
@@ -1,27 +1,27 @@
|
|
1
1
|
require 'calabash-android/abase'
|
2
2
|
|
3
3
|
class AndroidScreenBase < Calabash::ABase
|
4
|
-
|
5
4
|
def self.element(element_name, &block)
|
6
5
|
define_method(element_name.to_s, *block)
|
7
6
|
end
|
8
7
|
|
9
8
|
class << self
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
alias_method :value, :element
|
10
|
+
alias_method :action, :element
|
11
|
+
alias_method :trait, :element
|
13
12
|
end
|
14
13
|
|
15
|
-
element(:loading_screen) {
|
14
|
+
element(:loading_screen) { 'insert_loading_view_id' }
|
16
15
|
|
17
16
|
# The progress bar of the application is a custom view
|
18
17
|
def wait_for_progress
|
19
|
-
|
18
|
+
sleep(2)
|
19
|
+
wait_for_element_does_not_exist("* id:'#{loading_screen}'",
|
20
|
+
timeout: 10)
|
20
21
|
end
|
21
22
|
|
22
|
-
def drag_to
|
23
|
-
|
24
|
-
positions = [0,0,0,0] # [ 'from_x', 'to_x', 'from_y', 'to_y' ]
|
23
|
+
def drag_to(direction)
|
24
|
+
positions = [0, 0, 0, 0] # [ 'from_x', 'to_x', 'from_y', 'to_y' ]
|
25
25
|
|
26
26
|
case(direction)
|
27
27
|
when :<%= (I18n.translate "directions.down").to_sym %>
|
@@ -34,20 +34,22 @@ class AndroidScreenBase < Calabash::ABase
|
|
34
34
|
positions = [20,90,80,80]
|
35
35
|
end
|
36
36
|
|
37
|
-
# perform_action( 'action', 'from_x', 'to_x', 'from_y', 'to_y',
|
38
|
-
|
39
|
-
|
37
|
+
# perform_action( 'action', 'from_x', 'to_x', 'from_y', 'to_y',
|
38
|
+
# 'number of steps (in this case, velocity of drag' )
|
39
|
+
perform_action('drag', positions[0], positions[1],
|
40
|
+
positions[2], positions[3], 15)
|
40
41
|
sleep(1)
|
41
42
|
end
|
42
43
|
|
43
|
-
def drag_until_element_is_visible_with_special_query
|
44
|
-
drag_until_element_is_visible direction, element,
|
44
|
+
def drag_until_element_is_visible_with_special_query(direction, element)
|
45
|
+
drag_until_element_is_visible direction, element,
|
46
|
+
"* {text CONTAINS[c] '#{element}'}"
|
45
47
|
end
|
46
48
|
|
47
|
-
def drag_until_element_is_visible
|
49
|
+
def drag_until_element_is_visible(direction, element, query = nil, limit = 15)
|
48
50
|
i = 0
|
49
51
|
|
50
|
-
element_query =
|
52
|
+
element_query = ''
|
51
53
|
if query.nil?
|
52
54
|
element_query = "* marked:'#{element}'"
|
53
55
|
else
|
@@ -55,62 +57,73 @@ class AndroidScreenBase < Calabash::ABase
|
|
55
57
|
end
|
56
58
|
|
57
59
|
sleep(2)
|
58
|
-
while
|
60
|
+
while !element_exists(element_query) && i < limit
|
59
61
|
drag_to direction
|
60
|
-
i
|
62
|
+
i += 1
|
61
63
|
end
|
62
64
|
|
63
|
-
|
65
|
+
fail "Executed #{limit} moviments #{direction} and "\
|
66
|
+
"the element '#{element}' was not found on this view!" unless
|
67
|
+
i < limit
|
64
68
|
end
|
65
69
|
|
66
|
-
def drag_for_specified_number_of_times
|
70
|
+
def drag_for_specified_number_of_times(direction, times)
|
67
71
|
times.times do
|
68
72
|
drag_to direction
|
69
73
|
end
|
70
74
|
end
|
71
75
|
|
72
|
-
# Negation indicates that we want a page that doesn't
|
73
|
-
|
76
|
+
# Negation indicates that we want a page that doesn't
|
77
|
+
# has the message passed as parameter
|
78
|
+
def is_on_page?(page_text, negation = '')
|
74
79
|
should_not_have_exception = false
|
75
80
|
should_have_exception = false
|
76
81
|
begin
|
77
82
|
wait_for(timeout: 5) { has_text? page_text }
|
78
|
-
# If negation is not nil, we should raise an error
|
83
|
+
# If negation is not nil, we should raise an error
|
84
|
+
# if this message was found on the view
|
79
85
|
should_not_have_exception = true unless negation == ''
|
80
86
|
rescue
|
81
|
-
# only raise exception if negation is nil,
|
87
|
+
# only raise exception if negation is nil,
|
88
|
+
# otherwise this is the expected behaviour
|
82
89
|
should_have_exception = true if negation == ''
|
83
90
|
end
|
84
91
|
|
85
|
-
|
92
|
+
fail "Unexpected Page. The page should not have: '#{page_text}'" if
|
93
|
+
should_not_have_exception
|
86
94
|
|
87
|
-
|
95
|
+
fail "Unexpected Page. Expected was: '#{page_text}'" if
|
96
|
+
should_have_exception
|
88
97
|
end
|
89
98
|
|
90
|
-
def enter
|
99
|
+
def enter(text, element, query = nil)
|
91
100
|
if query.nil?
|
92
|
-
query(
|
101
|
+
query("* marked:'#{element}'", setText: text)
|
93
102
|
else
|
94
|
-
query(
|
103
|
+
query(query, setText: text)
|
95
104
|
end
|
96
105
|
end
|
97
106
|
|
98
|
-
def touch_screen_element
|
107
|
+
def touch_screen_element(element, query = nil)
|
99
108
|
query = "* id:'#{element}'" if query.nil?
|
100
|
-
|
101
|
-
|
102
|
-
|
109
|
+
begin
|
110
|
+
wait_for(timeout: 5) { element_exists(query) }
|
111
|
+
touch(query)
|
112
|
+
rescue => e
|
113
|
+
raise "Problem in touch screen element: '#{element}'\nError Message: #{e.message}"
|
114
|
+
end
|
115
|
+
end
|
103
116
|
|
104
|
-
def touch_element_by_index
|
105
|
-
wait_for(:
|
117
|
+
def touch_element_by_index(id, index)
|
118
|
+
wait_for(timeout: 5) { element_exists("* id:'#{id}' index:#{index}") }
|
106
119
|
touch("* id:'#{id}' index:#{index}")
|
107
120
|
end
|
108
121
|
|
109
|
-
def clear_text_field
|
122
|
+
def clear_text_field(field)
|
110
123
|
clear_text_in("android.widget.EditText id:'#{field}'}")
|
111
124
|
end
|
112
125
|
|
113
|
-
def select_date_on_date_picker
|
126
|
+
def select_date_on_date_picker(date, date_picker_field_id)
|
114
127
|
# Touch the date picker field
|
115
128
|
touch "* id:'#{date_picker_field_id}'"
|
116
129
|
|
@@ -120,5 +133,4 @@ class AndroidScreenBase < Calabash::ABase
|
|
120
133
|
# Clicking in the Done button
|
121
134
|
touch "* id:'button1'"
|
122
135
|
end
|
123
|
-
|
124
136
|
end
|
@@ -1,53 +1,32 @@
|
|
1
1
|
require 'calabash-cucumber/ibase'
|
2
2
|
|
3
3
|
class IOSScreenBase < Calabash::IBase
|
4
|
-
|
5
4
|
def self.element(element_name, &block)
|
6
5
|
define_method(element_name.to_s, *block)
|
7
6
|
end
|
8
7
|
|
9
8
|
class << self
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
alias_method :value, :element
|
10
|
+
alias_method :action, :element
|
11
|
+
alias_method :trait, :element
|
13
12
|
end
|
14
13
|
|
15
14
|
element(:loading_screen) { 'LOADING' }
|
16
15
|
|
17
16
|
# The progress bar of the application is a custom view
|
18
17
|
def wait_for_progress
|
19
|
-
|
18
|
+
sleep(2)
|
19
|
+
wait_for(timeout: 10) { element_does_not_exist "* marked:'#{loading_screen}'" }
|
20
20
|
end
|
21
21
|
|
22
22
|
def has_text?(text)
|
23
|
-
!query("* {text CONTAINS[c] '#{text}'}").empty?
|
24
|
-
|
25
|
-
|
26
|
-
def drag_to direction
|
27
|
-
|
28
|
-
# iOS swipe command doesn't work.
|
29
|
-
# For a workaround we need to use the scroll function, but it only work after a swipe command
|
30
|
-
|
31
|
-
# iOS swipe :up and :down are the opposite of the Android directions
|
32
|
-
# Setting swipe_opt that will define the swipe 'force'
|
33
|
-
swipe_opt = nil
|
34
|
-
case direction
|
35
|
-
when :<%= (I18n.translate "directions.left").to_sym %>
|
36
|
-
direction = :left
|
37
|
-
swipe_opt = {:'swipe-delta' => {:horizontal=>{:dx => 280} }, :offset => { :x => 300, :y => 300 } }
|
38
|
-
when :<%= (I18n.translate "directions.right").to_sym %>
|
39
|
-
direction = :right
|
40
|
-
swipe_opt = {:'swipe-delta' => {:horizontal=>{:dx => 250} }, :offset => { :x => 50, :y => 300 } }
|
41
|
-
when :<%= (I18n.translate "directions.up").to_sym %>
|
42
|
-
direction = :down
|
43
|
-
swipe_opt = {:'swipe-delta' => {:vertical=>{:dy => 200} }, :offset => { :x => 160, :y => 100 } }
|
44
|
-
when :<%= (I18n.translate "directions.down").to_sym %>
|
45
|
-
direction = :up
|
46
|
-
swipe_opt = {:'swipe-delta' => {:vertical=>{:dy => 200} }, :offset => { :x => 160, :y => 400 } }
|
47
|
-
end
|
48
|
-
|
49
|
-
swipe(direction, swipe_opt)
|
23
|
+
!query("* {text CONTAINS[c] '#{text}'}").empty? ||
|
24
|
+
!query("* {accessibilityLabel CONTAINS[c] '#{text}'}").empty?
|
25
|
+
end
|
50
26
|
|
27
|
+
def drag_to(direction, element = nil)
|
28
|
+
element = 'tableView' if element.nil?
|
29
|
+
scroll(element, direction)
|
51
30
|
sleep(1)
|
52
31
|
end
|
53
32
|
|
@@ -55,79 +34,79 @@ class IOSScreenBase < Calabash::IBase
|
|
55
34
|
# so this function looks for these two properties on the screen. When the query
|
56
35
|
# looks for just a part of the text (CONTAINS[c]) then we need to specify if
|
57
36
|
# we will look in accessibilityLabel or in any other propertie (marked)
|
58
|
-
def ios_element_exists?
|
37
|
+
def ios_element_exists?(query)
|
59
38
|
second_query = nil
|
60
39
|
|
61
|
-
if query.include?
|
62
|
-
if query.include?
|
63
|
-
second_query = query.gsub(
|
40
|
+
if query.include? 'CONTAINS[c]'
|
41
|
+
if query.include? 'marked'
|
42
|
+
second_query = query.gsub('marked', 'accessibilityLabel')
|
64
43
|
end
|
65
|
-
if query.include?
|
66
|
-
second_query = query.gsub(
|
44
|
+
if query.include? 'accessibilityLabel'
|
45
|
+
second_query = query.gsub('accessibilityLabel', 'marked')
|
67
46
|
end
|
68
47
|
end
|
69
48
|
|
70
49
|
if second_query.nil?
|
71
50
|
return element_exists(query)
|
72
51
|
else
|
73
|
-
element_exists(query)
|
52
|
+
element_exists(query) || element_exists(second_query)
|
74
53
|
end
|
75
54
|
end
|
76
55
|
|
77
|
-
def drag_until_element_is_visible_with_special_query
|
78
|
-
drag_until_element_is_visible direction, element,
|
56
|
+
def drag_until_element_is_visible_with_special_query(direction, element)
|
57
|
+
drag_until_element_is_visible direction, element,
|
58
|
+
"* {accessibilityLabel CONTAINS[c] '#{element}'}"
|
79
59
|
end
|
80
60
|
|
81
|
-
def drag_until_element_is_visible
|
61
|
+
def drag_until_element_is_visible(direction, element, query = nil, limit = 15)
|
82
62
|
i = 0
|
83
63
|
|
84
|
-
|
85
|
-
if query.nil?
|
86
|
-
element_query = "* marked:'#{element}'"
|
87
|
-
else
|
88
|
-
element_query = query
|
89
|
-
end
|
64
|
+
query = "* marked:'#{element}'" if query.nil?
|
90
65
|
|
91
66
|
sleep(1)
|
92
|
-
while
|
67
|
+
while !ios_element_exists?(query) && i < limit
|
93
68
|
drag_to direction
|
94
|
-
i
|
69
|
+
i += 1
|
95
70
|
end
|
96
71
|
|
97
|
-
|
72
|
+
fail "Executed #{limit} moviments #{direction} and the "\
|
73
|
+
"element '#{element}' was not found on this view!" unless i < limit
|
98
74
|
end
|
99
75
|
|
100
|
-
def drag_for_specified_number_of_times
|
76
|
+
def drag_for_specified_number_of_times(direction, times)
|
101
77
|
times.times do
|
102
78
|
drag_to direction
|
103
79
|
end
|
104
80
|
end
|
105
81
|
|
106
|
-
# Negation indicates that we want a page that doesn't has
|
82
|
+
# Negation indicates that we want a page that doesn't has
|
83
|
+
# the message passed as parameter
|
107
84
|
def is_on_page?(page_text, negation = '')
|
108
85
|
should_not_have_exception = false
|
109
86
|
should_have_exception = false
|
110
87
|
begin
|
111
88
|
wait_for(timeout: 5) { has_text? page_text }
|
112
|
-
# If negation is not nil, we should raise an error
|
89
|
+
# If negation is not nil, we should raise an error
|
90
|
+
# if this message was found on the view
|
113
91
|
should_not_have_exception = true unless negation == ''
|
114
92
|
rescue
|
115
|
-
# only raise exception if negation is nil,
|
93
|
+
# only raise exception if negation is nil,
|
94
|
+
# otherwise this is the expected behaviour
|
116
95
|
should_have_exception = true if negation == ''
|
117
96
|
end
|
118
97
|
|
119
|
-
|
98
|
+
fail "Unexpected Page. The page should not have: '#{page_text}'" if
|
99
|
+
should_not_have_exception
|
120
100
|
|
121
|
-
|
101
|
+
fail "Unexpected Page. Expected was: '#{page_text}'" if
|
102
|
+
should_have_exception
|
122
103
|
end
|
123
104
|
|
124
|
-
def enter
|
125
|
-
if query.nil?
|
126
|
-
query = "* marked:'#{element}'"
|
127
|
-
end
|
105
|
+
def enter(text, element, query = nil)
|
106
|
+
query = "* marked:'#{element}'" if query.nil?
|
128
107
|
|
129
108
|
begin
|
130
|
-
wait_for(:
|
109
|
+
wait_for(timeout: 5) { element_exists query }
|
131
110
|
rescue
|
132
111
|
# Just a better exception message
|
133
112
|
raise "Element '#{element}' not found on view!"
|
@@ -136,50 +115,69 @@ class IOSScreenBase < Calabash::IBase
|
|
136
115
|
touch query
|
137
116
|
# Waits up to 20 seconds for the keyboard to show up
|
138
117
|
begin
|
139
|
-
wait_for(:
|
118
|
+
wait_for(timeout: 10) { element_exists("view:'UIKeyboardAutomatic'") }
|
140
119
|
rescue
|
141
|
-
# If the keyboard didn't show up, tries another time
|
120
|
+
# If the keyboard didn't show up, tries another time
|
121
|
+
# before rainsing the error message
|
142
122
|
touch query
|
143
|
-
wait_for(:
|
123
|
+
wait_for(timeout: 5) { element_exists("view:'UIKeyboardAutomatic'") }
|
144
124
|
end
|
145
125
|
|
146
126
|
keyboard_enter_text text
|
147
|
-
done
|
148
127
|
end
|
149
128
|
|
150
|
-
def touch_screen_element
|
129
|
+
def touch_screen_element(element, query = nil)
|
130
|
+
query = "* marked:'#{element}'" if query.nil?
|
151
131
|
begin
|
152
|
-
wait_for(:
|
153
|
-
touch
|
154
|
-
rescue
|
155
|
-
raise "
|
132
|
+
wait_for(timeout: 5) { element_exists(query) }
|
133
|
+
touch query
|
134
|
+
rescue => e
|
135
|
+
raise "Problem in touch screen element: '#{element}'\nError Message: #{e.message}"
|
156
136
|
end
|
157
137
|
end
|
158
138
|
|
159
|
-
def touch_element_by_index
|
160
|
-
|
161
|
-
|
139
|
+
def touch_element_by_index(id, index)
|
140
|
+
query = "* marked:'#{id}' index:#{index}"
|
141
|
+
wait_for(timeout: 5) { element_exists(query) }
|
142
|
+
touch(query)
|
162
143
|
end
|
163
144
|
|
164
|
-
def clear_text_field
|
145
|
+
def clear_text_field(field)
|
165
146
|
clear_text("textField marked:'#{field}'")
|
166
147
|
end
|
167
148
|
|
168
|
-
def select_date_on_date_picker
|
149
|
+
def select_date_on_date_picker(date, date_picker_field_id)
|
169
150
|
# Touch the date picker element
|
170
151
|
touch_screen_element date_picker_field_id
|
171
152
|
# Waiting for the date picker to show up
|
172
153
|
wait_for(timeout: 5) { element_exists("view:'UIDatePicker'") }
|
173
154
|
|
174
155
|
# If date is today, then we have nothing to do
|
175
|
-
if date.year != DateTime.now.year ||
|
156
|
+
if date.year != DateTime.now.year ||
|
157
|
+
date.month != DateTime.now.month ||
|
158
|
+
date.day != DateTime.now.day
|
176
159
|
# Selecting 'date' on the date picker
|
177
160
|
picker_set_date_time date
|
178
161
|
end
|
179
162
|
|
180
163
|
# Touch the OK button
|
181
|
-
touch_screen_element
|
182
|
-
|
164
|
+
touch_screen_element 'Ok'
|
183
165
|
end
|
184
166
|
|
167
|
+
def touch_picker_item_by_index(index)
|
168
|
+
label = query('pickerView', :delegate,
|
169
|
+
[{ pickerView: nil }, { titleForRow: index },
|
170
|
+
{ forComponent: 0 }])
|
171
|
+
|
172
|
+
# Exception if element no found
|
173
|
+
fail "Picker item index #{index} not found." if label.nil?
|
174
|
+
# Label is an array of 1 element. Just picking the first.
|
175
|
+
label = label.first
|
176
|
+
|
177
|
+
# Touching the first item using it's text and Javascript function
|
178
|
+
uia(%[uia.selectPickerValues('{0 "#{label}"}')])
|
179
|
+
|
180
|
+
# Touching the OK button to close the Picker
|
181
|
+
touch "* marked:'OK'"
|
182
|
+
end
|
185
183
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cs-bdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Tanner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/skeleton/README.md
|
107
107
|
- lib/skeleton/config/cucumber.yml
|
108
108
|
- lib/skeleton/config/email/template.html
|
109
|
+
- lib/skeleton/config/load_classes.rb
|
109
110
|
- lib/skeleton/config/scripts/android/run_tests_all_devices.sh
|
110
111
|
- lib/skeleton/config/scripts/android/start_emulators.sh
|
111
112
|
- lib/skeleton/config/scripts/android/stop_emulators.sh
|