itms_automation 2.2 → 2.3

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: b1066a38baafacc29d30b7f1c0f615b617f9f842a99fecc323457eec81309361
4
- data.tar.gz: a8744479fc22f8b4e8063b90747857d807a8709b9a3c38e1116d9a18607a7d6f
3
+ metadata.gz: 904e4a78575ac33d7dface663087ef82e4ab44ad5113847e6202f270a1b24810
4
+ data.tar.gz: 712af3032a9d31b2c87faa33b2160d813ad8b86e64c9a2295cc8a4e33cb5dde4
5
5
  SHA512:
6
- metadata.gz: 6e42a121f66d331393f8a3a62f9d6025b31a6613062120a53006b0bfbe1fd5f95e7acd6c364b36f6825cf8fab09b16ee9e256d1fdd7e1c1db715c65fc0cd1362
7
- data.tar.gz: 7f3760b31ab2dda8f192e2f5f56f69b79b2f80dffc12dc99946257989021f50d4b7f7025d45169735007b5e5ef416a2684c9ada47659defb4fa4e22a7a34ac73
6
+ metadata.gz: '0458938e63e8abf1dcf8b08af8aa1558e16b880cde45e59f37721ec1d17ec943a47995287f7ecb6a5336f9c5d946b6db420ac896e37e72fac0c5f6bd5d2a755d'
7
+ data.tar.gz: c9d84f9eaaf65f3eac427bcd7eb582376dba266d26e7d3aa7522b224609e59138174e732b0d5e88dbd9a2badfb1a99dde45f150fe8a0cc10e0806aa65e6444c4
@@ -167,9 +167,8 @@ def get_object_value(str_obj)
167
167
  hash_object[hash_object.keys[0]]
168
168
  end
169
169
 
170
- def put_log str
171
- start = Time.now
172
- p str if $print_log == true
170
+ def debug_log str
171
+ p str if $print_log == "true"
173
172
  end
174
173
 
175
174
  def check_valid_option_by?(option_by)
@@ -272,6 +271,7 @@ def find_object string_object
272
271
  end
273
272
  }
274
273
  continue_run = true;
274
+ continue_run_count = 1;
275
275
  ref_object = nil;
276
276
 
277
277
  if strRelated != nil and strRelated.length > 0
@@ -304,12 +304,15 @@ def find_object string_object
304
304
  end
305
305
  end
306
306
  if foundElements == nil or foundElements.length == 0
307
+ continue_run_count += 1
308
+ print "Finding the object..." if continue_run_count == 2
309
+ print "." if continue_run_count > 2
307
310
  currentTime = Time.new.to_i
311
+ puts "" if (currentTime - startTime) >= $wait_time
308
312
  else
313
+ puts ""
309
314
  break
310
315
  end
311
- test = currentTime - startTime
312
- puts "\n Finding the object #{string_object}... TIME-OUT:: #{test} < #{$wait_time}"
313
316
  sleep(0.5)
314
317
  end while (currentTime - startTime) < $wait_time
315
318
 
@@ -379,9 +382,9 @@ end
379
382
  def get_objects_by_Id(strId)
380
383
  foundElements = nil
381
384
  begin
382
- foundElements = page.all("*[@id='#{strId}']")
385
+ foundElements = page.all("*[@id='#{strId}']", visible: false)
383
386
  rescue StandardError => e
384
- raise "Error: #{e.message}"
387
+ raise "Error: #{e.message}"
385
388
  end
386
389
 
387
390
  return foundElements
@@ -390,7 +393,7 @@ end
390
393
  def get_objects_by_Class(strClass)
391
394
  foundElements = nil
392
395
  begin
393
- foundElements = page.all("*[@class='#{strClass}']")
396
+ foundElements = page.all("*[@class='#{strClass}']", visible: false)
394
397
  rescue StandardError => e
395
398
  raise "Error: #{e.message}"
396
399
  end
@@ -401,7 +404,7 @@ end
401
404
  def get_objects_by_Name(strName)
