Ifd_Mobile 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,44 +1,44 @@
|
|
1
|
-
# include Test::Unit::Assertions
|
2
|
-
class IFD_Assertion
|
3
|
-
# Assert 2 values
|
4
|
-
def self.reg_compare sActual, regValue, isSpecialChar=false
|
5
|
-
begin
|
6
|
-
if !isSpecialChar
|
7
|
-
sActual = sActual.strip
|
8
|
-
regValue = regValue.strip.gsub("[", "\\[").gsub("]", "\\]").gsub("(", "\\(").gsub(")", "\\)").gsub(">", "\\>")
|
9
|
-
end
|
10
|
-
rescue StandardError => myStandardError
|
11
|
-
put_log "\n>>> Error: #{myStandardError}"
|
12
|
-
end
|
13
|
-
|
14
|
-
# put_log "\nsActual:#{sActual}, regValue:#{regValue}"
|
15
|
-
if ((sActual.nil? and regValue.nil?) or (!sActual.nil? and sActual.empty? and !regValue.nil? and regValue.empty?))
|
16
|
-
return true
|
17
|
-
end
|
18
|
-
|
19
|
-
if ((sActual.nil? and !regValue.nil?) or (!sActual.nil? and regValue.nil?))
|
20
|
-
return false
|
21
|
-
end
|
22
|
-
|
23
|
-
if (!sActual.nil? and !sActual.empty?)
|
24
|
-
sCookActual = sActual.gsub(/\n|\r/, " ")
|
25
|
-
if (sCookActual == regValue or (isSpecialChar and sCookActual.include? regValue) or (!isSpecialChar and sCookActual =~ /^.*#{regValue}.*$/))
|
26
|
-
return true
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
return false
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.assert_string_contain(expected, actual)
|
34
|
-
unless (actual.to_s).include? (expected.to_s)
|
35
|
-
raise ("*** ASSERTION ERROR: \nExpected: #{expected}. \nGot: #{actual}.")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.assert_string_equal(expected, actual)
|
40
|
-
if expected.to_s != actual.to_s
|
41
|
-
raise ("*** ASSERTION ERROR: \nExpected: #{expected}. \nGot: #{actual}.")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
1
|
+
# include Test::Unit::Assertions
|
2
|
+
class IFD_Assertion
|
3
|
+
# Assert 2 values
|
4
|
+
def self.reg_compare sActual, regValue, isSpecialChar=false
|
5
|
+
begin
|
6
|
+
if !isSpecialChar
|
7
|
+
sActual = sActual.strip
|
8
|
+
regValue = regValue.strip.gsub("[", "\\[").gsub("]", "\\]").gsub("(", "\\(").gsub(")", "\\)").gsub(">", "\\>")
|
9
|
+
end
|
10
|
+
rescue StandardError => myStandardError
|
11
|
+
put_log "\n>>> Error: #{myStandardError}"
|
12
|
+
end
|
13
|
+
|
14
|
+
# put_log "\nsActual:#{sActual}, regValue:#{regValue}"
|
15
|
+
if ((sActual.nil? and regValue.nil?) or (!sActual.nil? and sActual.empty? and !regValue.nil? and regValue.empty?))
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
|
19
|
+
if ((sActual.nil? and !regValue.nil?) or (!sActual.nil? and regValue.nil?))
|
20
|
+
return false
|
21
|
+
end
|
22
|
+
|
23
|
+
if (!sActual.nil? and !sActual.empty?)
|
24
|
+
sCookActual = sActual.gsub(/\n|\r/, " ")
|
25
|
+
if (sCookActual == regValue or (isSpecialChar and sCookActual.include? regValue) or (!isSpecialChar and sCookActual =~ /^.*#{regValue}.*$/))
|
26
|
+
return true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
return false
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.assert_string_contain(expected, actual)
|
34
|
+
unless (actual.to_s).include? (expected.to_s)
|
35
|
+
raise ("*** ASSERTION ERROR: \nExpected: #{expected}. \nGot: #{actual}.")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.assert_string_equal(expected, actual)
|
40
|
+
if expected.to_s != actual.to_s
|
41
|
+
raise ("*** ASSERTION ERROR: \nExpected: #{expected}. \nGot: #{actual}.")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,28 +1,15 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# Open the SQL Server connection to specific schema
|
18
|
-
def self.get_sql_server_db_connection(schema)
|
19
|
-
begin
|
20
|
-
# puts ("Connecting to database...");
|
21
|
-
data_source_schema = schema.downcase
|
22
|
-
return TinyTds::Client.new(dataserver: $data_source_url, username: $data_source_username, password: $data_source_password, database:data_source_schema);
|
23
|
-
rescue Exception => e
|
24
|
-
raise "Cannot connect to database [username: %s; password: %s, dbUrl: %s, dbName: %s] with error %s" %
|
25
|
-
[$data_source_username, $data_source_password, $data_source_url,data_source_schema, e.message]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
1
|
+
# require 'tiny_tds'
|
2
|
+
# require 'activerecord-sqlserver-adapter'
|
3
|
+
# require 'active_record'
|
4
|
+
#
|
5
|
+
# module Connection
|
6
|
+
# def self.new(connection_params)
|
7
|
+
# begin
|
8
|
+
# put_log ("Connecting to database...")
|
9
|
+
# return ActiveRecord::Base.establish_connection(connection_params)
|
10
|
+
# rescue Exception => e
|
11
|
+
# raise e.message
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
#-----------------------------------------------------
|
2
|
+
# support define and bind variable dynamically
|
3
|
+
#-----------------------------------------------------
|
4
|
+
$dyn_vars = nil
|
5
|
+
|
6
|
+
# set value to a variable
|
7
|
+
def set_var(var_name, var_value)
|
8
|
+
if $dyn_vars == nil
|
9
|
+
$dyn_vars = binding
|
10
|
+
end
|
11
|
+
|
12
|
+
strEval = var_name + "=" + var_value
|
13
|
+
eval strEval, $dyn_vars
|
14
|
+
end
|
15
|
+
|
16
|
+
# bind string with $dyn_vars context
|
17
|
+
def bind_with_dyn_vars(str)
|
18
|
+
if $dyn_vars == nil
|
19
|
+
$dyn_vars = binding
|
20
|
+
end
|
21
|
+
|
22
|
+
strEval = '"' + str + '"'
|
23
|
+
return eval strEval, $dyn_vars
|
24
|
+
end
|
25
|
+
|
26
|
+
# evaluate operation/statement with $dyn_vars context
|
27
|
+
def eval_with_dyn_vars(operation)
|
28
|
+
if $dyn_vars == nil
|
29
|
+
$dyn_vars = binding
|
30
|
+
end
|
31
|
+
|
32
|
+
eval operation, $dyn_vars
|
33
|
+
end
|
34
|
+
|
35
|
+
def bind_with_dyn_json_vars(json, bind_json)
|
36
|
+
if json.kind_of? Hash
|
37
|
+
json.each_pair do |k, v|
|
38
|
+
if v.kind_of? String
|
39
|
+
bind_json[bind_with_dyn_vars(k)] = bind_with_dyn_json_vars(v, bind_json)
|
40
|
+
elsif v.kind_of? Hash
|
41
|
+
temp = Hash.new
|
42
|
+
v.each_pair do |k1, v1|
|
43
|
+
temp[bind_with_dyn_vars(k1)] = bind_with_dyn_json_vars(v1, temp)
|
44
|
+
end
|
45
|
+
bind_json[bind_with_dyn_vars(k)] = temp
|
46
|
+
elsif v.kind_of? Array
|
47
|
+
temp1 = Array.new
|
48
|
+
v.each {|item|
|
49
|
+
temp2 = Hash.new
|
50
|
+
bind_with_dyn_json_vars(item, temp2)
|
51
|
+
temp1 << temp2
|
52
|
+
}
|
53
|
+
bind_json[bind_with_dyn_vars(k)] = temp1
|
54
|
+
end
|
55
|
+
end
|
56
|
+
elsif json.kind_of? Array
|
57
|
+
temp1 = Array.new
|
58
|
+
json.each {|item|
|
59
|
+
temp2 = Hash.new
|
60
|
+
bind_with_dyn_json_vars(item, temp2)
|
61
|
+
temp1 << temp2
|
62
|
+
}
|
63
|
+
return temp1
|
64
|
+
else
|
65
|
+
return bind_with_dyn_vars(json)
|
66
|
+
end
|
67
|
+
end
|
@@ -1,241 +1,242 @@
|
|
1
|
-
def call_step str_step
|
2
|
-
put_log "\n-=> call step: #{str_step}"
|
3
|
-
step %{#{str_step}}
|
4
|
-
end
|
5
|
-
|
6
|
-
def put_log str
|
7
|
-
puts str if $
|
8
|
-
end
|
9
|
-
|
10
|
-
def find_object string_object
|
11
|
-
string_object = string_object.gsub(/"/, "'")
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
found_element
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
actual_value = found_element.attribute("
|
79
|
-
elsif property.upcase == '
|
80
|
-
actual_value = found_element.attribute("
|
81
|
-
elsif property.upcase == '
|
82
|
-
actual_value = found_element.attribute("
|
83
|
-
elsif property.upcase == '
|
84
|
-
actual_value = found_element.attribute("
|
85
|
-
|
86
|
-
actual_value = found_element.attribute("
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
146
|
-
#
|
147
|
-
#
|
148
|
-
#
|
149
|
-
#
|
150
|
-
#
|
151
|
-
#
|
152
|
-
#
|
153
|
-
#
|
154
|
-
|
155
|
-
|
156
|
-
#
|
157
|
-
# action.
|
158
|
-
#
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
action.
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
duration = duration
|
186
|
-
|
187
|
-
action.
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
end
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
action.
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
duration = duration
|
205
|
-
|
206
|
-
|
207
|
-
action.
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
1
|
+
def call_step str_step
|
2
|
+
put_log "\n-=> call step: #{str_step}"
|
3
|
+
step %{#{str_step}}
|
4
|
+
end
|
5
|
+
|
6
|
+
def put_log str
|
7
|
+
puts str if $print_log
|
8
|
+
end
|
9
|
+
|
10
|
+
def find_object string_object
|
11
|
+
string_object = string_object.gsub(/"/, "'")
|
12
|
+
hash_object = $OBJECT[string_object]
|
13
|
+
if hash_object.nil?
|
14
|
+
expect(true).to eq(false)
|
15
|
+
else
|
16
|
+
hash_object.each { |key, value|
|
17
|
+
$element_tag = key
|
18
|
+
$element_value = value
|
19
|
+
}
|
20
|
+
end
|
21
|
+
get_object_by_dynamic_selector($element_tag, $element_value)
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_object_by_dynamic_selector(selector_type,value)
|
25
|
+
foundElements = nil
|
26
|
+
begin
|
27
|
+
foundElements = @driver.find_element(selector_type, value)
|
28
|
+
rescue StandardError => myStandardError
|
29
|
+
p "\n>>> Error: #{myStandardError}"
|
30
|
+
end
|
31
|
+
foundElements
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute_click element
|
35
|
+
found_element = find_object element
|
36
|
+
if found_element != nil
|
37
|
+
startTime = Time.new.to_i
|
38
|
+
begin
|
39
|
+
sleep(1)
|
40
|
+
found_element.click
|
41
|
+
rescue StandardError => myStandardError
|
42
|
+
put_log "\nERROR: *** #{myStandardError}"
|
43
|
+
end
|
44
|
+
else
|
45
|
+
put_log "\nERROR: *** not found object: #{element}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def execute_settext element, text
|
50
|
+
found_element = find_object element
|
51
|
+
if found_element != nil
|
52
|
+
begin
|
53
|
+
sleep(1)
|
54
|
+
# found_element.long_press_keycode(46)
|
55
|
+
found_element.clear
|
56
|
+
found_element.send_keys(text)
|
57
|
+
rescue StandardError => myStandardError
|
58
|
+
put_log "\nERROR: *** #{myStandardError}"
|
59
|
+
end
|
60
|
+
else
|
61
|
+
put_log "\nERROR: *** not found object: #{element}"
|
62
|
+
exit
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def execute_checkproperty element, property, negate, value
|
67
|
+
found_element = find_object element
|
68
|
+
check = false
|
69
|
+
if found_element == nil and value == ""
|
70
|
+
check = true
|
71
|
+
expect(check).to eq true
|
72
|
+
else
|
73
|
+
put_log "\n*** Execute_CheckProperty: finish to found element"
|
74
|
+
if found_element != nil
|
75
|
+
if property.upcase == 'VALUE'
|
76
|
+
actual_value = found_element.attribute("value")
|
77
|
+
elsif property.upcase == 'NAME'
|
78
|
+
actual_value = found_element.attribute("name")
|
79
|
+
elsif property.upcase == 'LABEL'
|
80
|
+
actual_value = found_element.attribute("label")
|
81
|
+
elsif property.upcase == 'TYPE'
|
82
|
+
actual_value = found_element.attribute("type")
|
83
|
+
elsif property.upcase == 'ENABLE'
|
84
|
+
actual_value = found_element.attribute("enable")
|
85
|
+
else
|
86
|
+
actual_value = found_element.attribute("#{property}")
|
87
|
+
end
|
88
|
+
if actual_value == nil
|
89
|
+
actual_value = ''
|
90
|
+
end
|
91
|
+
else
|
92
|
+
put_log "ERROR: *** Not found object: #{element}"
|
93
|
+
end
|
94
|
+
|
95
|
+
if IFD_Assertion.reg_compare(actual_value, value)
|
96
|
+
check = true
|
97
|
+
end
|
98
|
+
|
99
|
+
put_log "\n#{property} :: Actual Result Is '#{actual_value}' -- Expected Result Is '#{value}'"
|
100
|
+
|
101
|
+
if negate == " not"
|
102
|
+
actual_value.should_not eq value
|
103
|
+
expect(actual_value).not_to eql value
|
104
|
+
elsif
|
105
|
+
actual_value.should eq value
|
106
|
+
expect(actual_value).to eq value
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def click_by_coordinate x, y
|
112
|
+
@driver.execute_script 'mobile: tap', :x => x, :y => y
|
113
|
+
end
|
114
|
+
|
115
|
+
# method to navigate back & forward
|
116
|
+
def navigate(direction)
|
117
|
+
if direction == 'back'
|
118
|
+
@driver.navigate.back
|
119
|
+
else
|
120
|
+
@driver.navigate.forward
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# def swipe_direction(direction)
|
125
|
+
# size = selenium.manage.window.size
|
126
|
+
# height = size.height.to_i - 10
|
127
|
+
# width = size.width.to_i - 10
|
128
|
+
#
|
129
|
+
# if direction == 'right'
|
130
|
+
# start_x = (width/100) * 15 # 83
|
131
|
+
# start_y = height/2 # 695
|
132
|
+
# end_x = (width/100) * 90 # 900
|
133
|
+
# end_y = height/2 # 630
|
134
|
+
# elsif direction == 'left'
|
135
|
+
# start_x = (width/100) * 90
|
136
|
+
# start_y = height/2
|
137
|
+
# end_x = (width/100) * 15
|
138
|
+
# end_y = height/2
|
139
|
+
# elsif direction == 'up'
|
140
|
+
# start_x = width/2
|
141
|
+
# start_y = (height/100) * 90
|
142
|
+
# end_x = width/2
|
143
|
+
# end_y = (height/100) * 15
|
144
|
+
# elsif direction == 'down'
|
145
|
+
# start_x = width/2
|
146
|
+
# start_y = (height/100) * 15
|
147
|
+
# end_x = width/2
|
148
|
+
# end_y = (height/100) * 90
|
149
|
+
# else
|
150
|
+
# raise "invalid direction"
|
151
|
+
# end
|
152
|
+
#
|
153
|
+
# swipe(start_x, start_y, end_x, end_y)
|
154
|
+
# end
|
155
|
+
|
156
|
+
# def swipe(start_x, start_y, end_x, end_y)
|
157
|
+
# action = Appium::TouchAction.new.press(x: "#{start_x}", y: "#{start_y}").wait(1000).move_to(x: "#{end_x}", y: "#{end_y}").release()
|
158
|
+
# action.perform
|
159
|
+
# end
|
160
|
+
|
161
|
+
|
162
|
+
def long_press_on_element_default_duration(element)
|
163
|
+
begin
|
164
|
+
ele_from = find_object element.location
|
165
|
+
x = ele_from.x
|
166
|
+
y = ele_from.y
|
167
|
+
|
168
|
+
action = Appium::TouchAction.new.press(x: "#{x}", y: "#{y}").wait(2000).move_to(x: "#{x}", y: "#{y}").release()
|
169
|
+
action.perform
|
170
|
+
rescue Exception => e
|
171
|
+
if e.to_s == 'The swipe did not complete successfully'
|
172
|
+
print ""
|
173
|
+
else
|
174
|
+
raise e
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
def long_press_on_element_with_duration(element, duration)
|
180
|
+
begin
|
181
|
+
ele_from = find_object element.location
|
182
|
+
x = ele_from.x
|
183
|
+
y = ele_from.y
|
184
|
+
|
185
|
+
duration = duration.to_i
|
186
|
+
duration = duration * 1000
|
187
|
+
action = Appium::TouchAction.new.press(x: "#{x}", y: "#{y}").wait("#{duration}").move_to(x: "#{x}", y: "#{y}").release()
|
188
|
+
action.perform
|
189
|
+
rescue Exception => e
|
190
|
+
if e.to_s == 'The swipe did not complete successfully'
|
191
|
+
print ""
|
192
|
+
else
|
193
|
+
raise e
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
def long_press_on_coordinates(x, y)
|
199
|
+
action = Appium::TouchAction.new.press(x: "#{x}", y: "#{y}").wait(2000).move_to(x: "#{x}", y: "#{y}").release()
|
200
|
+
action.perform
|
201
|
+
end
|
202
|
+
|
203
|
+
def long_press_on_coordinates_with_duration(x, y, duration)
|
204
|
+
duration = duration.to_i
|
205
|
+
duration = duration * 1000
|
206
|
+
puts duration
|
207
|
+
action = Appium::TouchAction.new.press(x: "#{x}", y: "#{y}").wait("#{duration}").move_to(x: "#{x}", y: "#{y}").release()
|
208
|
+
action.perform
|
209
|
+
end
|
210
|
+
|
211
|
+
def close_app
|
212
|
+
@driver.close_app
|
213
|
+
end
|
214
|
+
|
215
|
+
def launch_app
|
216
|
+
@driver.launch
|
217
|
+
end
|
218
|
+
|
219
|
+
def reset_app
|
220
|
+
@driver.reset
|
221
|
+
end
|
222
|
+
|
223
|
+
def delete_an_character_android
|
224
|
+
system('adb shell input keyevent 67')
|
225
|
+
end
|
226
|
+
|
227
|
+
def take_photo_android
|
228
|
+
system('adb shell input keyevent 27')
|
229
|
+
end
|
230
|
+
|
231
|
+
def move_home
|
232
|
+
@driver.key_event 3
|
233
|
+
end
|
234
|
+
|
235
|
+
def data(name)
|
236
|
+
require 'yaml'
|
237
|
+
begin
|
238
|
+
return $globalData["#{name}"]
|
239
|
+
rescue Exception
|
240
|
+
return name
|
241
|
+
end
|
241
242
|
end
|