itms_automation 2.3 → 2.4

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: 904e4a78575ac33d7dface663087ef82e4ab44ad5113847e6202f270a1b24810
4
- data.tar.gz: 712af3032a9d31b2c87faa33b2160d813ad8b86e64c9a2295cc8a4e33cb5dde4
3
+ metadata.gz: 8449e9bd1c31ed115ca78196653a0afce15d4b3ff2120fb8bec34eff820fa448
4
+ data.tar.gz: e4c592c5a209d0d2e40a9967521b1c518b09f213efc623a632e31dfbd9f44759
5
5
  SHA512:
6
- metadata.gz: '0458938e63e8abf1dcf8b08af8aa1558e16b880cde45e59f37721ec1d17ec943a47995287f7ecb6a5336f9c5d946b6db420ac896e37e72fac0c5f6bd5d2a755d'
7
- data.tar.gz: c9d84f9eaaf65f3eac427bcd7eb582376dba266d26e7d3aa7522b224609e59138174e732b0d5e88dbd9a2badfb1a99dde45f150fe8a0cc10e0806aa65e6444c4
6
+ metadata.gz: b8dfcd9f35bfd4a32f8a03ee064d210a9b4c0e75613cae2eb1989cd15ec992cb5d6960e2553fbefbbcef90e6a4a7d2c03e844637379ef272ebbef6c3b249d9a3
7
+ data.tar.gz: d1df9cbea128904e93376ab6c4d977434d7436240554849d34eabd392c1ff641ccb9db4eb274ed6eaf11d7ef1a409c833285ade940139fe015e88f77666e23f2
@@ -305,7 +305,7 @@ def find_object string_object
305
305
  end
306
306
  if foundElements == nil or foundElements.length == 0
307
307
  continue_run_count += 1
308
- print "Finding the object..." if continue_run_count == 2
308
+ print "Finding the object #{string_object}..." if continue_run_count == 2
309
309
  print "." if continue_run_count > 2
310
310
  currentTime = Time.new.to_i
311
311
  puts "" if (currentTime - startTime) >= $wait_time
@@ -700,3 +700,8 @@ def find_object_check_ref_object(ref_object, ref_type, target_element)
700
700
 
701
701
  return false;
702
702
  end
703
+
704
+ def get_variable_name_from_text(text)
705
+ regex = /\${(.*?)}/
706
+ text[regex, 1]
707
+ end
@@ -1,3 +1,3 @@
1
1
  module ItmsAutomation
2
- VERSION = "2.3"
2
+ VERSION = "2.4"
3
3
  end
@@ -5,6 +5,8 @@ require "open-uri"
5
5
  def execute_openbrowser(url_site)
6
6
  start = Time.now
7
7
  begin
8
+ variable_name = get_variable_name_from_text(url_site)
9
+ url_site = get_var(variable_name) unless variable_name.nil?
8
10
  if url_site == ""
9
11
  print_log("failed", start, __method__, url_site)
10
12
  raise "Error: Null web page URL."
@@ -96,6 +98,8 @@ def execute_settext(element, text)
96
98
  foundElement = find_object(element)
97
99
  if foundElement != nil
98
100
  begin
101
+ variable_name = get_variable_name_from_text(text)
102
+ text = get_var(variable_name) unless variable_name.nil?
99
103
  foundElement.set(text)
100
104
  print_log("passed", start, __method__, element, text)
101
105
  rescue StandardError => e
@@ -125,6 +129,8 @@ def switch_to_window_by_title(window_title)
125
129
  @window_found = false