402
405
  foundElements = nil
403
406
  begin
404
- foundElements = page.all("*[@name='#{strName}']")
407
+ foundElements = page.all("*[@name='#{strName}']", visible: false)
405
408
  rescue StandardError => e
406
409
  raise "Error: #{e.message}"
407
410
  end
@@ -412,7 +415,7 @@ end
412
415
  def get_objects_by_Tagname(strTagname)
413
416
  foundElements = nil
414
417
  begin
415
- foundElements = page.all("#{strTagname}")
418
+ foundElements = page.all("#{strTagname}", visible: false)
416
419
  rescue StandardError => e
417
420
  raise "Error: #{e.message}"
418
421
  end
@@ -423,7 +426,7 @@ end
423
426
  def get_objects_by_css_selector(strCssSelector)
424
427
  foundElements = nil
425
428
  begin
426
- foundElements = page.all(:css, strCssSelector)
429
+ foundElements = page.all(:css, strCssSelector, visible: false)
427
430
  rescue StandardError => e
428
431
  raise "Error: #{e.message}"
429
432
  end
@@ -433,7 +436,7 @@ end
433
436
  def get_objects_by_xpath_selector(strXpathSelector)
434
437
  foundElements = nil
435
438
  begin
436
- foundElements = page.all(:xpath, strXpathSelector)
439
+ foundElements = page.all(:xpath, strXpathSelector, visible: false)
437
440
  rescue StandardError => e
438
441
  raise "Error: #{e.message}"
439
442
  end
@@ -1,3 +1,3 @@
1
1
  module ItmsAutomation
2
- VERSION = "2.2"
2
+ VERSION = "2.3"
3
3
  end
@@ -634,6 +634,7 @@ def store_variable(var_name, var_value)
634
634
  text = "'" + var_value + "'"
635
635
  set_var(var_name, text)
636
636
  print_log("passed", start, __method__, var_name, var_value)
637
+ debug_log("Stored variable #{var_name}: #{var_value}")
637
638
  rescue StandardError => e
638
639
  print_log("failed", start, __method__, var_name, var_value)
639
640
  raise "Error: #{e.message}"
@@ -648,6 +649,7 @@ def store_text_element(element, var_name)
648
649
  var_value = "'" + found_element.text() + "'"
649
650
  set_var(var_name, var_value)
650
651
  print_log("passed", start, __method__, element, var_name)
652
+ debug_log("Stored variable #{var_name}: #{var_value}")
651
653
  rescue StandardError => e
652
654
  print_log("failed", start, __method__, element, var_name)
653
655
  raise "Error: #{e.message}"
@@ -664,6 +666,7 @@ def store_title_current_page(var_name)
664
666
  var_value = "'" + page.title + "'"
665
667
  set_var(var_name, var_value)
666
668
  print_log("passed", start, __method__, var_name)
669
+ debug_log("Stored variable #{var_name}: #{var_value}")
667
670
  rescue StandardError => e
668
671
  print_log("failed", start, __method__, var_name)
669
672
  raise "Error: #{e.message}"
@@ -678,6 +681,7 @@ def store_element_value(element, var_name)
678
681
  var_value = "'" + found_element.value() + "'"
679
682
  set_var(var_name, var_value)
680
683
  print_log("passed", start, __method__, element, var_name)
684
+ debug_log("Stored variable #{var_name}: #{var_value}")
681
685
  rescue StandardError => e
682
686
  print_log("failed", start, __method__, element, var_name)
683
687
  raise "Error: #{e.message}"
@@ -696,6 +700,7 @@ def store_element_attribute_value(element, attribute, var_name)
696
700
  var_value = "'" + found_element[attribute] + "'"
697
701
  set_var(var_name, var_value)
698
702
  print_log("passed", start, __method__, element, var_name)
703
+ debug_log("Stored variable #{var_name}: #{var_value}")
699
704
  rescue StandardError => e
700
705
  print_log("failed", start, __method__, element, var_name)
701
706
  raise "Error: #{e.message}"
