scoutui 2.0.3.12.pre → 2.0.3.13.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: 8dbc193e812d3840b4f8674467687c22e5649cca
4
- data.tar.gz: 11d70545cb748c686b96c02e1c6e1722fafd03c3
3
+ metadata.gz: dfaa410be9c5fd6446abf3b4e38f87818add2761
4
+ data.tar.gz: 634ea5ac53446a9a873a9d3552df6e6ddff0a739
5
5
  SHA512:
6
- metadata.gz: 07f09f239c0ac58c43eeee0e5a36cf14f768aaf5ef29ff54ab419bd6230efb6828f945b9ab2abf2d501b6dcb8bf5bc8e607306b7c0c6eb064f05d89008562434
7
- data.tar.gz: ebde6d08112ffd5d3ea22ff48b4e375a8f7b6276f7662670aaa28d6645121032ea53b29be74c6d876fd77e7ec185b80eeca8330e5275cf6127e421d57a7e82a8
6
+ metadata.gz: a270587c067edd35289dc756168085df21ffa040d90849236592f438f5505d85df9fac302a4bcb5b16d7efc8f414145e4ec97ea1a017e266c36c262282b8d0b6
7
+ data.tar.gz: e70f51d5a752bdeb644ad96f0552a4463bf3012cbb32519b92449959ca44a54a3ae53d0ad27ac11b09e818561950721adca8b77b2fd4210359a4f0b858ba184c
@@ -50,7 +50,6 @@ module Scoutui::Base
50
50
  rc=true
51
51
  end
52
52
 
53
-
54
53
  rescue Selenium::WebDriver::Error::NoSuchAlertError
55
54
  ;
56
55
  end
@@ -87,7 +86,7 @@ module Scoutui::Base
87
86
  Selenium::WebDriver::Wait.new(timeout: _timeout).until { drv.find_elements(locateBy => locator).size > 0 }
88
87
  rc=drv.find_elements(locateBy => locator)[0]
89
88
  rescue => ex
90
- Scoutui::Logger::LogMgr.instance.debug "getFirstObject.Exception: #{locator.to_s} - #{ex}"
89
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getFirstObject.Exception: #{locator.to_s} - #{ex}"
91
90
  ;
92
91
  end
93
92
 
@@ -413,7 +412,6 @@ module Scoutui::Base
413
412
  # locator = locator.match(/\#(.*)/)[1].to_s
414
413
  end
415
414
 
416
-
417
415
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " By => #{locateBy.to_s}"
418
416
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Locator => #{locator}"
419
417
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Visible_When => #{visible_when}"
@@ -422,15 +420,15 @@ module Scoutui::Base
422
420
 
423
421
 
424
422
  rescue Selenium::WebDriver::Error::TimeOutError
425
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{locator} time out."
423
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "TimeoutError: #{locator} time out."
426
424
  rc=nil
427
425
 
428
426
  rescue Selenium::WebDriver::Error::NoSuchElementError
429
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{locator} not found."
427
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "NoSuchElementError: #{locator} not found."
430
428
  rc=nil
431
429
 
432
430
  rescue => ex
433
- Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{$!}"
431
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Error during processing: #{$!}"
434
432
  Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
435
433
  end
436
434
 
@@ -443,6 +441,62 @@ module Scoutui::Base
443
441
  Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }
444
442
  end
445
443
 
