sunomono 0.3.1 → 1.0.0
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 +82 -24
- data/SUNOMONO_APPIUM.md +18 -0
- data/SUNOMONO_CALABASH.md +19 -0
- data/lib/helpers/sunomono_helpers.rb +19 -0
- data/lib/{skeleton → skeleton_appium}/.gitignore +0 -0
- data/lib/skeleton_appium/Gemfile +8 -0
- data/lib/{skeleton → skeleton_appium}/README.md +0 -0
- data/lib/{skeleton → skeleton_appium}/config/cucumber.yml +0 -0
- data/lib/{skeleton → skeleton_appium}/config/email/template.html +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/android/run_tests_all_devices.sh +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/android/start_emulators.sh +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/android/stop_emulators.sh +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/break_build_if_failed.sh +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/check_if_tests_failed.sh +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/ios/build_app.rb +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/ios/build_app.yml +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/ios/devices.txt +0 -0
- data/lib/{skeleton → skeleton_appium}/config/scripts/ios/run_tests_all_devices.sh +0 -0
- data/lib/{skeleton → skeleton_appium}/features/android/features/.gitkeep +0 -0
- data/lib/{skeleton → skeleton_appium}/features/android/screens/.gitkeep +0 -0
- data/lib/{skeleton → skeleton_appium}/features/android/step_definitions/.gitkeep +0 -0
- data/lib/{skeleton → skeleton_appium}/features/android/support/hooks.rb +0 -0
- data/lib/{skeleton → skeleton_appium}/features/ios/features/.gitkeep +0 -0
- data/lib/{skeleton → skeleton_appium}/features/ios/screens/.gitkeep +0 -0
- data/lib/{skeleton → skeleton_appium}/features/ios/step_definitions/.gitkeep +0 -0
- data/lib/skeleton_appium/features/support/android/appium.txt +4 -0
- data/lib/skeleton_appium/features/support/env.rb +21 -0
- data/lib/{skeleton → skeleton_appium}/features/support/exceptions.rb +0 -0
- data/lib/{skeleton/features/ios/support/02_pre_stop_hooks.rb → skeleton_appium/features/support/hooks.rb} +0 -0
- data/lib/skeleton_appium/features/support/ios/appium.txt +5 -0
- data/lib/{skeleton → skeleton_appium}/screenshots/android/.gitkeep +0 -0
- data/lib/{skeleton → skeleton_appium}/screenshots/ios/.gitkeep +0 -0
- data/lib/skeleton_calabash/.gitignore +9 -0
- data/lib/{skeleton → skeleton_calabash}/Gemfile +0 -0
- data/lib/skeleton_calabash/README.md +165 -0
- data/lib/skeleton_calabash/config/cucumber.yml +7 -0
- data/lib/skeleton_calabash/config/email/template.html +14 -0
- data/lib/{skeleton → skeleton_calabash}/config/load_classes.rb +0 -0
- data/lib/skeleton_calabash/config/scripts/android/run_tests_all_devices.sh +41 -0
- data/lib/skeleton_calabash/config/scripts/android/start_emulators.sh +52 -0
- data/lib/skeleton_calabash/config/scripts/android/stop_emulators.sh +13 -0
- data/lib/skeleton_calabash/config/scripts/break_build_if_failed.sh +6 -0
- data/lib/skeleton_calabash/config/scripts/check_if_tests_failed.sh +11 -0
- data/lib/skeleton_calabash/config/scripts/ios/build_app.rb +71 -0
- data/lib/skeleton_calabash/config/scripts/ios/build_app.yml +13 -0
- data/lib/skeleton_calabash/config/scripts/ios/devices.txt +4 -0
- data/lib/skeleton_calabash/config/scripts/ios/run_tests_all_devices.sh +57 -0
- data/lib/skeleton_calabash/features/android/features/.gitkeep +0 -0
- data/lib/skeleton_calabash/features/android/screens/.gitkeep +0 -0
- data/lib/skeleton_calabash/features/android/step_definitions/.gitkeep +0 -0
- data/lib/{skeleton → skeleton_calabash}/features/android/support/app_installation_hooks.rb +0 -0
- data/lib/{skeleton → skeleton_calabash}/features/android/support/app_life_cycle_hooks.rb +0 -0
- data/lib/skeleton_calabash/features/android/support/hooks.rb +0 -0
- data/lib/skeleton_calabash/features/ios/features/.gitkeep +0 -0
- data/lib/skeleton_calabash/features/ios/screens/.gitkeep +0 -0
- data/lib/skeleton_calabash/features/ios/step_definitions/.gitkeep +0 -0
- data/lib/{skeleton → skeleton_calabash}/features/ios/support/01_launch.rb +0 -0
- data/lib/skeleton_calabash/features/ios/support/02_pre_stop_hooks.rb +0 -0
- data/lib/{skeleton → skeleton_calabash}/features/support/env.rb +0 -0
- data/lib/skeleton_calabash/features/support/exceptions.rb +11 -0
- data/lib/skeleton_calabash/screenshots/android/.gitkeep +0 -0
- data/lib/skeleton_calabash/screenshots/ios/.gitkeep +0 -0
- data/lib/sunomono/version.rb +1 -1
- data/lib/sunomono.rb +134 -47
- data/lib/templates/appium_base_screen.tt +13 -0
- data/lib/templates/appium_base_steps.tt +46 -0
- data/lib/templates/appium_screen.tt +7 -0
- data/spec/sunomono_test.rb +33 -31
- metadata +65 -32
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
# ----------------------------------------------------------------------------
|
4
|
+
#
|
5
|
+
# $1 -> configuration environment (dev or jenkins)
|
6
|
+
#
|
7
|
+
#
|
8
|
+
# REMEMBER to fill the configuration file build_app.yml
|
9
|
+
|
10
|
+
require 'fileutils'
|
11
|
+
require 'yaml'
|
12
|
+
require 'pathname'
|
13
|
+
|
14
|
+
# When running on CI
|
15
|
+
# It is a good pratice to run pod install when executing this script
|
16
|
+
# on the CI to avoid building problems
|
17
|
+
# %x(pod install)
|
18
|
+
|
19
|
+
# Parsing the yaml configuration file
|
20
|
+
config = YAML.load_file(File.join(File.dirname(__FILE__), 'build_app.yml'))
|
21
|
+
|
22
|
+
if ARGV.length != 1
|
23
|
+
puts 'Error: Wrong number of arguments!'
|
24
|
+
puts 'Usage: build_app.rb environment'
|
25
|
+
puts "Available Environments: #{config.keys.join(', ')}"
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
29
|
+
if config[ARGV[0]].nil?
|
30
|
+
puts 'Error: Wrong configuration environment!'
|
31
|
+
puts "Available Environments: #{config.keys.join(', ')}"
|
32
|
+
exit 1
|
33
|
+
else
|
34
|
+
config = config[ARGV[0]]
|
35
|
+
end
|
36
|
+
|
37
|
+
puts "Starting at #{Time.now.strftime('%H:%M:%S')}"
|
38
|
+
|
39
|
+
# Creating a folder name from the destination configuration parameter
|
40
|
+
folder_name = config['destination'].gsub('platform=', '').gsub('name=', '')
|
41
|
+
.tr(' ', '_').tr(',', '_')
|
42
|
+
export_path = File.join(config['export_path'], folder_name)
|
43
|
+
|
44
|
+
# Removing the folder where the .app will be stored if it already exists
|
45
|
+
FileUtils.rm_r export_path if Dir.exist?(export_path)
|
46
|
+
|
47
|
+
# Creating the folder where the .app will be stored
|
48
|
+
FileUtils.mkdir_p export_path
|
49
|
+
|
50
|
+
puts 'Building project'
|
51
|
+
|
52
|
+
system <<eos
|
53
|
+
xcodebuild -workspace "#{config['xcworkspace']}" \
|
54
|
+
-scheme "#{config['scheme']}" -destination "#{config['destination']}" \
|
55
|
+
-configuration "#{config['configuration']}" clean build \
|
56
|
+
CONFIGURATION_BUILD_DIR="#{export_path}" | xcpretty
|
57
|
+
eos
|
58
|
+
|
59
|
+
# Getting the app folder that was created
|
60
|
+
# Listing all folders on the export path folder
|
61
|
+
folders = Pathname.new(export_path).children.select { |c| c.directory? }
|
62
|
+
# Getting the folder which ends with .app
|
63
|
+
app_pathname = folders.select { |f| f.to_s.match('.app$') }
|
64
|
+
# Getting the app folder path
|
65
|
+
app_path = app_pathname.first.to_s
|
66
|
+
|
67
|
+
# Printing the APP_BUNDLE_PATH in the terminal
|
68
|
+
puts "APP_BUNDLE_PATH=#{app_path}"
|
69
|
+
|
70
|
+
puts "End: #{Time.now.strftime('%H:%M:%S')}"
|
71
|
+
puts 'Bye!'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
dev:
|
2
|
+
xcworkspace: "Path_to_the_xcworkspace_folder"
|
3
|
+
scheme: TargetName
|
4
|
+
configuration: Debug
|
5
|
+
destination: "platform=iOS Simulator,name=iPhone 6"
|
6
|
+
export_path: "Path_to_export_app_folder"
|
7
|
+
|
8
|
+
jenkins:
|
9
|
+
xcworkspace: <%= ENV['WORKSPACE']%>/Project.xcworkspace
|
10
|
+
scheme: TargetName
|
11
|
+
configuration: Debug
|
12
|
+
destination: "Any_platform_or_device_that_you_want"
|
13
|
+
export_path: <%= ENV['WORKSPACE']%>/releases/normal
|
@@ -0,0 +1,4 @@
|
|
1
|
+
# <DEVICE_TARGET (UUID)> | <DEVICE_ENDPOINT (IP)> | <DEVICE_NAME> | <DEVICE_TYPE> (Simulator or Device)
|
2
|
+
000...000 | http://localhost:37265 | Device0 | Simulator
|
3
|
+
111...111 | http://1.1.1.1:37265 | Device1 | Device
|
4
|
+
# EOF - Never erase this comment or the script will have problems to read this file
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
# ----------------------------------------------------------------------------
|
3
|
+
# Uncomment the next line to enable debug
|
4
|
+
# set -x
|
5
|
+
#
|
6
|
+
# $1 -> parameter with the path of the .app bundle for simulators
|
7
|
+
# $2 -> parameter with the path of the .app bundle for devices
|
8
|
+
|
9
|
+
## CODE BEGIN #############################################################
|
10
|
+
export LC_ALL="en_US.UTF-8"
|
11
|
+
echo Start: $(date)
|
12
|
+
|
13
|
+
# Exits if the app path was not informed
|
14
|
+
[ $# -lt 2 ] && echo "Wrong number of parameters." && exit 1
|
15
|
+
|
16
|
+
# Creating the reports path
|
17
|
+
reports_path="$WORKSPACE/reports-cal"
|
18
|
+
mkdir $reports_path
|
19
|
+
|
20
|
+
# Changing relative to absolute path if that is the case
|
21
|
+
# The simulator path
|
22
|
+
original_path="$(pwd)" # Saving the original path where the command was executed
|
23
|
+
cd "$1"
|
24
|
+
SIMULATOR_APP_PATH="$(pwd)"
|
25
|
+
# The device path
|
26
|
+
cd "$original_path"
|
27
|
+
cd "$2"
|
28
|
+
DEVICE_APP_PATH="$(pwd)"
|
29
|
+
|
30
|
+
cd $WORKSPACE # All tests should run from the root folder of the tests project
|
31
|
+
|
32
|
+
cat config/scripts/ios/devices.txt | ## Reading the devices.txt file
|
33
|
+
grep -v "#" | ## Removing the command lines
|
34
|
+
tr -d " " | ## Trimming all the spaces
|
35
|
+
while IFS='|' read UUID IP NAME TYPE ## Defining pipe as the separator char and reading the three variable fields
|
36
|
+
do
|
37
|
+
# Creating the report folder for this device or simulator
|
38
|
+
mkdir "$reports_path"/"$NAME"
|
39
|
+
|
40
|
+
if [ $TYPE == "Simulator" ]
|
41
|
+
then
|
42
|
+
APP_PATH=$SIMULATOR_APP_PATH
|
43
|
+
else
|
44
|
+
APP_PATH=$DEVICE_APP_PATH
|
45
|
+
fi
|
46
|
+
|
47
|
+
# Executing calabash for the device or simulator
|
48
|
+
APP_BUNDLE_PATH="$APP_PATH" DEVICE_TARGET="$UUID" DEVICE_ENDPOINT="$IP" cucumber -p ios SCREENSHOT_PATH="$reports_path"/"$NAME"/ -f 'Calabash::Formatters::Html' -o "$reports_path"/"$NAME/reports.html" -f junit -o "$reports_path"/"$NAME"
|
49
|
+
|
50
|
+
# Calabash has a problem with images relative path, the command above will replace all the images path on the
|
51
|
+
# html report file to be a relative path
|
52
|
+
sed -i.bak 's|'"$reports_path"/"$NAME"/'||g' "$reports_path"/"$NAME"/reports.html
|
53
|
+
done
|
54
|
+
|
55
|
+
echo End: $(date)
|
56
|
+
echo 'Bye!'
|
57
|
+
## CODE END #############################################################
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/sunomono/version.rb
CHANGED
data/lib/sunomono.rb
CHANGED
@@ -14,11 +14,12 @@ module Sunomono
|
|
14
14
|
class Generate < Thor
|
15
15
|
include Thor::Actions
|
16
16
|
|
17
|
-
desc '
|
17
|
+
desc 'calabash_feature [RESOURCE_NAME]', 'Generates an OS independent feature'
|
18
18
|
option :lang,
|
19
19
|
banner: 'any of the gherkin supported languages',
|
20
20
|
default: :en
|
21
|
-
|
21
|
+
|
22
|
+
def calabash_feature(name)
|
22
23
|
I18n.config.default_locale = options[:lang]
|
23
24
|
in_root_project_folder?
|
24
25
|
|
@@ -28,37 +29,72 @@ module Sunomono
|
|
28
29
|
create_screen_file name, 'IOS'
|
29
30
|
end
|
30
31
|
|
31
|
-
desc '
|
32
|
+
desc 'appium_feature [RESOURCE_NAME]', 'Generates an OS independent feature'
|
33
|
+
option :lang,
|
34
|
+
banner: 'any of the gherkin supported languages',
|
35
|
+
default: :en
|
36
|
+
|
37
|
+
def appium_feature(name)
|
38
|
+
I18n.config.default_locale = options[:lang]
|
39
|
+
in_root_project_folder?
|
40
|
+
|
41
|
+
create_feature_file(name)
|
42
|
+
create_steps_file name
|
43
|
+
create_appium_screen_file name, 'Android'
|
44
|
+
create_appium_screen_file name, 'IOS'
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'android-feature [FRAMEWORK(calabash or appium)] [RESOURCE_NAME]',
|
32
48
|
'Generates an Android dependent feature'
|
33
49
|
option :lang,
|
34
50
|
banner: 'any of the gherkin supported languages',
|
35
51
|
default: :en
|
36
|
-
|
52
|
+
|
53
|
+
def android_feature(framework, name)
|
54
|
+
framework_avaliable?(framework)
|
55
|
+
|
37
56
|
I18n.config.default_locale = options[:lang]
|
38
57
|
in_root_project_folder?
|
39
58
|
|
40
|
-
|
41
|
-
|
42
|
-
|
59
|
+
if framework.downcase == 'calabash'
|
60
|
+
create_feature_file name, 'Android'
|
61
|
+
create_steps_file name, 'Android'
|
62
|
+
create_screen_file name, 'Android'
|
63
|
+
else
|
64
|
+
create_feature_file name, 'Android'
|
65
|
+
create_steps_file name, 'Android'
|
66
|
+
create_appium_screen_file name, 'Android'
|
67
|
+
end
|
43
68
|
end
|
44
69
|
|
45
|
-
desc 'ios-feature [RESOURCE_NAME]',
|
70
|
+
desc 'ios-feature [FRAMEWORK(calabash or appium)] [RESOURCE_NAME]',
|
71
|
+
'Generates an iOS dependent feature'
|
46
72
|
option :lang,
|
47
73
|
banner: 'any of the gherkin supported languages',
|
48
74
|
default: :en
|
49
|
-
|
75
|
+
|
76
|
+
def ios_feature(framework, name)
|
77
|
+
framework_avaliable?(framework)
|
78
|
+
|
50
79
|
I18n.config.default_locale = options[:lang]
|
51
80
|
in_root_project_folder?
|
52
81
|
|
53
|
-
|
54
|
-
|
55
|
-
|
82
|
+
if framework.downcase == 'calabash'
|
83
|
+
create_feature_file name, 'IOS'
|
84
|
+
create_steps_file name, 'IOS'
|
85
|
+
create_screen_file name, 'IOS'
|
86
|
+
else
|
87
|
+
create_feature_file name, 'IOS'
|
88
|
+
create_steps_file name, 'IOS'
|
89
|
+
create_appium_screen_file name, 'IOS'
|
90
|
+
end
|
56
91
|
end
|
57
92
|
|
58
93
|
desc 'step [RESOURCE_NAME]', 'Generates an OS independent step'
|
59
94
|
option :lang,
|
60
95
|
banner: 'any of the gherkin supported languages',
|
61
96
|
default: :en
|
97
|
+
|
62
98
|
def step(name)
|
63
99
|
I18n.config.default_locale = options[:lang]
|
64
100
|
in_root_project_folder?
|
@@ -69,6 +105,7 @@ module Sunomono
|
|
69
105
|
option :lang,
|
70
106
|
banner: 'any of the gherkin supported languages',
|
71
107
|
default: :en
|
108
|
+
|
72
109
|
def android_step(name)
|
73
110
|
I18n.config.default_locale = options[:lang]
|
74
111
|
in_root_project_folder?
|
@@ -79,43 +116,70 @@ module Sunomono
|
|
79
116
|
option :lang,
|
80
117
|
banner: 'any of the gherkin supported languages',
|
81
118
|
default: :en
|
119
|
+
|
82
120
|
def ios_step(name)
|
83
121
|
I18n.config.default_locale = options[:lang]
|
84
122
|
in_root_project_folder?
|
85
123
|
create_steps_file name, 'IOS'
|
86
124
|
end
|
87
125
|
|
88
|
-
desc 'screen [RESOURCE_NAME]',
|
126
|
+
desc 'screen [FRAMEWORK(calabash or appium)] [RESOURCE_NAME]',
|
89
127
|
'Generates the Android and iOS dependent screens'
|
90
128
|
option :lang,
|
91
129
|
banner: 'any of the gherkin supported languages',
|
92
130
|
default: :en
|
93
|
-
|
131
|
+
|
132
|
+
def screen(framework, name)
|
133
|
+
framework_avaliable?(framework)
|
134
|
+
|
94
135
|
I18n.config.default_locale = options[:lang]
|
95
136
|
in_root_project_folder?
|
96
|
-
|
97
|
-
|
137
|
+
|
138
|
+
if framework.downcase == 'calabash'
|
139
|
+
create_screen_file name, 'Android'
|
140
|
+
create_screen_file name, 'IOS'
|
141
|
+
else
|
142
|
+
create_appium_screen_file name, 'Android'
|
143
|
+
create_appium_screen_file name, 'IOS'
|
144
|
+
end
|
98
145
|
end
|
99
146
|
|
100
|
-
desc 'android-screen [RESOURCE_NAME]',
|
147
|
+
desc 'android-screen [FRAMEWORK(calabash or appium)] [RESOURCE_NAME]',
|
101
148
|
'Generates an Android dependent screen'
|
102
149
|
option :lang,
|
103
150
|
banner: 'any of the gherkin supported languages',
|
104
151
|
default: :en
|
105
|
-
|
152
|
+
|
153
|
+
def android_screen(framework ,name)
|
154
|
+
framework_avaliable?(framework)
|
155
|
+
|
106
156
|
I18n.config.default_locale = options[:lang]
|
107
157
|
in_root_project_folder?
|
108
|
-
|
158
|
+
|
159
|
+
if framework.downcase == 'calabash'
|
160
|
+
create_screen_file name, 'Android'
|
161
|
+
else
|
162
|
+
create_appium_screen_file name, 'Android'
|
163
|
+
end
|
109
164
|
end
|
110
165
|
|
111
|
-
desc 'ios-screen [RESOURCE_NAME]',
|
166
|
+
desc 'ios-screen [FRAMEWORK(calabash or appium)] [RESOURCE_NAME]',
|
167
|
+
'Generates an iOS dependent screen'
|
112
168
|
option :lang,
|
113
169
|
banner: 'any of the gherkin supported languages',
|
114
170
|
default: :en
|
115
|
-
|
171
|
+
|
172
|
+
def ios_screen(framework ,name)
|
173
|
+
framework_avaliable?(framework)
|
174
|
+
|
116
175
|
I18n.config.default_locale = options[:lang]
|
117
176
|
in_root_project_folder?
|
118
|
-
|
177
|
+
|
178
|
+
if framework.downcase == 'calabash'
|
179
|
+
create_screen_file name, 'IOS'
|
180
|
+
else
|
181
|
+
create_appium_screen_file name, 'IOS'
|
182
|
+
end
|
119
183
|
end
|
120
184
|
|
121
185
|
desc 'aws-zip', 'Prepare a zip file for AWS Device Farm execution'
|
@@ -123,6 +187,7 @@ module Sunomono
|
|
123
187
|
banner: 'skips the special chars validation that can cancel the zip creation',
|
124
188
|
type: :boolean,
|
125
189
|
lazy_default: true
|
190
|
+
|
126
191
|
def aws_zip
|
127
192
|
in_root_project_folder?
|
128
193
|
|
@@ -164,30 +229,52 @@ module Sunomono
|
|
164
229
|
'g [GENERATOR] [RESOURCE_NAME]',
|
165
230
|
'Generates various resources'
|
166
231
|
|
167
|
-
desc 'new PROJECT_NAME',
|
232
|
+
desc 'new FRAMEWORK(calabash or appium) PROJECT_NAME',
|
168
233
|
'Generates the structure of a new project that uses '\
|
169
|
-
'Calabash in both Android and iOS apps'
|
234
|
+
'Calabash or Appium in both Android and iOS apps'
|
170
235
|
option :lang,
|
171
236
|
banner: 'any of the gherkin supported languages',
|
172
237
|
default: :en
|
173
|
-
|
238
|
+
|
239
|
+
def new(platform, name)
|
240
|
+
if platform != 'calabash' && platform != 'appium'
|
241
|
+
puts "#{platform} is a invalid platform, please type calabash or appium"
|
242
|
+
exit 1
|
243
|
+
end
|
244
|
+
|
174
245
|
I18n.config.default_locale = options[:lang]
|
175
246
|
# Thor will be responsible to look for identical
|
176
247
|
# files and possibles conflicts
|
177
|
-
|
178
|
-
|
248
|
+
if platform.downcase == 'calabash'
|
249
|
+
directory File.join(File.dirname(__FILE__),
|
250
|
+
'..', 'lib', 'skeleton_'+ platform.to_s), name
|
179
251
|
|
180
|
-
|
181
|
-
|
182
|
-
|
252
|
+
# Copying base steps file with localization
|
253
|
+
template('base_steps', File.join(name, 'features', 'step_definitions',
|
254
|
+
'base_steps.rb'))
|
183
255
|
|
184
|
-
|
185
|
-
|
186
|
-
|
256
|
+
# Copying android screen base file with localization
|
257
|
+
template('android_screen_base', File.join(name, 'features', 'android',
|
258
|
+
'android_screen_base.rb'))
|
187
259
|
|
188
|
-
|
189
|
-
|
190
|
-
|
260
|
+
# Copying ios screen base file with localization
|
261
|
+
template('ios_screen_base',
|
262
|
+
File.join(name, 'features', 'ios', 'ios_screen_base.rb'))
|
263
|
+
else
|
264
|
+
I18n.config.default_locale = options[:lang]
|
265
|
+
# Thor will be responsible to look for identical
|
266
|
+
# files and possibles conflicts
|
267
|
+
directory File.join(File.dirname(__FILE__),
|
268
|
+
'..', 'lib', 'skeleton_'+ platform.to_s), name
|
269
|
+
|
270
|
+
# Copying base steps file with localization
|
271
|
+
template('appium_base_steps', File.join(name, 'features', 'step_definitions',
|
272
|
+
'base_steps.rb'))
|
273
|
+
|
274
|
+
# Copying screen base file with localization
|
275
|
+
template('appium_base_screen', File.join(name, 'features', 'base_screen',
|
276
|
+
'base_screen.rb'))
|
277
|
+
end
|
191
278
|
end
|
192
279
|
|
193
280
|
desc 'version', 'Shows the gem version'
|
@@ -205,18 +292,18 @@ module Sunomono
|
|
205
292
|
super
|
206
293
|
# Loading gherkin accepted translations
|
207
294
|
translations_file_path = File.join(
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
295
|
+
Gem.loaded_specs['gherkin'].full_gem_path,
|
296
|
+
'lib',
|
297
|
+
'gherkin',
|
298
|
+
'i18n.json'
|
212
299
|
)
|
213
300
|
# Parsing the JSON file
|
214
301
|
# Removing the sequence *| and all the alternative
|
215
302
|
# options for the gherkin translations
|
216
303
|
translations_json = JSON.parse(
|
217
|
-
|
218
|
-
|
219
|
-
|
304
|
+
File.read(translations_file_path)
|
305
|
+
.gsub(/\*\|/, '')
|
306
|
+
.gsub(/\|.*\"/, '"')
|
220
307
|
)
|
221
308
|
# Converting the translations to YAML and storing in a temp file
|
222
309
|
translations_temp_file = Tempfile.new(['translations', '.yml'])
|
@@ -224,12 +311,12 @@ module Sunomono
|
|
224
311
|
# Loading the translations from gherkin and from the
|
225
312
|
# locales folder of this gem
|
226
313
|
locales_folder_path = File.join(
|
227
|
-
|
228
|
-
|
314
|
+
File.dirname(__FILE__),
|
315
|
+
'..', 'lib', 'sunomono', 'locales'
|
229
316
|
)
|
230
317
|
I18n.load_path = Dir[
|
231
|
-
|
232
|
-
|
318
|
+
translations_temp_file,
|
319
|
+
File.join(locales_folder_path, '*.yml')
|
233
320
|
]
|
234
321
|
I18n.backend.load_translations
|
235
322
|
I18n.config.enforce_available_locales = true
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'appium_lib'
|
2
|
+
|
3
|
+
class BaseScreen
|
4
|
+
def self.element(element_name, &block)
|
5
|
+
define_method(element_name.to_s, *block)
|
6
|
+
end
|
7
|
+
|
8
|
+
class << self
|
9
|
+
alias_method :value, :element
|
10
|
+
alias_method :action, :element
|
11
|
+
alias_method :trait, :element
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
######### <%= I18n.translate( :given ).upcase %> #########
|
2
|
+
<%= I18n.translate( :given ).capitalize %>(/^<%= I18n.translate( "steps.drag_until" ) %>$/) do |direction, element|
|
3
|
+
pending
|
4
|
+
end
|
5
|
+
|
6
|
+
<%= I18n.translate( :given ).capitalize %>(/^<%= I18n.translate( "steps.page_contains" ) %>$/) do |page_text|
|
7
|
+
pending
|
8
|
+
end
|
9
|
+
|
10
|
+
######### <%= I18n.translate( :when ).upcase %> #########
|
11
|
+
|
12
|
+
<%= I18n.translate( :when ).capitalize %>(/^<%= I18n.translate( "steps.drag_number_of_times" ) %>$/) do |direction, times|
|
13
|
+
pending
|
14
|
+
end
|
15
|
+
|
16
|
+
<%= I18n.translate( :when ).capitalize %>(/^<%= I18n.translate( "steps.touch_element" ) %>$/) do |element|
|
17
|
+
pending
|
18
|
+
end
|
19
|
+
|
20
|
+
<%= I18n.translate( :when ).capitalize %>(/^<%= I18n.translate( "steps.drag_screen" ) %>$/) do |direction|
|
21
|
+
pending
|
22
|
+
end
|
23
|
+
|
24
|
+
<%= I18n.translate( :when ).capitalize %>(/^<%= I18n.translate( "steps.restart_app" ) %>$/) do
|
25
|
+
pending
|
26
|
+
end
|
27
|
+
|
28
|
+
######### <%= I18n.translate( :then ).upcase %> #########
|
29
|
+
|
30
|
+
<%= I18n.translate( :then ).capitalize %>(/^<%= I18n.translate "steps.wait_progress_bar" %>$/) do
|
31
|
+
pending
|
32
|
+
end
|
33
|
+
|
34
|
+
<%= I18n.translate( :then ).capitalize %>(/^<%= I18n.translate "steps.should_see_page" %>$/) do |page_text|
|
35
|
+
pending
|
36
|
+
end
|
37
|
+
|
38
|
+
<%= I18n.translate( :then ).capitalize %>(/^<%= I18n.translate "steps.should_see_page_that_contains" %>$/) do |page_text|
|
39
|
+
pending
|
40
|
+
end
|
41
|
+
<% unless I18n.config.default_locale == :en %>
|
42
|
+
|
43
|
+
<%= I18n.translate( :then ).capitalize %>(/^<%= I18n.translate "steps.take_print" %>$/) do
|
44
|
+
pending
|
45
|
+
end
|
46
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class <%= config[:name] %>Screen < BaseScreen
|
2
|
+
# <%= I18n.translate 'comments.trait' %>
|
3
|
+
#trait(:trait) { "'#{layout_name}'" }
|
4
|
+
# <%= I18n.translate 'comments.elements' %>
|
5
|
+
# element(:layout_name) { pending 'Insert button identificator' }
|
6
|
+
# element(:button) { pending 'Insert button identificator' }
|
7
|
+
end
|