@@ -717,6 +722,7 @@ def store_evaluate_script(script, var_name)
717
722
  var_value = "'" + result.to_s + "'"
718
723
  set_var(var_name, var_value)
719
724
  print_log("passed", start, __method__, script, var_name)
725
+ debug_log("Stored variable #{var_name}: #{var_value}")
720
726
  rescue StandardError => e
721
727
  print_log("failed", start, __method__, script, var_name)
722
728
  raise "Error: #{e.message}"
@@ -728,7 +734,7 @@ def check_checkbox_radio(element)
728
734
  found_element = find_object(element)
729
735
  if found_element != nil
730
736
  begin
731
- found_element.check(allow_label_click: true)
737
+ page.driver.browser.execute_script("arguments[0].checked = true;", found_element.native)
732
738
  print_log("passed", start, __method__, element)
733
739
  rescue StandardError => e
734
740
  print_log("failed", start, __method__, element)
@@ -745,7 +751,7 @@ def uncheck_checkbox_radio(element)
745
751
  found_element = find_object(element)
746
752
  if found_element != nil
747
753
  begin
748
- found_element.uncheck(allow_label_click: true)
754
+ page.driver.browser.execute_script("arguments[0].checked = false;", found_element.native)
749
755
  print_log("passed", start, __method__, element)
750
756
  rescue StandardError => e
751
757
  print_log("failed", start, __method__, element)
@@ -0,0 +1,92 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.7.0)
5
+ public_suffix (>= 2.0.2, < 5.0)
6
+ backports (3.15.0)
7
+ builder (3.2.3)
8
+ capybara (3.29.0)
9
+ addressable
10
+ mini_mime (>= 0.1.3)
11
+ nokogiri (~> 1.8)
12
+ rack (>= 1.6.0)
13
+ rack-test (>= 0.6.3)
14
+ regexp_parser (~> 1.5)
15
+ xpath (~> 3.2)
16
+ childprocess (3.0.0)
17
+ colorize (0.8.1)
18
+ cucumber (3.1.2)
19
+ builder (>= 2.1.2)
20
+ cucumber-core (~> 3.2.0)
21
+ cucumber-expressions (~> 6.0.1)
22
+ cucumber-wire (~> 0.0.1)
23
+ diff-lcs (~> 1.3)
24
+ gherkin (~> 5.1.0)
25
+ multi_json (>= 1.7.5, < 2.0)
26
+ multi_test (>= 0.1.2)
27
+ cucumber-core (3.2.1)
28
+ backports (>= 3.8.0)
29
+ cucumber-tag_expressions (~> 1.1.0)
30
+ gherkin (~> 5.0)
31
+ cucumber-expressions (6.0.1)
32
+ cucumber-tag_expressions (1.1.1)
33
+ cucumber-wire (0.0.1)
34
+ cucumber_priority (0.3.2)
35
+ cucumber
36
+ diff-lcs (1.3)
37
+ gherkin (5.1.0)
38
+ itms_automation (1.5)
39
+ capybara (~> 3.29.0)
40
+ colorize (~> 0.8.1)
41
+ cucumber (~> 3.1)
42
+ cucumber_priority (~> 0.3.2)
43
+ parallel_tests (~> 2.7, >= 2.7.1)
44
+ report_builder (~> 1.8, >= 1.8)
45
+ rspec (~> 3.8, >= 3.8.0)
46
+ selenium-webdriver (~> 3.6, >= 3.6.0)
47
+ json (2.3.0)
48
+ mini_mime (1.0.2)
49
+ mini_portile2 (2.4.0)
50
+ multi_json (1.14.0)
51
+ multi_test (0.1.2)
52
+ nokogiri (1.10.7)
53
+ mini_portile2 (~> 2.4.0)
54
+ parallel (1.19.1)
55
+ parallel_tests (2.29.2)
56
+ parallel
57
+ public_suffix (4.0.3)
58
+ rack (2.0.7)
59
+ rack-test (1.1.0)
60
+ rack (>= 1.0, < 3)
61
+ regexp_parser (1.6.0)
62
+ report_builder (1.8)
63
+ json (>= 1.8.1)
64
+ rspec (3.9.0)
65
+ rspec-core (~> 3.9.0)
66
+ rspec-expectations (~> 3.9.0)
67
+ rspec-mocks (~> 3.9.0)
68
+ rspec-core (3.9.1)
69
+ rspec-support (~> 3.9.1)
70
+ rspec-expectations (3.9.0)
71
+ diff-lcs (>= 1.2.0, < 2.0)
72
+ rspec-support (~> 3.9.0)
73
+ rspec-mocks (3.9.1)
74
+ diff-lcs (>= 1.2.0, < 2.0)
75
+ rspec-support (~> 3.9.0)
76
+ rspec-support (3.9.2)
77
+ rubyzip (2.0.0)
78
+ selenium-webdriver (3.142.6)
79
+ childprocess (>= 0.5, < 4.0)
80
+ rubyzip (>= 1.2.2)
81
+ xpath (3.2.0)
82
+ nokogiri (~> 1.8)
83
+
84
+ PLATFORMS
85
+ ruby
86
+
87
+ DEPENDENCIES
88
+ itms_automation
89
+ report_builder
90
+
91
+ BUNDLED WITH
92
+ 2.0.2
@@ -1,4 +1,5 @@
1
+ @test
1
2
  Feature: demo
