scoutui 2.0.3.18.pre → 2.0.3.19.pre

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
  SHA1:
3
- metadata.gz: ac384e272b8b5dc7015a8d2850250888826dfb0d
4
- data.tar.gz: 1cda469805b400dff272e8ffd2927c4233fef91f
3
+ metadata.gz: 00a1acf77b739a88af187528513463e7da2ff1ac
4
+ data.tar.gz: c6159df60949f38ca5f7004af666cdce4b367394
5
5
  SHA512:
6
- metadata.gz: a20c91dd179554c898ac8a3d3efffb2971481c3444441131bfb355fe42bbdf9fe21832cf3071db65dfeb2ac565412f0bb56d323119263d36832997370f40725c
7
- data.tar.gz: 41ce3acc2e85014de6298ec368b174fd9193e86927fb6109d580074a770401c9324578c13b1bd45568afa07794cdf904b179ab6ae56825c27335d63d102ea00c
6
+ metadata.gz: 3a89c30738f2407fffce2946428f5a3ef5ea20766b98dc34b575d26dc755adad9aea94341c1cb1bdc9888fe14129f56774f4e89f4cbce33fa3e60fa0343c3473
7
+ data.tar.gz: e82becf0c4a8cbda2f1e6963554c4bd2a38f14a67498b80cad2d50c45371fedb5235ad8111399e1e94baa5d7380785c63e6603f3ca912a99e6e6f3ec5088adbf
@@ -0,0 +1,38 @@
1
+ require 'nokogiri'
2
+ # http://stackoverflow.com/questions/10300095/how-to-add-child-nodes-in-nodeset-using-nokogiri
3
+
4
+ def addSkipped(node, doc)
5
+ skipped = Nokogiri::XML::Node.new('skipped', doc)
6
+ node.add_child skipped
7
+ end
8
+
9
+ doc = Nokogiri::XML("<testsuites></testsuites>")
10
+
11
+ ## Add a node
12
+ ts = Nokogiri::XML::Node.new('testcase', doc)
13
+
14
+ #ts.content='pass'
15
+ ts.set_attribute('name', 'my testcase')
16
+ ts.set_attribute('classname', 'scoutui.assert')
17
+ ts.set_attribute('time', 29)
18
+
19
+ #skipped = Nokogiri::XML::Node.new('skipped', doc)
20
+ #ts.add_child skipped
21
+ addSkipped(ts, doc)
22
+ doc.root.add_child ts
23
+
24
+
25
+ node_set = Nokogiri::XML::NodeSet.new(doc)
26
+
27
+
28
+ sys_out = Nokogiri::XML::Node.new('system-out', doc)
29
+ sys_out.content='my STDOUT dump'
30
+ doc.root.add_child(sys_out)
31
+
32
+ sys_err = Nokogiri::XML::Node.new('system-err', doc)
33
+ sys_err.content='my STDERR dump'
34
+ doc.root.add_child(sys_err)
35
+
36
+
37
+ puts doc.to_s
38
+
@@ -187,7 +187,7 @@ module Scoutui::Base
187
187
  end
188
188
 
189
189
 
190
- def isEanbled(my_driver, page_elt, _req=nil, _immediate=false)
190
+ def isEnabled(my_driver, page_elt, _req=nil, _immediate=false)
191
191
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEanbled(#{page_elt}"
192
192
  end
193
193
 
@@ -1,7 +1,4 @@
1
1
 
2
- #require 'eyes_selenium'
3
- #require 'selenium-webdriver'
4
-
5
2
  module Scoutui::Base
6
3
 
7
4
 
@@ -16,6 +13,23 @@ module Scoutui::Base
16
13
  drv.browser.to_s.match(/chrome/i)
17
14
  end
18
15
 
16
+ def self.wait_for_not_displayed(drv, locator, _timeout=30)
17
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " wait_for_not_displayed(#{xpath}"
18
+ rc=nil
19
+ begin
20
+ Selenium::WebDriver::Wait.new(timeout: _timeout).until {
21
+ rc=drv.find_element(:xpath => xpath).displayed?
22
+
23
+ obj=getObject(drv, obj, _timeout=nil)
24
+
25
+
26
+ }
27
+ rescue => ex
28
+ ;
29
+ end
30
+ rc
31
+ end
32
+
19
33
  def self.wait_for_displayed(drv, locator, _timeout=30)
20
34
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " wait_for_displayed(#{xpath}"
21
35
  rc=nil
@@ -60,6 +74,12 @@ module Scoutui::Base
60
74
 
61
75
  def self.getFirstObject(drv, _locator, _timeout=nil)
62
76
 
77
+
78
+ if existsAlert?(drv)
79
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " ALERT currently exists!"; # STDIN.gets()
80
+ return nil
81
+ end
82
+
63
83
  if _timeout.nil?
64
84
  _timeout = Scoutui::Utils::TestUtils.instance.getDefaultWait
65
85
  end
@@ -86,7 +106,7 @@ module Scoutui::Base
86
106
  Selenium::WebDriver::Wait.new(timeout: _timeout).until { drv.find_elements(locateBy => locator).size > 0 }
87
107
  rc=drv.find_elements(locateBy => locator)[0]
88
108
  rescue => ex
89
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getFirstObject.Exception: #{locator.to_s} - #{ex}"
109
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{$!} - #{ex.message} getFirstObject.Exception: #{locator.to_s} - #{ex}"
90
110
  ;
91
111
  end
92
112
 
@@ -101,7 +101,7 @@ module Scoutui::Base
101
101
  teardown()
102
102
 
103
103
  rescue => ex
104
- Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{ex}"
104
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s} Error during processing: #{ex}"
105
105
  Scoutui::Logger::LogMgr.instance.warn ex.backtrace
