itms_automation 1.1 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 897907ab0ff6c78bcae35d678aa285987350c11426f5a8811ac03402656255e2
|
4
|
+
data.tar.gz: c01b97b08442ea253d20a306a313ed19742a6d859a756f827a194144bb2754f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b0b55e6700794b6457785b8b362d7c2996ac0c58f013b7af1edd8de8a1b32258701f8a8805712f3caf534fe64211ce52220c8236a35d9039fa8646d4f09ddf9
|
7
|
+
data.tar.gz: 0a01a6f5818f2b5c19d734bbb9965c2e7249999a36e63d02d4ba09a8eeafc1b62f9d9b56a84caed0b8e5a139189e0a7f7e033a3f80784732b3692fa01cf133af
|
@@ -20,6 +20,8 @@ def create_database_connection config
|
|
20
20
|
if !@connection.connected?
|
21
21
|
raise "Error: Can't connect to database"
|
22
22
|
end
|
23
|
+
rescue JSON::ParserError
|
24
|
+
raise "Create database connection error: Please check your connection configuration"
|
23
25
|
rescue Exception => e
|
24
26
|
raise "Create database connection error: #{e.message}"
|
25
27
|
end
|
@@ -55,29 +57,41 @@ def print_sql_result
|
|
55
57
|
end
|
56
58
|
|
57
59
|
def verify_sql_result_contain expected_string
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
begin
|
61
|
+
@expected = JSON.parse(expected_string)
|
62
|
+
is_contain = false
|
63
|
+
if @expected.kind_of?(Array) && @expected.length > @result.length
|
64
|
+
raise "Expected: #{@expected}\nGot: #{@result}\nQuery result not includes your expected"
|
65
|
+
end
|
66
|
+
@result.each do |row|
|
67
|
+
is_contain = do_assertion_json(@expected, row)
|
68
|
+
break if !@expected.kind_of?(Array) && is_contain == true
|
69
|
+
end
|
70
|
+
unless is_contain
|
71
|
+
raise "Expected: #{@expected}\nGot: #{@result}\nQuery result not includes your expected"
|
72
|
+
end
|
73
|
+
rescue JSON::ParserError
|
74
|
+
raise "Verify SQL result contain error: Please check your expected"
|
75
|
+
rescue Exception => e
|
76
|
+
raise "Verify SQL result contain error: #{e.message}"
|
69
77
|
end
|
70
78
|
end
|
71
79
|
|
72
80
|
def verify_sql_result_equal expected_string
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
end
|
77
|
-
@result.each_with_index do |row, index|
|
78
|
-
is_contain = row.to_s == @expected[index].to_s
|
79
|
-
unless is_contain
|
81
|
+
begin
|
82
|
+
@expected = JSON.parse(expected_string)
|
83
|
+
if !@expected.kind_of?(Array) || @expected.length != @result.length
|
80
84
|
raise "Expected: #{@expected}\nGot: #{@result}\nQuery result not equal with your expected"
|
81
85
|
end
|
86
|
+
@result.each_with_index do |row, index|
|
87
|
+
is_contain = row.to_s == @expected[index].to_s
|
88
|
+
unless is_contain
|
89
|
+
raise "Expected: #{@expected}\nGot: #{@result}\nQuery result not equal with your expected"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
rescue JSON::ParserError
|
93
|
+
raise "Verify SQL result equal error: Please check your expected"
|
94
|
+
rescue Exception => e
|
95
|
+
raise "Verify SQL result equal error: #{e.message}"
|
82
96
|
end
|
83
97
|
end
|
@@ -169,14 +169,11 @@ def execute_javascript(script)
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
-
def execute_select(element,
|
173
|
-
#select(text, :xpath => element)
|
172
|
+
def execute_select(element, option)
|
174
173
|
foundElement = find_object(element)
|
175
174
|
if foundElement != nil
|
176
175
|
begin
|
177
|
-
|
178
|
-
page.execute_script("$('##{foundElement[:id]}').val('#{option_value}')")
|
179
|
-
page.execute_script("$('##{foundElement[:id]}').trigger('liszt:updated').trigger('change')")
|
176
|
+
Selenium::WebDriver::Support::Select.new(page.driver.browser.find_element(:xpath, "#{element}")).select_by(:text, "#{option}")
|
180
177
|
rescue Exception => e
|
181
178
|
raise "❌ ERROR: #{e}"
|
182
179
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itms_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anh Pham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-12-
|
11
|
+
date: 2019-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|