126
130
  page.driver.browser.window_handles.each { |handle|
127
131
  page.driver.browser.switch_to.window handle
132
+ variable_name = get_variable_name_from_text(window_title)
133
+ window_title = get_var(variable_name) unless variable_name.nil?
128
134
  if page.title == window_title
129
135
  @window_found = true
130
136
  print_log("passed", start, __method__, window_title)
@@ -162,6 +168,8 @@ end
162
168
  def verify_title(expected_title)
163
169
  start = Time.now
164
170
  begin
171
+ variable_name = get_variable_name_from_text(expected_title)
172
+ expected_title = get_var(variable_name) unless variable_name.nil?
165
173
  page_title = page.title
166
174
  expect(page_title).to eq expected_title
167
175
  print_log("passed", start, __method__, expected_title)
@@ -175,6 +183,8 @@ end
175
183
  def verify_alert_text(text)
176
184
  start = Time.now
177
185
  begin
186
+ variable_name = get_variable_name_from_text(text)
187
+ text = get_var(variable_name) unless variable_name.nil?
178
188
  alert = page.driver.browser.switch_to.alert.text
179
189
  expect(alert).to eq text
180
190
  print_log("passed", start, __method__, text)
@@ -238,6 +248,8 @@ end
238
248
  def execute_javascript(script)
239
249
  start = Time.now
240
250
  begin
251
+ variable_name = get_variable_name_from_text(script)
252
+ script = get_var(variable_name) unless variable_name.nil?
241
253
  page.execute_script(script)
242
254
  print_log("passed", start, __method__, script)
243
255
  rescue Exception => e
@@ -422,6 +434,8 @@ def verify_element_text(element, value)
422
434
  foundElement = find_object(element)
423
435
  if foundElement != nil
424
436
  begin
437
+ variable_name = get_variable_name_from_text(value)
438
+ value = get_var(variable_name) unless variable_name.nil?
425
439
  actual_value = foundElement.text()
426
440
  expect(actual_value).to eq value
427
441
  print_log("passed", start, __method__, element, value)
@@ -440,6 +454,8 @@ def verify_element_not_has_text(element, value)
440
454
  foundElement = find_object(element)
441
455
  if foundElement != nil
442
456
  begin
457
+ variable_name = get_variable_name_from_text(value)
458
+ value = get_var(variable_name) unless variable_name.nil?
443
459
  actual_value = foundElement.text()
444
460
  expect(actual_value).not_to eql value
445
461
  print_log("passed", start, __method__, element, value)
@@ -458,6 +474,8 @@ def verify_element_value(element, value)
458
474
  foundElement = find_object(element)
459
475
  if foundElement != nil
460
476
  begin
477
+ variable_name = get_variable_name_from_text(value)
478
+ value = get_var(variable_name) unless variable_name.nil?
461
479
  actual_value = foundElement.value()
462
480
  expect(actual_value).to eq value
463
481
  print_log("passed", start, __method__, element, value)
@@ -476,6 +494,8 @@ def verify_element_not_has_value(element, value)
476
494
  foundElement = find_object(element)
477
495
  if foundElement != nil
478
496
  begin
497
+ variable_name = get_variable_name_from_text(value)
498
+ value = get_var(variable_name) unless variable_name.nil?
479
499
  actual_value = foundElement.value()
480
500
  expect(actual_value).not_to eql value
481
501
  print_log("passed", start, __method__, element, value)
@@ -497,6 +517,9 @@ def execute_checkproperty(element, property, negate, value, isSpecialChar = fals
497
517
  end
498
518
  foundElement = find_object(element)
499
519
 
520
+ variable_name = get_variable_name_from_text(value)
521
+ value = get_var(variable_name) unless variable_name.nil?
522
+
500
523
  check = false
501
524
  if foundElement == nil and value == ""
502
525
  check = true
@@ -28,43 +28,37 @@ end
28
28
  def getDriver
29
29
  case ENV['BROWSER']
30
30
  when "chrome"
31
- @chrome_options = loadYAMLfile('config/chrome_options.yaml')
32
31
  Capybara.register_driver :selenium do |app|
33
- Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'],:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: @chrome_options))
32
+ Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'],:desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome())
34
33
  end
35
34
  Capybara.current_driver = :selenium
36
35
  when "firefox"
37
- @firefox_options = loadYAMLfile('config/firefox_options.yaml')
38
36
  Capybara.register_driver :selenium do |app|
39
- Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox(firefoxOptions: @firefox_options))
37
+ Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.firefox())
40
38
  end