106
106
  ensure
107
107
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__ ).to_s + " Close Eyes" if Scoutui::Utils::TestUtils.instance.isDebug?
@@ -92,6 +92,8 @@ module Scoutui::Base
92
92
  k=:host
93
93
  elsif k=='${lang}'
94
94
  k=:lang
95
+ elsif k=='${browser}'
96
+ k=:browser
95
97
  elsif k.is_a?(Symbol)
96
98
  foundKey=true
97
99
  elsif k=='__random_email__'
@@ -470,8 +470,7 @@ module Scoutui::Base
470
470
 
471
471
  expected_list.each_pair do |link_name, xpath|
472
472
 
473
- Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + "\t\t#{link_name} => #{xpath}" if Scoutui::Utils::TestUtils.instance.isDebug?
474
-
473
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + "\t\t#{link_name} => #{xpath}"
475
474
 
476
475
  # Check if the verification is a "windows.*" verification
477
476
 
@@ -493,6 +492,50 @@ module Scoutui::Base
493
492
  next
494
493
  end
495
494
 
495
+ # Not Visible
496
+ if !xpath.match(/^\s*!visible\(.*\)$/).nil?
497
+ _rc = false
498
+ _e=nil
499
+ _timeout=10
500
+
501
+ if xpath.match(/^\s*!visible\((.*,\s*\d+\s*)\)$/)
502
+ _e = xpath.match(/^\s*!visible\((.*),\s*\d+\s*\)$/)[1].to_s.strip
503
+ _timeout=xpath.match(/^\s*!visible\((.*),\s*(\d+)\s*\)$/)[2].to_i
504
+ else
505
+ _e = xpath.match(/^\s*!visible\((.*)\)$/)[1].to_s.strip
506
+ end
507
+
508
+ _obj = Scoutui::Base::QBrowser.getObject(my_driver, _e, Scoutui::Commands::Utils.instance.getTimeout)
509
+
510
+ puts __FILE__ + (__LINE__).to_s + " Wait until element #{xpath} => #{_e} is not visible #{_obj}.class.to_s"
511
+
512
+ if _obj.nil?
513
+ _rc = true
514
+ else
515
+ puts __FILE__ + (__LINE__).to_s + " _obj => #{_obj} : exists: #{!_obj.nil?}"
516
+
517
+ begin
518
+ Selenium::WebDriver::Wait.new(timeout: _timeout).until {
519
+ _obj = Scoutui::Base::QBrowser.getObject(my_driver, _e, 5)
520
+ puts __FILE__ + (__LINE__).to_s + " waiting .. => #{_obj.class.to_s}"
521
+
522
+ _obj.nil?
523
+ }
524
+
525
+ rescue Selenium::WebDriver::Error::TimeOutError
526
+ _rc=_obj.nil?
527
+ end
528
+
529
+
530
+ end
531
+
532
+ Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify #{_e} - is not visible - #{_rc}"
533
+ if Scoutui::Utils::TestUtils.instance.assertExpected?
534
+ Testmgr::TestReport.instance.getReq(_req).get_child('visible_when').add(_rc, "Verify #{_e} - is not visible")
535
+ end
536
+
537
+ next
538
+ end
496
539
 
497
540
  if !xpath.match(/\$\{.*\}/).nil?
498
541
  # xpath = Scoutui::Base::UserVars.instance.get(xpath)
@@ -833,14 +876,20 @@ module Scoutui::Base
833
876
  if !_command.wasExecuted?