444
+ def self.click(element)
445
+ rc=false
446
+
447
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " click(#{element})"
448
+
449
+ if element.is_a?(Selenium::WebDriver::Element)
450
+
451
+ begin
452
+ element.click
453
+ rc=true
454
+ rescue => ex
455
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Error during processing: #{$!}"
456
+ Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
457
+ end
458
+
459
+ end
460
+
461
+ rc
462
+ end
463
+
464
+ def self.highlight(drv, locator, style={"color" => 255, "border" => 2}, ancestors=0)
465
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highLight(#{locator})"
466
+
467
+ rc=false
468
+
469
+ # element = find_element(method, locator)
470
+
471
+ if locator.is_a?(Selenium::WebDriver::Element)
472
+ element = locator
473
+ else
474
+ element = getObject(drv, locator)
475
+ end
476
+
477
+ if element.nil?
478
+ return rc
479
+ end
480
+
481
+ color=style.has_key?("color")? style["color"] : 255
482
+ border=style.has_key?("border")? style["border"] : 1
483
+
484
+ ancestors=style.has_key?("ancestors")? style["ancestors"] : 0
485
+
486
+ drv.execute_script("hlt = function(c) { c.style.border='solid #{border}px rgb(#{color}, 16, 16)'; }; return hlt(arguments[0]);", element)
487
+ parents = ""
488
+
489
+ ancestors.times do
490
+ parents << ".parentNode"
491
+ color -= (12*8 / ancestors)
492
+ drv.execute_script("hlt = function(c) { c#{parents}.style.border='solid 1px rgb(#{color}, 0, 0)'; }; return hlt(arguments[0]);", element)
493
+ end
494
+
495
+ # Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " PAUSE on highlight"; gets
496
+ element
497
+ end
498
+
499
+
446
500
  def driver
447
501
  @driver
448
502
  end
@@ -4,7 +4,6 @@ require 'selenium-webdriver'
4
4
 
5
5
  module Scoutui::Base
6
6
 
7
-
8
7
  class QForm
9
8
 
10
9
  attr_accessor :elements
@@ -37,6 +36,7 @@ module Scoutui::Base
37
36
  def actionElement(drv, locator)
38
37
 
39
38
  _action=nil
39
+ _rc=false
40
40
 
41
41
  obj = Scoutui::Base::QBrowser.getObject(drv, locator, Scoutui::Commands::Utils.instance.getTimeout)
42
42
  _type = obj.attribute('type').to_s
@@ -51,21 +51,22 @@ module Scoutui::Base
51
51
 
52
52
  _action="send_keys"
53
53
  obj.send_keys(_v)
54
+ _rc=true
54
55
  elsif !_type.match(/(date|number|search|tel|time|url|week)/i).nil?
55
56
  _v = Scoutui::Base::UserVars.instance.get(dut[k].to_s)
56
57
  _action="send_keys"
57
58
  obj.send_keys(_v)
59
+ _rc=true
58
60
  elsif !_type.match(/(button|checkbox|radio|submit)/i).nil?
59
61
  _action="click"
60
- obj.click()
62
+ _rc=Scoutui::Base::QBrowser.click(obj)
61
63
  else
62
64
  _action="click"
63
- obj.click()
65
+ _rc=Scoutui::Base::QBrowser.click(obj)
64
66
  end
65
67
 
66
- Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " action : #{_action}"
67
- _action
68
-
68
+ Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " action : #{_action} => #{_rc}"
69
+ _rc
69
70
  end
70
71
 
71
72
  def submitForm(drv=nil)
@@ -82,8 +83,7 @@ module Scoutui::Base
82
83
  if !action_obj.nil?
83
84
  # Find the submit action element
84
85
  Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " -- submit => #{action_obj}"
85
- actionElement(drv, action_obj[action_obj.keys[0]])
86
- rc=true
86
+ rc=actionElement(drv, action_obj[action_obj.keys[0]])
87
87
  else
88
88
  Scoutui::Logger::LogMgr.instance.commands.warn __FILE__ + (__LINE__).to_s + " WARN: missing action object."
89
89
  end
@@ -357,8 +357,8 @@ module Scoutui::Base
357
357
 
358
358
  if _v.has_key?('locator') && _v['locator'].is_a?(String) && _v.has_key?('enabled_when')
359
359
 
360
- Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " Process pageObject #{_v} for enabled_when - PAUSE"; gets;
361
- isVisible=Scoutui::Base::Assertions.instance.isEnabled(my_driver, _v, _req)
360
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " Process pageObject #{_v} for enabled_when - TBD"; # TBD gets;
361
+ isVisible=Scoutui::Base::Assertions.instance.isEnabled(my_driver, _v['locator'], _req)
362
362
 
363
363
  elsif _v.has_key?('locator') && _v['locator'].is_a?(String) && !_v.has_key?('visible_when')
364
364
  Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " Process pageObject #{_v}"
@@ -107,7 +107,19 @@ module Scoutui::Commands
107
107
  isEnabled = wait.until { obj.enabled? }
108
108
 
109
109
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " obj is enabled : #{isEnabled}"
110
+
111
+
112
+ if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('highlight') && e['page']['highlight']
113
+ #
114
+ # page:
115
+ # highlight: true
116
+ #
117
+ obj=Scoutui::Base::QBrowser.highlight(@drv, obj)
118
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " highlight then click : #{obj}"
119
+ end
120
+
110
121
  obj.click
122
+
111
123
  _clicked=true
112
124
 
113
125
  page_elt = Scoutui::Utils::TestUtils.instance.getPageElement(_locator)
@@ -128,7 +140,7 @@ module Scoutui::Commands
128
140
  end
129
141
 
130
142
  rescue => ex
131
- Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}"
143
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{ex.message}"
132
144
  Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
