itms_automation 1.1 → 1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2481f496f80a331329c1a1929a81b9020e439c115b13361aa1bdb0028c13bbe5
4
- data.tar.gz: 6e4e510b6601947670f59cf5ccfb88dae5e5e6f6aa6bf45dcc71e146ea27c039
3
+ metadata.gz: 897907ab0ff6c78bcae35d678aa285987350c11426f5a8811ac03402656255e2
4
+ data.tar.gz: c01b97b08442ea253d20a306a313ed19742a6d859a756f827a194144bb2754f0
5
5
  SHA512:
6
- metadata.gz: 0a8428f49bf58f222861f188227fe0a70f77d348c401f437054e9a5d6b1229cc666869f7896cb4da7f25cbf749b78e2dffcd66ad8ffc096b679fce30e783644c
7
- data.tar.gz: 1b7963dd421b3dec632ab47726709eaa22199e74e119ecd67e8fd168148805ff93bd5c416b75bb3610a031235d53107b8762304cf860aae5aa0c0b08f53cb04f
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
- @expected = JSON.parse(expected_string)
59
- is_contain = false
60
- if @expected.kind_of?(Array) && @expected.length > @result.length
61
- raise "Expected: #{@expected}\nGot: #{@result}\nQuery result not includes your expected"
62
- end
63
- @result.each do |row|
64
- is_contain = do_assertion_json(@expected, row)
65
- break if !@expected.kind_of?(Array) && is_contain == true
66
- end
67
- unless is_contain
68
- raise "Expected: #{@expected}\nGot: #{@result}\nQuery result not includes your expected"
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
- @expected = JSON.parse(expected_string)
74
- if !@expected.kind_of?(Array) || @expected.length != @result.length
75
- raise "Expected: #{@expected}\nGot: #{@result}\nQuery result not equal with your expected"
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
@@ -1,3 +1,3 @@
1
1
  module ItmsAutomation
2
- VERSION = "1.1"
2
+ VERSION = "1.2"
3
3
  end
@@ -169,14 +169,11 @@ def execute_javascript(script)
169
169
  end
170
170
  end
171
171
 
172
- def execute_select(element, text)
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
- option_value = page.evaluate_script("$(\"##{foundElement[:id]} option:contains('#{text}')\").val()")
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.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-16 00:00:00.000000000 Z
11
+ date: 2019-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver