Ifd_Mobile 1.4.0 → 1.5.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/bin/Ifd_Mobile +25 -25
- data/bin/generate.rb +20 -20
- data/bin/helper.rb +50 -50
- data/lib/Ifd_Mobile.rb +1 -1
- data/lib/Ifd_Mobile/lib_steps.rb +145 -145
- data/lib/Ifd_Mobile/methods/IFD_Assertion.rb +44 -44
- data/lib/Ifd_Mobile/methods/IFD_Connection.rb +15 -28
- data/lib/Ifd_Mobile/methods/auto_utils.rb +67 -0
- data/lib/Ifd_Mobile/methods/core.rb +241 -240
- data/lib/Ifd_Mobile/methods/lib_var.rb +53 -53
- data/lib/Ifd_Mobile/methods/required_files.rb +11 -20
- data/lib/Ifd_Mobile/version.rb +5 -5
- data/lib/LICENSE +2 -2
- data/project/Gemfile +11 -11
- data/project/Gemfile.lock +182 -0
- data/project/features/TestData/globalData.yml +1 -1
- data/project/features/TestSuite/login.feature +8 -6
- data/project/features/step_definitions/lib_steps/step_demo.rb +3 -14
- data/project/features/step_definitions/repositories/project_object.yml +4 -3
- data/project/features/support/env.rb +33 -50
- data/project/features/support/hooks.rb +34 -8
- data/project/features/support/project_config.yml +7 -7
- metadata +99 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9992e6afee76a17d80a0026b9acfe270f27d16e
|
4
|
+
data.tar.gz: c71c2ac93f54154044fdddab264a38061768027f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67bdcc490c523d5db83278a69fcf41bb30f3da7a00712e19d5879faf31661b95463730f09e8caf75c50c9c7d0794f5bdac1c30955503e5411305c6573856e401
|
7
|
+
data.tar.gz: eb2c7fb6f551fc159ab2de41adb2de7fa931b7f1322eeec1f482c445b34b72cf3efa920d5ff684dfc9989dcf96fef4a0e75078e5ca2612ef4d8ad2c2a7fa7b35
|
data/bin/Ifd_Mobile
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require_relative 'helper.rb'
|
4
|
-
require_relative 'generate.rb'
|
5
|
-
require 'Ifd_Mobile/version'
|
6
|
-
|
7
|
-
@features_dir = File.join(FileUtils.pwd, "project")
|
8
|
-
@source_dir = File.join(File.dirname(__FILE__), '..', 'project')
|
9
|
-
|
10
|
-
if (ARGV.length == 0)
|
11
|
-
print_usage
|
12
|
-
else
|
13
|
-
cmd = ARGV.shift
|
14
|
-
|
15
|
-
if cmd == "help"
|
16
|
-
print_help
|
17
|
-
elsif cmd == "gen"
|
18
|
-
ifd_mobile_scaffold
|
19
|
-
elsif cmd == "version"
|
20
|
-
puts Ifd::Mobile::VERSION
|
21
|
-
else
|
22
|
-
print_usage
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative 'helper.rb'
|
4
|
+
require_relative 'generate.rb'
|
5
|
+
require 'Ifd_Mobile/version'
|
6
|
+
|
7
|
+
@features_dir = File.join(FileUtils.pwd, "project")
|
8
|
+
@source_dir = File.join(File.dirname(__FILE__), '..', 'project')
|
9
|
+
|
10
|
+
if (ARGV.length == 0)
|
11
|
+
print_usage
|
12
|
+
else
|
13
|
+
cmd = ARGV.shift
|
14
|
+
|
15
|
+
if cmd == "help"
|
16
|
+
print_help
|
17
|
+
elsif cmd == "gen"
|
18
|
+
ifd_mobile_scaffold
|
19
|
+
elsif cmd == "version"
|
20
|
+
puts Ifd::Mobile::VERSION
|
21
|
+
else
|
22
|
+
print_usage
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
data/bin/generate.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
|
2
|
-
def ifd_mobile_scaffold
|
3
|
-
if File.exists?(@features_dir)
|
4
|
-
puts "A features directory already exists. Stopping..."
|
5
|
-
exit 1
|
6
|
-
end
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
FileUtils.cp_r(@source_dir, @features_dir)
|
15
|
-
|
16
|
-
msg("Info") do
|
17
|
-
puts "features subdirectory created. \n"
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
1
|
+
|
2
|
+
def ifd_mobile_scaffold
|
3
|
+
if File.exists?(@features_dir)
|
4
|
+
puts "A features directory already exists. Stopping..."
|
5
|
+
exit 1
|
6
|
+
end
|
7
|
+
msg("Question") do
|
8
|
+
puts "I'm about to create a subdirectory called features."
|
9
|
+
puts "features will contain all your project tests."
|
10
|
+
puts "Please hit return to confirm that's what you want."
|
11
|
+
end
|
12
|
+
exit 2 unless STDIN.gets.chomp == ''
|
13
|
+
|
14
|
+
FileUtils.cp_r(@source_dir, @features_dir)
|
15
|
+
|
16
|
+
msg("Info") do
|
17
|
+
puts "features subdirectory created. \n"
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
data/bin/helper.rb
CHANGED
@@ -1,51 +1,51 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
require 'json'
|
3
|
-
require "rubygems"
|
4
|
-
|
5
|
-
def msg(title, &block)
|
6
|
-
puts "\n" + "-"*10 + title + "-"*10
|
7
|
-
block.call
|
8
|
-
puts "-"*10 + "-------" + "-"*10 + "\n"
|
9
|
-
end
|
10
|
-
|
11
|
-
def print_usage
|
12
|
-
puts <<EOF
|
13
|
-
|
14
|
-
Usage: Ifd_Mobile <command-name> [parameters] [options]
|
15
|
-
|
16
|
-
<command-name> can be one of
|
17
|
-
help
|
18
|
-
prints more detailed help information.
|
19
|
-
gen
|
20
|
-
generate a features folder structure.
|
21
|
-
version
|
22
|
-
prints the gem version
|
23
|
-
|
24
|
-
<options> can be
|
25
|
-
-v, --verbose Turns on verbose logging
|
26
|
-
EOF
|
27
|
-
end
|
28
|
-
|
29
|
-
def print_help
|
30
|
-
puts <<EOF
|
31
|
-
|
32
|
-
Usage: Ifd_Mobile <command-name> [parameters] [options]
|
33
|
-
|
34
|
-
<command-name> can be one of
|
35
|
-
help
|
36
|
-
gen
|
37
|
-
version
|
38
|
-
|
39
|
-
Commands:
|
40
|
-
help : prints more detailed help information.
|
41
|
-
|
42
|
-
gen : creates a features dir. This is usually used once when
|
43
|
-
setting up ifd-mobile to ensure that the features folder contains
|
44
|
-
the right step definitions and environment to run with cucumber.
|
45
|
-
|
46
|
-
version : prints the gem version
|
47
|
-
|
48
|
-
<Options>
|
49
|
-
-v, --verbose Turns on verbose logging
|
50
|
-
EOF
|
1
|
+
require 'tempfile'
|
2
|
+
require 'json'
|
3
|
+
require "rubygems"
|
4
|
+
|
5
|
+
def msg(title, &block)
|
6
|
+
puts "\n" + "-"*10 + title + "-"*10
|
7
|
+
block.call
|
8
|
+
puts "-"*10 + "-------" + "-"*10 + "\n"
|
9
|
+
end
|
10
|
+
|
11
|
+
def print_usage
|
12
|
+
puts <<EOF
|
13
|
+
|
14
|
+
Usage: Ifd_Mobile <command-name> [parameters] [options]
|
15
|
+
|
16
|
+
<command-name> can be one of
|
17
|
+
help
|
18
|
+
prints more detailed help information.
|
19
|
+
gen
|
20
|
+
generate a features folder structure.
|
21
|
+
version
|
22
|
+
prints the gem version
|
23
|
+
|
24
|
+
<options> can be
|
25
|
+
-v, --verbose Turns on verbose logging
|
26
|
+
EOF
|
27
|
+
end
|
28
|
+
|
29
|
+
def print_help
|
30
|
+
puts <<EOF
|
31
|
+
|
32
|
+
Usage: Ifd_Mobile <command-name> [parameters] [options]
|
33
|
+
|
34
|
+
<command-name> can be one of
|
35
|
+
help
|
36
|
+
gen
|
37
|
+
version
|
38
|
+
|
39
|
+
Commands:
|
40
|
+
help : prints more detailed help information.
|
41
|
+
|
42
|
+
gen : creates a features dir. This is usually used once when
|
43
|
+
setting up ifd-mobile to ensure that the features folder contains
|
44
|
+
the right step definitions and environment to run with cucumber.
|
45
|
+
|
46
|
+
version : prints the gem version
|
47
|
+
|
48
|
+
<Options>
|
49
|
+
-v, --verbose Turns on verbose logging
|
50
|
+
EOF
|
51
51
|
end
|
data/lib/Ifd_Mobile.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Dir[File.dirname(__FILE__) + '/Ifd_Mobile/*.rb'].each { |file| require file }
|
1
|
+
Dir[File.dirname(__FILE__) + '/Ifd_Mobile/*.rb'].each { |file| require file }
|
data/lib/Ifd_Mobile/lib_steps.rb
CHANGED
@@ -1,145 +1,145 @@
|
|
1
|
-
require_relative 'methods/required_files'
|
2
|
-
|
3
|
-
Given(/^I have App running with appium$/) do
|
4
|
-
# Make sure you have started appium server
|
5
|
-
end
|
6
|
-
|
7
|
-
# Wait for the specific time
|
8
|
-
When /^I wait for (\d+) seconds$/ do |second|
|
9
|
-
sleep(second.to_i)
|
10
|
-
end
|
11
|
-
|
12
|
-
And /^I input text "(.*)" on "(.*)"$/ do |text,object|
|
13
|
-
execute_settext(object,text)
|
14
|
-
end
|
15
|
-
|
16
|
-
And /^I click on "(.*)"$/ do |object|
|
17
|
-
execute_click object
|
18
|
-
end
|
19
|
-
|
20
|
-
Then /^I verify property "(.*)" with "(.*)" has( | not)? value "(.*)"$/ do |object, property, negate, value|
|
21
|
-
sleep(0.5)
|
22
|
-
value =
|
23
|
-
execute_checkproperty(object, property, negate, value)
|
24
|
-
end
|
25
|
-
|
26
|
-
Given /^I click on element with x: "(.*)", y: "(.*)"$/ do |x,y|
|
27
|
-
click_by_coordinate x,y
|
28
|
-
end
|
29
|
-
|
30
|
-
And /^I scroll the screen from startX (\d+) startY (\d+) to endX (\d+) endY (\d+) and millisecond timeout is (\d+)$/ do |startX, startY, endX, endY, timeout|
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
Given /^I get attribute of element "(.*)"$/ do |element|
|
35
|
-
found_element = find_object element
|
36
|
-
actual_value = found_element.attribute("name")
|
37
|
-
puts actual_value
|
38
|
-
end
|
39
|
-
|
40
|
-
# And /^I rotate device to (landscape|portrait)$/ do |type|
|
41
|
-
# case type.to_sym
|
42
|
-
# when :landscape
|
43
|
-
# $driver.rotate :landscape
|
44
|
-
# when :portrait
|
45
|
-
# $driver.rotate :portrait
|
46
|
-
# else
|
47
|
-
# raise "ERROR: *** unknown rotate type"
|
48
|
-
# end
|
49
|
-
# end
|
50
|
-
|
51
|
-
And /^I accept alert$/ do
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
And /^I dismiss alert$/ do
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
And /^I hide the keyboard$/ do
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
Then(/^I tap on back button of device$/) do
|
64
|
-
navigate('back')
|
65
|
-
end
|
66
|
-
|
67
|
-
Then(/^I tap on forward button of device$/) do
|
68
|
-
navigate('forward')
|
69
|
-
end
|
70
|
-
|
71
|
-
# #---------- Swipe with direction
|
72
|
-
# Then(/^I swipe left$/) do
|
73
|
-
# swipe_direction("left")
|
74
|
-
# end
|
75
|
-
#
|
76
|
-
# Then(/^I swipe right$/) do
|
77
|
-
# swipe_direction("right")
|
78
|
-
# end
|
79
|
-
#
|
80
|
-
# Then(/^I swipe up$/) do
|
81
|
-
# swipe_direction("up")
|
82
|
-
# end
|
83
|
-
#
|
84
|
-
# Then(/^I swipe down$/) do
|
85
|
-
# swipe_direction("down")
|
86
|
-
# end
|
87
|
-
|
88
|
-
Then(/^I long tap on element having "(.*?)"$/) do |element|
|
89
|
-
long_press_on_element_default_duration(element)
|
90
|
-
end
|
91
|
-
|
92
|
-
Then(/^I long tap on element having (.+) "(.*?)" for "(.*?)" sec$/) do |element, duration|
|
93
|
-
long_press_on_element_with_duration(element, duration)
|
94
|
-
end
|
95
|
-
|
96
|
-
Then(/^I long tap on co\-ordinate "(.*?)","(.*?)"$/) do |x, y|
|
97
|
-
long_press_on_coordinates(x, y)
|
98
|
-
end
|
99
|
-
|
100
|
-
Then(/^I long tap on co\-ordinate "(.*?)","(.*?)" for "(.*?)" sec$/) do |x, y, duration|
|
101
|
-
long_press_on_coordinates_with_duration(x, y, duration)
|
102
|
-
end
|
103
|
-
|
104
|
-
Then(/^I close app$/) do
|
105
|
-
close_app
|
106
|
-
end
|
107
|
-
|
108
|
-
Then(/^I launch app$/) do
|
109
|
-
launch_app
|
110
|
-
end
|
111
|
-
|
112
|
-
Then(/^I reset app$/) do
|
113
|
-
reset_app
|
114
|
-
end
|
115
|
-
|
116
|
-
And /^I set app to run background within (\d+)$/ do |seconds|
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
And /^I press button (\d+)$/ do |button_index|
|
121
|
-
# Find a button by index
|
122
|
-
button(button_index.to_i).click
|
123
|
-
end
|
124
|
-
|
125
|
-
Given /^I set text "(.*)" on filed index (\d+)$/ do |value, field|
|
126
|
-
# Get a textfield by index
|
127
|
-
textfield(field.to_i).type value
|
128
|
-
end
|
129
|
-
|
130
|
-
################## List of Steps support Android only#####################
|
131
|
-
Given /^I scroll to text "(.*)" Android$/ do |text|
|
132
|
-
scroll_to(text)
|
133
|
-
end
|
134
|
-
|
135
|
-
And /^I go home screen Android$/ do
|
136
|
-
move_home
|
137
|
-
end
|
138
|
-
|
139
|
-
And /^I delete an character on Android$/ do
|
140
|
-
delete_an_character_android
|
141
|
-
end
|
142
|
-
|
143
|
-
And /^I take a photo on Android$/ do
|
144
|
-
take_photo_android
|
145
|
-
end
|
1
|
+
require_relative 'methods/required_files'
|
2
|
+
|
3
|
+
Given(/^I have App running with appium$/) do
|
4
|
+
# Make sure you have started appium server
|
5
|
+
end
|
6
|
+
|
7
|
+
# Wait for the specific time
|
8
|
+
When /^I wait for (\d+) seconds$/ do |second|
|
9
|
+
sleep(second.to_i)
|
10
|
+
end
|
11
|
+
|
12
|
+
And /^I input text "(.*)" on "(.*)"$/ do |text,object|
|
13
|
+
execute_settext(object,text)
|
14
|
+
end
|
15
|
+
|
16
|
+
And /^I click on "(.*)"$/ do |object|
|
17
|
+
execute_click object
|
18
|
+
end
|
19
|
+
|
20
|
+
Then /^I verify property "(.*)" with "(.*)" has( | not)? value "(.*)"$/ do |object, property, negate, value|
|
21
|
+
sleep(0.5)
|
22
|
+
value = bind_with_dyn_vars value
|
23
|
+
execute_checkproperty(object, property, negate, value)
|
24
|
+
end
|
25
|
+
|
26
|
+
Given /^I click on element with x: "(.*)", y: "(.*)"$/ do |x,y|
|
27
|
+
click_by_coordinate x,y
|
28
|
+
end
|
29
|
+
|
30
|
+
And /^I scroll the screen from startX (\d+) startY (\d+) to endX (\d+) endY (\d+) and millisecond timeout is (\d+)$/ do |startX, startY, endX, endY, timeout|
|
31
|
+
@driver.swipe(start_x: startX, start_y: startY, end_x: endX, end_y: endY, duration: timeout)
|
32
|
+
end
|
33
|
+
|
34
|
+
Given /^I get attribute of element "(.*)"$/ do |element|
|
35
|
+
found_element = find_object element
|
36
|
+
actual_value = found_element.attribute("name")
|
37
|
+
puts actual_value
|
38
|
+
end
|
39
|
+
|
40
|
+
# And /^I rotate device to (landscape|portrait)$/ do |type|
|
41
|
+
# case type.to_sym
|
42
|
+
# when :landscape
|
43
|
+
# $driver.rotate :landscape
|
44
|
+
# when :portrait
|
45
|
+
# $driver.rotate :portrait
|
46
|
+
# else
|
47
|
+
# raise "ERROR: *** unknown rotate type"
|
48
|
+
# end
|
49
|
+
# end
|
50
|
+
|
51
|
+
And /^I accept alert$/ do
|
52
|
+
@driver.alert_accept
|
53
|
+
end
|
54
|
+
|
55
|
+
And /^I dismiss alert$/ do
|
56
|
+
@driver.alert_dismiss
|
57
|
+
end
|
58
|
+
|
59
|
+
And /^I hide the keyboard$/ do
|
60
|
+
@driver.hide_keyboard
|
61
|
+
end
|
62
|
+
|
63
|
+
Then(/^I tap on back button of device$/) do
|
64
|
+
navigate('back')
|
65
|
+
end
|
66
|
+
|
67
|
+
Then(/^I tap on forward button of device$/) do
|
68
|
+
navigate('forward')
|
69
|
+
end
|
70
|
+
|
71
|
+
# #---------- Swipe with direction
|
72
|
+
# Then(/^I swipe left$/) do
|
73
|
+
# swipe_direction("left")
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# Then(/^I swipe right$/) do
|
77
|
+
# swipe_direction("right")
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# Then(/^I swipe up$/) do
|
81
|
+
# swipe_direction("up")
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# Then(/^I swipe down$/) do
|
85
|
+
# swipe_direction("down")
|
86
|
+
# end
|
87
|
+
|
88
|
+
Then(/^I long tap on element having "(.*?)"$/) do |element|
|
89
|
+
long_press_on_element_default_duration(element)
|
90
|
+
end
|
91
|
+
|
92
|
+
Then(/^I long tap on element having (.+) "(.*?)" for "(.*?)" sec$/) do |element, duration|
|
93
|
+
long_press_on_element_with_duration(element, duration)
|
94
|
+
end
|
95
|
+
|
96
|
+
Then(/^I long tap on co\-ordinate "(.*?)","(.*?)"$/) do |x, y|
|
97
|
+
long_press_on_coordinates(x, y)
|
98
|
+
end
|
99
|
+
|
100
|
+
Then(/^I long tap on co\-ordinate "(.*?)","(.*?)" for "(.*?)" sec$/) do |x, y, duration|
|
101
|
+
long_press_on_coordinates_with_duration(x, y, duration)
|
102
|
+
end
|
103
|
+
|
104
|
+
Then(/^I close app$/) do
|
105
|
+
close_app
|
106
|
+
end
|
107
|
+
|
108
|
+
Then(/^I launch app$/) do
|
109
|
+
launch_app
|
110
|
+
end
|
111
|
+
|
112
|
+
Then(/^I reset app$/) do
|
113
|
+
reset_app
|
114
|
+
end
|
115
|
+
|
116
|
+
And /^I set app to run background within (\d+)$/ do |seconds|
|
117
|
+
@driver.background_app seconds
|
118
|
+
end
|
119
|
+
|
120
|
+
And /^I press button (\d+)$/ do |button_index|
|
121
|
+
# Find a button by index
|
122
|
+
button(button_index.to_i).click
|
123
|
+
end
|
124
|
+
|
125
|
+
Given /^I set text "(.*)" on filed index (\d+)$/ do |value, field|
|
126
|
+
# Get a textfield by index
|
127
|
+
textfield(field.to_i).type value
|
128
|
+
end
|
129
|
+
|
130
|
+
################## List of Steps support Android only#####################
|
131
|
+
Given /^I scroll to text "(.*)" Android$/ do |text|
|
132
|
+
scroll_to(text)
|
133
|
+
end
|
134
|
+
|
135
|
+
And /^I go home screen Android$/ do
|
136
|
+
move_home
|
137
|
+
end
|
138
|
+
|
139
|
+
And /^I delete an character on Android$/ do
|
140
|
+
delete_an_character_android
|
141
|
+
end
|
142
|
+
|
143
|
+
And /^I take a photo on Android$/ do
|
144
|
+
take_photo_android
|
145
|
+
end
|