133
145
  end
134
146
 
@@ -11,12 +11,12 @@ module Scoutui::Commands
11
11
  begin
12
12
  rc=processCommand(cmd[:command], cmd[:e], my_driver)
13
13
  rescue => ex
14
- Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{$!}"
14
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Error during processing: #{$!}"
15
15
  Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
16
16
  end
17
17
  end
18
18
 
19
- Scoutui::Logger::LogMgr.instance.debug " exit [processCommands]"
19
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " exit [processCommands]"
20
20
  end
21
21
 
22
22
 
@@ -36,10 +36,15 @@ module Scoutui::Commands
36
36
 
37
37
  _c=nil
38
38
 
39
- my_driver.switch_to.default_content
40
-
41
-
42
-
39
+ ##
40
+ # Check if an alert exists.
41
+ ##
42
+ begin
43
+ my_driver.switch_to.alert
44
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " Alert currently active."
45
+ rescue Selenium::WebDriver::Error::NoSuchAlertError
46
+ my_driver.switch_to.default_content
47
+ end
43
48
 
44
49
  if Scoutui::Commands::Utils.instance.isPause?(_action)
45
50
  _cmd='pause'
@@ -58,8 +63,8 @@ module Scoutui::Commands
58
63
  _c = Scoutui::Commands::ClickObject.new(_action)
59
64
  _c.execute(my_driver, e)
60
65
 
61
- if e["page"].has_key?('then')
62
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " then => #{e['page']['then]']}"
66
+ if e[STEP_KEY].has_key?('then')
67
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " then => #{e[STEP_KEY]['then]']}"
63
68
  end
64
69
 
65
70
  elsif Scoutui::Commands::Utils.instance.isExistsAlert?(_action)
@@ -77,6 +82,12 @@ module Scoutui::Commands
77
82
  _c = Scoutui::Commands::ExistsAlert.new(_action)
78
83
  rc=_c.execute(my_driver)
79
84
 
85
+
86
+ elsif Scoutui::Commands::Utils.instance.isHighlight?(_action)
87
+ _cmd="Highlight"
88
+ _c = Scoutui::Commands::Highlight.new(_action)
89
+ rc = _c.execute(my_driver, e)
90
+
80
91
  elsif Scoutui::Commands::Utils.instance.isMouseOver?(_action)
81
92
  _cmd='MouseOver'
82
93
  _c = Scoutui::Commands::MouseOver.new(_action)