834
877
  processCommand(_action, e, my_driver)
835
878
  else
836
- Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Command #{_action} was not executed"
879
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Command #{_action} was already executed"
837
880
  end
838
881
 
839
882
  processExpected(my_driver, e)
883
+
840
884
  processAssertions(my_driver, e)
841
885
 
842
886
 
843
887
  if isSnapIt(e)
888
+
889
+ if QBrowser.existsAlert?(my_driver)
890
+ puts __FILE__ + (__LINE__).to_s + " Snapit with existing Alert"
891
+ end
892
+
844
893
  if !_region.nil?
845
894
  eyeScout.check_window(_name, _region)
846
895
  else
@@ -145,7 +145,7 @@ module Scoutui::Commands
145
145
  end
146
146
 
147
147
  Scoutui::Logger::LogMgr.instance.asserts.info "Verify object to click exists #{_locator} : #{obj.class.to_s} - #{!obj.nil?.to_s}"
148
- Scoutui::Logger::LogMgr.instance.asserts.info "Verify clicked #{_locator} - #{_clicked.to_s}"
148
+ Scoutui::Logger::LogMgr.instance.asserts.info __FILE__ + (__LINE__).to_s + " Verify clicked #{_locator} - #{_clicked.to_s}"
149
149
 
150
150
  Testmgr::TestReport.instance.getReq(_req).testcase('click').add(!obj.nil?, "Verify object to click exists #{_locator} : #{obj.class.to_s}")
151
151
  Testmgr::TestReport.instance.getReq(_req).testcase('click').add(_clicked, "Verify clicked #{_locator}")
@@ -30,7 +30,7 @@ module Scoutui::Commands
30
30
  end
31
31
 
32
32
  def setResult(r)
33
- Scoutui::Logger::LogMgr.instance.commands.debug " setResult(#{r.to_s})"
33
+ Scoutui::Logger::LogMgr.instance.commands.debug " #{@cmd.to_s} : setResult(#{r.to_s})"
34
34
  @executed=true
35
35
  @executed_result=r
36
36
  end
@@ -162,7 +162,7 @@ module Scoutui::Commands
162
162
 
163
163
  Testmgr::TestReport.instance.getReq(_req).get_child(_cmd.downcase).add(!_aborted, "Verify command #{_cmd} did not abort")
164
164
 
165
- Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " exit [processCommand(#{_action})"
165
+ Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " exit [processCommand(#{_action}) => #{_c}"
166
166
 
167
167
  _c
168
168
  end
@@ -20,6 +20,7 @@ module Scoutui::Commands
20
20
  alert=@drv.switch_to.alert
21
21
 
22
22
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | alert => #{alert.class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
23
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | alert.text => #{alert.text.to_s}"
23
24
 
24
25
  if alert.is_a?(Selenium::WebDriver::Alert)
25
26
  if _action.match(/accept/i)
@@ -31,7 +32,6 @@ module Scoutui::Commands
31
32
  rc=true
32
33
  end
33
34
 
34
-
35
35
  rescue Selenium::WebDriver::Error::NoSuchAlertError
36
36
  ;
37
37
  end
@@ -21,7 +21,7 @@ module Scoutui::Commands::JsAlert
21
21
 
22
22
  begin
23
23
  alert=@drv.switch_to.alert
24
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | alert => #{alert.class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
24
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | alert => #{alert.class.to_s}"
25
25
 
26
26
  _alertExists = alert.is_a?(Selenium::WebDriver::Alert)
27
27
  if _alertExists && !(_action.nil? && _action.empty?)
@@ -45,7 +45,7 @@ module Scoutui::Commands::JsAlert
45
45
  setResult(_rc)
46
46
  end
47
47
 
48
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExistsAlert() => #{alert.class.to_s} rc:#{_rc.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
48
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExistsAlert() => #{alert.class.to_s} rc:#{_rc.to_s}"
49
49
 
50
50
 
51
51
  end
@@ -12,7 +12,7 @@ module Scoutui::Commands
12
12
  h=e['page']['name'].to_s
13
13
  end
14
14
  puts "====== PAUSE - HIT ENTER #{h} ========="
15
- gets()
15
+ STDIN.gets()
16
16
  rescue => ex
17
17
  puts "Error during processing: #{$!}"
18
18
  puts "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
@@ -77,7 +77,13 @@ module Scoutui::Commands
77
77
  if !obj.nil? && obj.tag_name.downcase.match(/(select)/)
78
78
 
79
79
  _opt = Selenium::WebDriver::Support::Select.new(obj)