2
3
 
3
4
  Scenario: new scenario
4
- Given I open the page "http://google.com"
5
+ Given Go to Test Cycle Sumary of iTMS project
@@ -1,3 +1,46 @@
1
1
  And /I open the page "(.*)"/ do |url_site|
2
2
  execute_openbrowser(url_site)
3
3
  end
4
+
5
+ Given /^test select execute$/ do
6
+
7
+ execute_openbrowser("https://infodation.atlassian.net/plugins/servlet/ac/Infodation-tms/test-summary?project.key=IFDTMS&project.id=17400")
8
+ # execute_settext("username", "cuong")
9
+ # execute_click("okbutton")
10
+ switch_to_iframe("iframe1")
11
+
12
+ execute_click("verify")
13
+ sleep(5)
14
+ end
15
+
16
+ When /^Go to Test Cycle Sumary of iTMS project$/ do
17
+ execute_openbrowser("https://infodation.atlassian.net/plugins/servlet/ac/Infodation-tms/test-summary?project.key=IFDTMS&project.id=17400")
18
+ sleep(5)
19
+ switch_to_iframe("iframe1")
20
+ execute_click("itms_cyclesumarylink")
21
+ sleep(3)
22
+ custom_action
23
+ end
24
+
25
+
26
+ def custom_action()
27
+ begin
28
+ browser = Capybara.current_session.driver.browser
29
+ if browser.respond_to?(:clear_cookies)
30
+ # Rack::MockSession
31
+ browser.clear_cookies
32
+ print_log("passed", start, _method_)
33
+ elsif browser.respond_to?(:manage) and browser.manage.respond_to?(:delete_all_cookies)
34
+ # Selenium::WebDriver
35
+ browser.manage.delete_all_cookies
36
+ print_log("passed", start, _method_)
37
+ else
38
+ print_log("failed", start, _method_)
39
+ raise "Error: Don't know how to clear cookies. Weird driver?"
40
+ end
41
+ rescue Exception => e
42
+ print_log("failed", start, _method_)
43
+ raise "Error: #{e.message}"
44
+ end
45
+
46
+ end
@@ -1,2 +1,26 @@
1
- signupbutton: {xpath_selector: '//li[@class="mm-listitem"]//a[@href="#"][contains(text(),"T")]'}
2
-
1
+ username: { xpath_selector: '//input[@id="login"]' }
2
+ okbutton: { xpath_selector: '//input[@value="Check Inbox"]' }
3
+ iframe: { xpath_selector: '//*[@class="ap-iframe-container iframe-init"]' }
4
+ iframe1: { xpath_selector: '//iframe[contains(@id,"Infodation-tms__test-summary_")]' }
5
+ verify: { xpath_selector: '//*[@id="aui-uid-1"]' }
6
+ firstname:
7
+ {
8
+ xpath_selector: '/html/body/div[2]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[5]/td/form/table/tbody/tr[2]/td[2]',
9
+ }
10
+ lastname:
11
+ {
12
+ xpath_selector: '/html/body/div[2]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[5]/td/form/table/tbody/tr[3]/td[2]/input',
13
+ }
14
+ selectcountry:
15
+ {
16
+ xpath_selector: '/html/body/div[2]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[5]/td/form/table/tbody/tr[11]/td[2]/select',
17
+ }
18
+ loginjira_continuebutton: {xpath_selector: "//button[@id=\"login-submit\"]/span/span/span"}
19
+ loginjira_password: {xpath_selector: "//input[@id=\"password\"]"}
20
+ loginjira_username: {xpath_selector: "//input[@id=\"username\"]"}
21
+ itms_cyclesumarylink: {xpath_selector: "//section[@id=\"content\"]//li[@class=\"menu-item\"]/a"}
22
+ itms_createnewtestcyclebutton: {xpath_selector: "//button[@id=\"itms-sidebar-addnew-button\"]"}
23
+ itms_createtestcycle_savebutton: {xpath_selector: "//button[@id=\"itms-dialog-confirm\"]"}
24
+ itms_createtestcyle_alertmessage: {xpath_selector: "//section[@id=\"ITMS-dialog-cycle\"]//strong"}
25
+ itms_clickheretocreatetestcycle: {xpath_selector: "//section[@class=\"aui-buttons\"]/button[3]/span"}
26
+ itms_iframe_testsumary: { xpath_selector: '//iframe[contains(@id,"Infodation-tms__test-summary_")]' }
@@ -5,6 +5,5 @@ require "capybara/cucumber"
5
5
  require "cucumber"