@@ -0,0 +1,69 @@
1
+
2
+ module Scoutui::Commands
3
+
4
+ class Highlight < Command
5
+
6
+
7
+ def _highlight(obj, e=nil)
8
+ _rc=false
9
+
10
+ if !obj.nil?
11
+
12
+ if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('style')
13
+ style=e['page']['style']
14
+ obj=Scoutui::Base::QBrowser.highlight(@drv, obj, style)
15
+ else
16
+ obj=Scoutui::Base::QBrowser.highlight(@drv, obj)
17
+ end
18
+
19
+ _rc=true
20
+ end
21
+
22
+ _rc
23
+ end
24
+
25
+ def execute(drv, e=nil)
26
+ rc=true
27
+ _req = Scoutui::Utils::TestUtils.instance.getReq()
28
+
29
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Highlight.execute(#{@cmd})"
30
+
31
+ @drv=drv if !drv.nil?
32
+
33
+ begin
34
+
35
+ locators=[]
36
+
37
+ if @cmd.match(/highlight\s*\((.*)\)/)
38
+ _locator = @cmd.match(/highlight\s*\((.*)\)/)[1].to_s.strip
39
+ locators << _locator
40
+ elsif e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('locators')
41
+ locators = e['page']['locators']
42
+ end
43
+
44
+ locators.each do |loc|
45
+ obj = Scoutui::Base::QBrowser.getObject(@drv, loc, Scoutui::Commands::Utils.instance.getTimeout)
46
+ _rc = _highlight(obj, e)
47
+
48
+ rc &&= _rc
49
+
50
+ Testmgr::TestReport.instance.getReq(_req).testcase('highlight').add(!obj.nil?, "Verify object #{_locator} to highlight exists : #{obj.class.to_s}")
51
+ Testmgr::TestReport.instance.getReq(_req).testcase('highlight').add(_rc, "Verify highlight #{_rc} performed for #{_locator}")
52
+
53
+ end
54
+
55
+ rescue => ex
56
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Error during processing: #{$!}"
57
+ Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
58
+ end
59
+
60
+
61
+ setResult(rc)
62
+ end
63
+
64
+
65
+
66
+ end
67
+
68
+
69
+ end
@@ -248,6 +248,13 @@ module Scoutui::Commands
248
248
  else
249
249
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Create WebDriver: #{browserType.to_s}"
250
250
  @drv=Selenium::WebDriver.for browserType.to_sym, :profile => @profile
251
+
252
+ _viewport = Scoutui::Utils::TestUtils.instance.getViewPort()
253
+ if !_viewport.nil?
254
+ target_size = Selenium::WebDriver::Dimension.new(_viewport[:width], _viewport[:height])
255
+ @drv.manage.window.size = target_size
256
+ end
257
+
251
258
  end
252
259
 
253
260
  end
@@ -19,6 +19,7 @@ module Scoutui::Commands
19
19
  'clickJsAlert',
20
20
  'fillform',
21
21
  'frame',
22
+ 'highlight',
22
23
  'submitform',
23
24
  'type',
24
25
  'click',
@@ -132,6 +133,10 @@ module Scoutui::Commands
132
133
  _action.match(/^\s*(frame|switchframe|switch_frame)\s*\(/i)
133
134
  end
134
135
 
136
+ def isHighlight?(_action)
137
+ _action.match(/^\s*(highlight)/i)
138
+ end
139
+
135
140
  def isVerifyElt?(_action)
136
141
  !_action.match(/(verifyelt|verifyelement)\(/i).nil?
137
142
  end
@@ -190,6 +195,8 @@ module Scoutui::Commands
190
195
  @totalCommands['frame']+=1
191
196
  elsif isGetAlert?(cmd)
192
197
  @totalCommands['clickJsAlert']+=1
198
+ elsif isHighlight?(cmd)
199
+ @totalCommands['highlight']+=1
193
200
  elsif isVerifyElt?(cmd)
194
201
  @totalCommands['verifyelt']+=1
195
202
  elsif isVerifyForm?(cmd)
@@ -31,7 +31,8 @@ module Scoutui::Utils
31
31
  @currentTest={:reqid => 'UI', :testcase => '00' }
32
32
 
33
33
  [:accounts, :browser, :capabilities, :diffs_dir, :test_file, :host, :loc, :title, :viewport,
34
- :userid, :password, :json_config_file, :page_model, :test_config, :debug].each do |o|
34
+ :userid, :password, :json_config_file, :page_model, :test_config,
35
+ :sauce_platform, :sauce_resolution, :debug].each do |o|
35
36
  @options[o]=nil
36
37
  end
37
38
 
@@ -118,6 +119,20 @@ module Scoutui::Utils
118
119
  @app_model
119
120
  end
120
121
 
122
+ def getViewPort()
123
+ rc=nil
124
+
125
+ if !options[:viewport].nil?
126
+ arr=options[:viewport].match(/(\d+)\s*x\s*(\d+)$/i)
127
+ if arr.size==3
128
+ rc = {width: arr[1].to_i, height: arr[2].to_i}
129
+ end
130
+ end
131
+
132
+ rc
133
+ end
134
+
135
+
121
136
  def parseCommandLine()
122
137
 
123
138
  OptionParser.new do |opt|
@@ -208,6 +223,9 @@ module Scoutui::Utils
208
223
  }
209
224
  opt.on('--sauce_name NAME') { |o| @options[:sauce_name] = o }
210
225
  opt.on('--sauce:build id') { |o| @options[:sauce_build] = o }
226
+ opt.on('--sauce:platform PLATFORM') { |o| @options[:sauce_platform] = o }
227
+ opt.on('--sauce:resolution RESOLUTION') { |o| @options[:sauce_resolution] = o }
228
+
211
229
  opt.on('--viewport [resolution]') { |o| options[:viewport] = o }
212
230
  end.parse!
213
231
 
@@ -233,6 +251,14 @@ module Scoutui::Utils
233
251
  end
234
252
 
235
253
  def getCapabilities()
254
+ if !saucePlatform().nil?
255
+ @options[:capabilities][:platform]=saucePlatform()
256
+ end
257
+
258
+ if !sauceResolution().nil?
259
+ @options[:capabilities][:screenResolution]=sauceResolution()
260
+ end
261
+
236
262
  @options[:capabilities]
237
263
  end
238
264
 
@@ -256,10 +282,18 @@ module Scoutui::Utils
256
282
  @options[:enable_sauce]
257
283
  end
258
284
 
285
+ def saucePlatform()
286
+ @options[:sauce_platform]
287
+ end
288
+
259
289
  def getLicenseFile()
260
290
  @options[:license_file].to_s
261
291
  end
262
292
 
293
+ def sauceResolution()
294
+ @options[:sauce_resolution]
295
+ end
296
+
263
297
  def getRole()
264
298
  @options[:role]
265
299
  end
@@ -344,12 +378,13 @@ module Scoutui::Utils
344
378
  end
345
379
 
346
380
  if !@options[k.to_sym].nil?
381
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " eyes[#{k.to_s}] override with #{@options[k.to_sym]}"
382
+
347
383
  _v=@options[k.to_sym].to_s
348
384
  end
349
385
 
350
- if Scoutui::Utils::TestUtils.instance.isDebug?
351
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{k} => #{_v}"
352
- end
386
+
387
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{k} => #{_v}"
353
388
 
354
389
  Scoutui::Base::UserVars.instance.set('eyes.' + k, _v) if !_v.nil?
355
390
 
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.12.pre"
2
+ VERSION = "2.0.3.13.pre"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoutui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3.12.pre
4
+ version: 2.0.3.13.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Kim
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-06-01 00:00:00.000000000 Z
12
+ date: 2016-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -232,6 +232,7 @@ files:
232
232
  - lib/scoutui/commands/commands.rb
233
233
  - lib/scoutui/commands/exists_alert.rb
234
234
  - lib/scoutui/commands/fill_form.rb
235
+ - lib/scoutui/commands/highlight.rb
235
236
  - lib/scoutui/commands/jsalert/action_jsalert.rb
236
237
  - lib/scoutui/commands/mouse_over.rb
237
238
  - lib/scoutui/commands/pause.rb