80
- _opt.select_by(:text, Scoutui::Base::UserVars.instance.get(_val))
80
+
81
+ if _val.match(/\s*value:(.+)$/)
82
+ _tVal = _val.match(/\s*value:(.+)$/)[1].to_s
83
+ _opt.select_by(:value, Scoutui::Base::UserVars.instance.get(_tVal))
84
+ else
85
+ _opt.select_by(:text, Scoutui::Base::UserVars.instance.get(_val))
86
+ end
81
87
 
82
88
  _rc=true
83
89
 
@@ -1,4 +1,4 @@
1
-
1
+ require 'date'
2
2
 
3
3
  module Scoutui::Commands
4
4
 
@@ -54,6 +54,11 @@ module Scoutui::Commands
54
54
  @drv.action.send_keys(:tab).perform
55
55
  _rc=true
56
56
  _isKb=true
57
+ elsif @cmd.strip.match(/^\s*type\s*\(\s*__ENTER__\s*\)\s*$/)
58
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ENTER"
59
+ @drv.action.send_keys(:enter).perform
60
+ _rc=true
61
+ _isKb=true
57
62
  else
58
63
  _xpath = @cmd.match(/^\s*type[\!]*\(([^,]*),\s*/)[1].to_s
59
64
  _val = @cmd.match(/^\s*type[\!]*\([^,]*,\s*(.*)\)/)[1].to_s
@@ -112,6 +117,7 @@ module Scoutui::Commands
112
117
 
113
118
  transList={
114
119
  '__DATE__' => lambda { Time.now().to_s },
120
+ '__DDMMYY__' => lambda { Date.parse(Time.now.to_s).strftime("%d%m%Y") },
115
121
  '__CITY__' => lambda { Faker::Address.city.to_s },
116
122
  '__ZIP__' => lambda { Faker::Address.zip_code.to_s },
117
123
  '__STREET__' => lambda { Faker::Address.street_address.to_s},
@@ -87,8 +87,8 @@ module Scoutui::Eyes
87
87
  index = 1
88
88
  data['actualAppOutput'].each do |elem|
89
89
  puts __FILE__ + (__LINE__).to_s + " elem => #{elem}"
90
- puts __FILE__ + (__LINE__).to_s + " | o isMatching : #{elem['isMatching']}"
91
90
  if (!elem.nil?)
91
+ puts __FILE__ + (__LINE__).to_s + " | o isMatching : #{elem['isMatching']}"
92
92
  # diff_urls[index] = diff_template % [index]
93
93
  diff_urls[index] = { :tag => elem['tag'].to_s, :isMatching => elem['isMatching'], :url => diff_template % [index], :index => index }
94
94
  end
@@ -230,7 +230,7 @@ module Scoutui::Utils
230
230
  }
231
231
 
232
232
  opt.on('--sauce:run NAME', [:true, :false]) { |o|
233
- @options[:sauce_run] = !o.match(/true/i).nil?
233
+ @options[:enable_sauce] = !o.match(/true/i).nil?
234
234
  }
235
235
  opt.on('--sauce_name NAME') { |o| @options[:sauce_name] = o }
236
236
  opt.on('--sauce:name NAME') { |o| @options[:sauce_name] = o }
@@ -263,6 +263,7 @@ module Scoutui::Utils
263
263
  Scoutui::Logger::LogMgr.instance.info "Viewport => #{@options[:viewport]}"
264
264
  Scoutui::Logger::LogMgr.instance.info "Viewport (Var) => #{Scoutui::Base::UserVars.instance.getViewPort().to_s}"
265
265
  Scoutui::Logger::LogMgr.instance.info "PageModel file => #{@options[:page_model].to_s}"
266
+ Scoutui::Logger::LogMgr.instance.info "Sauce.Run => #{@options[:sauce_run].to_s}"
266
267
  Scoutui::Logger::LogMgr.instance.info "Sauce.Platform => #{@options[:sauce_platform].to_s}"
267
268
  end
268
269
 
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.18.pre"
2
+ VERSION = "2.0.3.19.pre"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoutui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3.18.pre
4
+ version: 2.0.3.19.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Kim
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-02 00:00:00.000000000 Z
11
+ date: 2016-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -188,6 +188,7 @@ files:
188
188
  - examples/carmax/appmodel/search_results.json
189
189
  - examples/carmax/commands/commands.yml
190
190
  - examples/carmax/tests/test-carmax.sh
191
+ - examples/ci_reporter/ci_example.rb
191
192
  - examples/ex1/commands.holidays.yml
192
193
  - examples/ex1/commands.yml
193
194
  - examples/ex1/test-example.sh