6
6
  require "yaml"
7
7
  require "selenium-webdriver"
8
- require "colorize"
9
8
  require "itms_automation"
10
9
  require "report_builder"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itms_automation
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.2'
4
+ version: '2.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anh Pham
@@ -14,22 +14,22 @@ dependencies:
14
14
  name: selenium-webdriver
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '3.6'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 3.6.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '3.6'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '3.6'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: 3.6.0
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.6'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: cucumber
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -62,22 +62,22 @@ dependencies:
62
62
  name: rspec
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '3.8'
68
65
  - - ">="
69
66
  - !ruby/object:Gem::Version
70
67
  version: 3.8.0
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '3.8'
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - "~>"
76
- - !ruby/object:Gem::Version
77
- version: '3.8'
78
75
  - - ">="
79
76
  - !ruby/object:Gem::Version
80
77
  version: 3.8.0
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '3.8'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: parallel_tests
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -102,20 +102,20 @@ dependencies:
102
102
  name: report_builder
103
103
  requirement: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - "~>"
105
+ - - ">="
106
106
  - !ruby/object:Gem::Version
107
107
  version: '1.8'
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.8'
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '1.8'
118
- - - ">="
118
+ - - "~>"
119
119
  - !ruby/object:Gem::Version
120
120
  version: '1.8'
121
121
  - !ruby/object:Gem::Dependency
@@ -155,6 +155,7 @@ files:
155
155
  - lib/itms_automation/version.rb
156
156
  - lib/itms_automation/web_steps_helper.rb
157
157
  - project/Gemfile
158
+ - project/Gemfile.lock
158
159
  - project/README.md
159
160
  - project/Rakefile
160
161
  - project/config/chrome_headless_options.yaml
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  - !ruby/object:Gem::Version
190
191
  version: '0'
191
192
  requirements: []
192
- rubygems_version: 3.1.2
193
+ rubygems_version: 3.0.6
193
194
  signing_key:
194
195
  specification_version: 4
195
196
  summary: SELENIUM WEBDRIVER WITH RUBY & CUCUMBER