41
39
  Capybara.current_driver = :selenium
42
40
  when "safari"
43
- @safari_options = loadYAMLfile('config/safari_options.yaml')
44
41
  Capybara.register_driver :selenium do |app|
45
- Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.safari(safariOptions: @safari_options))
42
+ Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.safari())
46
43
  end
47
44
  Capybara.current_driver = :selenium
48
45
  when "ie"
49
- @ie_options = loadYAMLfile('config/ie_options.yaml')
50
46
  Capybara.register_driver :selenium do |app|
51
- Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.internet_explorer(ieOptions: @ie_options))
47
+ Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.internet_explorer())
52
48
  end
53
49
  Capybara.current_driver = :selenium
54
50
  when "chrome_headless"
55
- @chrome_headless_options = loadYAMLfile('config/chrome_headless_options.yaml')
56
51
  Capybara.register_driver :selenium do |app|
57
- Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: @chrome_headless_options))
52
+ Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w(headless disable-gpu) }))
58
53
  end
59
54
  Capybara.current_driver = :selenium
60
55
  when "remote"
61
- @capabilities = loadYAMLfile('config/remote_options.yaml')
62
56
  Capybara.register_driver :selenium do |app|
63
- Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'], :desired_capabilities => @capabilities)
57
+ Capybara::Selenium::Driver.new(app, :url => ENV['SERVER_URL'])
64
58
  end
65
59
  Capybara.current_driver = :selenium
66
60
  else
67
- raise "❌ ERROR: Unsupported browser: #{ENV['BROWSER']}. Available: chrome || chrome headless || firefox || safari || ie || remote"
61
+ raise "❌ ERROR: Unsupported browser: #{ENV['BROWSER']}. Available: chrome || chrome headless || firefox || safari || ie || remote"
68
62
  end
69
63
  unless ENV["SCREEN_RESOLUTION"].nil?
70
64
  screen_resolution = ENV["SCREEN_RESOLUTION"].split("x")
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: '2.3'
4
+ version: '2.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anh Pham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-27 00:00:00.000000000 Z
11
+ date: 2020-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -158,13 +158,6 @@ files:
158
158
  - project/Gemfile.lock
159
159
  - project/README.md
160
160
  - project/Rakefile
161
- - project/config/chrome_headless_options.yaml
162
- - project/config/chrome_options.yaml
163
- - project/config/firefox_headless_options.yaml
164
- - project/config/firefox_options.yaml
165
- - project/config/ie_options.yaml
166
- - project/config/remote_options.yaml
167
- - project/config/safari_options.yaml
168
161
  - project/cucumber.yml
169
162
  - project/features/TestSuite/WebGUI.feature
170
163
  - project/features/step_definitions/lib_steps/steps_definition.rb
@@ -1 +0,0 @@
1
- args: ["--headless","--disable-gpu",--no-sandbox]
@@ -1,6 +0,0 @@
1
- args: ["--start-maximized","--disable-infobars","--incognito"]
2
- prefs: {
3
- password_manager_enabled: false,
4
- default_content_settings: {popups: 0},
5
- content_settings: {pattern_pairs: {'*': {'multiple-automatic-downloads': 1}}}
6
- }
@@ -1 +0,0 @@
1
- browser.download.downloadDir: '/home/seluser'
@@ -1 +0,0 @@
1
- browser.download.downloadDir: '/home/seluser'
@@ -1 +0,0 @@
1
- mobileEmulation: {deviceName: "iPhone X"}
@@ -1,6 +0,0 @@
1
- args: ["--start-maximized","--disable-infobars","--incognito", "--user-agent='Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile /9A334 Safari/7534.48.3'"]
2
- prefs: {
3
- password_manager_enabled: false,
4
- default_content_settings: {popups: 0},
5
- content_settings: {pattern_pairs: {'*': {'multiple-automatic-downloads': 1}}}
6
- }
@@ -1 +0,0 @@
1
- mobileEmulation: {deviceName: "iPhone X"}