scoutui 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +154 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/scoutui_driver.rb +22 -0
  12. data/bin/setup +7 -0
  13. data/examples/ex1/commands.holidays.yml +45 -0
  14. data/examples/ex1/commands.yml +25 -0
  15. data/examples/ex1/test-example.sh +38 -0
  16. data/examples/ex1/test.config.json +16 -0
  17. data/examples/ex2/commands.yml +35 -0
  18. data/examples/ex2/page_model.json +28 -0
  19. data/examples/ex2/test-example.sh +39 -0
  20. data/examples/ex2/test.config.json +25 -0
  21. data/lib/scoutui.rb +8 -0
  22. data/lib/scoutui/appmodel/q_model.rb +82 -0
  23. data/lib/scoutui/base/assertions.rb +62 -0
  24. data/lib/scoutui/base/q_accounts.rb +52 -0
  25. data/lib/scoutui/base/q_applitools.rb +127 -0
  26. data/lib/scoutui/base/q_browser.rb +185 -0
  27. data/lib/scoutui/base/q_form.rb +261 -0
  28. data/lib/scoutui/base/test_scout.rb +120 -0
  29. data/lib/scoutui/base/test_settings.rb +109 -0
  30. data/lib/scoutui/base/user_vars.rb +108 -0
  31. data/lib/scoutui/base/visual_test_framework.rb +574 -0
  32. data/lib/scoutui/commands/click_object.rb +45 -0
  33. data/lib/scoutui/commands/command.rb +56 -0
  34. data/lib/scoutui/commands/commands.rb +133 -0
  35. data/lib/scoutui/commands/exists_alert.rb +54 -0
  36. data/lib/scoutui/commands/fill_form.rb +56 -0
  37. data/lib/scoutui/commands/jsalert/action_jsalert.rb +58 -0
  38. data/lib/scoutui/commands/mouse_over.rb +31 -0
  39. data/lib/scoutui/commands/pause.rb +26 -0
  40. data/lib/scoutui/commands/select_object.rb +54 -0
  41. data/lib/scoutui/commands/strategy.rb +202 -0
  42. data/lib/scoutui/commands/submit_form.rb +44 -0
  43. data/lib/scoutui/commands/type.rb +44 -0
  44. data/lib/scoutui/commands/update_url.rb +45 -0
  45. data/lib/scoutui/commands/utils.rb +128 -0
  46. data/lib/scoutui/commands/verify_element.rb +198 -0
  47. data/lib/scoutui/commands/verify_form.rb +26 -0
  48. data/lib/scoutui/eyes/eye_factory.rb +76 -0
  49. data/lib/scoutui/eyes/eye_scout.rb +239 -0
  50. data/lib/scoutui/logger/log_mgr.rb +105 -0
  51. data/lib/scoutui/navigator.rb +24 -0
  52. data/lib/scoutui/utils/utils.rb +352 -0
  53. data/lib/scoutui/version.rb +3 -0
  54. data/scoutui.gemspec +35 -0
  55. metadata +54 -2
  56. data/pkg/scoutui-2.0.0.gem +0 -0
@@ -0,0 +1,28 @@
1
+ {
2
+ "home": {
3
+ "cars4sale": {
4
+ "locator": "//a[text()='Find Cars for Sale']",
5
+ "visible_when": "always"
6
+ },
7
+ "whyCarMax": {
8
+ "locator": "//*[@id='header']//a[text()='Why CarMax']",
9
+ "visible_when": "always"
10
+ },
11
+
12
+ "sign_in": {
13
+ "locator": "//input[text()='Sign in']",
14
+ "visible_when": "always"
15
+ }
16
+ },
17
+
18
+ "main_nav": {
19
+ "search_input": "//input[@id='search']",
20
+ "search_btn": "//a[@id='search-btn']"
21
+ },
22
+
23
+
24
+ "search": {
25
+ "header": "//title"
26
+ }
27
+ }
28
+
@@ -0,0 +1,39 @@
1
+ #/bin/bash
2
+ ##
3
+ # Description
4
+ # This test script overrides the provided title and appname (if provided in the test config. file)
5
+ #
6
+ # Set the APPLITOOLS_API_KEY environment variable with your key.
7
+ #
8
+ # export APPLITOOLS_API_KEY="__YOUR_KEY_HERE__"
9
+ ##
10
+ SCOUTUI_BIN=../../bin/scoutui_driver.rb
11
+ # Specify browser under test (chrome, firefox, ie, safari)
12
+ BUT=firefox
13
+
14
+ # Specify the title and appName needed by Applitools
15
+ ## NOTE: If the test configuration file specifies the title and app, it is superseded by the
16
+ ## command line options.
17
+ TITLE=DEMO-CarMax
18
+ APP=Oct2015
19
+
20
+ # Specify the test configuration file
21
+ TEST_CFG="./test.config.json"
22
+
23
+ ##
24
+ # content
25
+ # strict
26
+ # exact
27
+ # layyout
28
+ ##
29
+ MATCH_TYPE="layout"
30
+
31
+ EYES=--eyes
32
+ EYES=
33
+
34
+
35
+ # The following command line parameters will override provided title and appName (if provided in test config file)
36
+ $SCOUTUI_BIN --config $TEST_CFG --browser $BUT $EYES --app $APP --title $TITLE --match $MATCH_TYPE --pagemodel ./page_model.json --debug
37
+
38
+ # The following
39
+ # $SCOUTUI_BIN --config $TEST_CFG --eyes --match $MATCH_TYPE --browser $BUT
@@ -0,0 +1,25 @@
1
+ {
2
+ "Project": "Example",
3
+ "Version": "1.00",
4
+ "Description": "Example - CarMax",
5
+
6
+ "browser": "chrome",
7
+
8
+ "eyes": {
9
+ "title": "Example - CarMax",
10
+ "viewport": "1024x718",
11
+ "app": "10-16"
12
+ },
13
+
14
+ "host": "http://www.carmax.com",
15
+ "dut": "./commands.yml",
16
+
17
+
18
+ "user_vars": {
19
+ "Search_Me": "BMW M3",
20
+ "View_Tickets_Link": "page(main_nav).get(ViewTicketsLink)",
21
+ "WhyCarMax": "page(home).get(whyCarMax)"
22
+ }
23
+
24
+ }
25
+
data/lib/scoutui.rb ADDED
@@ -0,0 +1,8 @@
1
+
2
+ module Scoutui
3
+
4
+ ROOT_DIR = File.join(File.dirname(File.expand_path(__FILE__)), 'scoutui').freeze
5
+
6
+ Dir["#{ROOT_DIR}/*.rb"].each { |f| require f }
7
+ Dir["#{ROOT_DIR}/**/*.rb"].each { |f| require f }
8
+ end
@@ -0,0 +1,82 @@
1
+
2
+
3
+ module Scoutui::ApplicationModel
4
+
5
+ class QModel
6
+ attr_accessor :_file
7
+ attr_accessor :app_model
8
+
9
+ def initialize(f=nil)
10
+
11
+ if !f.nil?
12
+ @_file=f
13
+ loadPages(@_file)
14
+ end
15
+
16
+ end
17
+
18
+ def getAppModel()
19
+ @app_model
20
+ end
21
+
22
+ def loadPages(jlist)
23
+
24
+ json_list=[]
25
+ if jlist.kind_of?(String)
26
+ json_list << jlist
27
+ else
28
+ json_list=jlist
29
+ end
30
+
31
+ jsonData={}
32
+ json_list.each { |f|
33
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " JSON.parse(#{f})"
34
+
35
+ begin
36
+ data_hash = JSON.parse File.read(f)
37
+ jsonData.merge!(data_hash)
38
+ rescue JSON::ParserError
39
+ Scoutui::Logger::LogMgr.instance.fatal "raise JSON::ParseError - #{f.to_s}"
40
+ raise "JSONLoadError"
41
+ end
42
+
43
+ }
44
+ Scoutui::Logger::LogMgr.instance.debug "merged jsonData => " + jsonData.to_json
45
+ @app_model = jsonData
46
+ end
47
+
48
+
49
+ # getPageElement("page(login).get(login_form).get(button)")
50
+ def getPageElement(s)
51
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getPageElement(#{s})"
52
+ hit=@app_model
53
+
54
+ nodes = s.split(/\./)
55
+
56
+ nodes.each { |elt|
57
+ getter = elt.split(/\(/)[0]
58
+ _obj = elt.match(/\((.*)\)/)[1]
59
+
60
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getter : #{getter} obj: #{_obj}" if Scoutui::Utils::TestUtils.instance.isDebug?
61
+
62
+ if getter.downcase.match(/(page|pg)/)
63
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " -- process page --" if Scoutui::Utils::TestUtils.instance.isDebug?
64
+ hit=@app_model[_obj]
65
+ elsif getter.downcase=='get'
66
+ hit=hit[_obj]
67
+ else
68
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getter : #{getter} is unknown."
69
+ return nil
70
+ end
71
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " HIT => #{hit}" if Scoutui::Utils::TestUtils.instance.isDebug?
72
+ }
73
+
74
+ hit
75
+
76
+ end
77
+
78
+ end
79
+
80
+
81
+
82
+ end
@@ -0,0 +1,62 @@
1
+
2
+ require 'singleton'
3
+
4
+
5
+ module Scoutui::Base
6
+
7
+
8
+ class Assertions
9
+ include Singleton
10
+
11
+ attr_accessor :drv
12
+
13
+
14
+ def setDriver(_drv)
15
+ @drv=_drv
16
+ end
17
+
18
+ # { "visible_when" => "always" }
19
+ def visible_when_always(_k, _v, _obj=nil)
20
+
21
+ _locator=nil
22
+ rc=false
23
+ if _v.has_key?('locator')
24
+ _locator = _v['locator'].to_s
25
+ end
26
+
27
+ if !_locator.nil? && _v.has_key?('visible_when') && _v['visible_when'].match(/always/i)
28
+ Scoutui::Logger::LogMgr.instance.info "Verify #{_k} - #{_locator} always visible - #{!_obj.nil?.to_s}"
29
+ Testmgr::TestReport.instance.getReq('UI').get_child('visible_when').add(!_obj.nil?, "Verify #{_k} - #{_locator} always visible")
30
+ rc=true
31
+ end
32
+ rc
33
+ end
34
+
35
+ # { "visible_when" => true }
36
+ def visible_when_skip(_k, _v)
37
+
38
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " visible_when_visible : #{_v.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
39
+ rc=false
40
+
41
+ if _v.is_a?(Hash) && _v.has_key?('visible_when') && _v['visible_when'].match(/skip/i)
42
+ rc=true
43
+
44
+ Scoutui::Logger::LogMgr.instance.asserts.info "Skip verify #{_k.to_s} - skipped"
45
+ Testmgr::TestReport.instance.getReq('UI').get_child('visible_when').add(nil, "Skip verify #{_k.to_s}")
46
+ end
47
+
48
+ rc
49
+ end
50
+
51
+ # _a : Hash
52
+ # o locator => String
53
+ # o visible_when => Hash
54
+ def visible_when_visible(_a)
55
+
56
+ end
57
+
58
+ end
59
+
60
+
61
+
62
+ end
@@ -0,0 +1,52 @@
1
+
2
+ module Scoutui::Base
3
+
4
+ class QAccounts
5
+
6
+
7
+ attr_accessor :dut
8
+ attr_accessor :accounts
9
+
10
+ def initialize(f)
11
+
12
+ if !f.nil?
13
+ @accounts = YAML.load_stream File.read(f)
14
+ end
15
+
16
+ end
17
+
18
+ def _find(id, attr)
19
+ hit = @accounts.find { |h| h['account']['loginid'] == id }
20
+ if !hit.nil?
21
+ id=hit['account'][attr]
22
+ end
23
+ id
24
+ end
25
+
26
+ def getUserRecord(u)
27
+ hit=nil
28
+
29
+ userid=getUserId(u)
30
+ if !userid.nil?
31
+ hit={'userid' => getUserId(u), 'password' => getPassword(u) }
32
+ end
33
+
34
+ hit
35
+ end
36
+
37
+ def getUserId(userid)
38
+ id=nil
39
+ hit = @accounts.find { |h| h['account']['loginid'].to_s == userid.to_s }
40
+ if !hit.nil?
41
+ id=hit['account']['loginid']
42
+ end
43
+ id
44
+ end
45
+
46
+ def getPassword(u)
47
+ _find(u, 'password')
48
+ end
49
+
50
+ end
51
+
52
+ end
@@ -0,0 +1,127 @@
1
+
2
+ require 'eyes_selenium'
3
+ require 'httparty'
4
+
5
+
6
+ module Scoutui::Base
7
+
8
+ class QApplitools
9
+
10
+
11
+ attr_accessor :eyes
12
+
13
+ def initialize
14
+ @eyes=nil
15
+ end
16
+
17
+
18
+ def setup
19
+ @eyes = Applitools::Eyes.new
20
+ # This is your api key, make sure you use it in all your tests.
21
+ @eyes.api_key = "API_KEY"
22
+
23
+ # Get a selenium web driver object.
24
+ @driver = Selenium::WebDriver.for :chrome
25
+ #Eyes.log_handler = Logger.new(STDOUT)
26
+ end
27
+
28
+ # Called after every test method runs. Can be used to tear
29
+ # down fixtures information.
30
+
31
+ def teardown
32
+ @eyes.abort_if_not_closed
33
+ end
34
+
35
+ def report(results)
36
+ download_diffs(results, "VIEW_KEY", '/tmp/diff_images')
37
+ end
38
+
39
+ # Fake test
40
+ def xxxtestit
41
+ #@eyes.baseline_name='my_test_name'
42
+ wrapped_driver = @eyes.open(
43
+ app_name: 'Applitools website',
44
+ test_name: 'Example test',
45
+ viewport_size: {width: 900, height: 650},
46
+ driver: @driver)
47
+ wrapped_driver.get 'https://www.applitools.com'
48
+ # Visual validation point #1
49
+ @eyes.check_window('Main Page')
50
+
51
+ wrapped_driver.find_element(:css, ".features>a").click
52
+ # Visual validation point #2
53
+ @eyes.check_window('Features Page')
54
+ results = @eyes.close(false)
55
+
56
+ download_diffs(results, "VIEW_KEY", './diff_images')
57
+ print_results(results, "VIEW_KEY")
58
+ end
59
+
60
+ def print_results(results, view_key)
61
+ if results.is_passed
62
+ print "Your test was passed!\n"
63
+ elsif results.is_new
64
+ print "Created new baseline, this is a new test or/and new configuration!"
65
+ else
66
+ print "Your test was failed!\n"
67
+ print "#{results.mismatches} out of #{results.steps} steps failed \n"
68
+ print "Here are the failed steps:\n"
69
+ session_id = get_session_id(results.url)
70
+ diff_urls = get_diff_urls(session_id, view_key)
71
+ diff_urls.each do |index, diff_url|
72
+ print "Step #{index} --> #{diff_url} \n"
73
+ end
74
+ print "For more details please go to #{results.url} to review the differences! \n"
75
+ end
76
+ end
77
+
78
+ def download_diffs(results, view_key, destination)
79
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " download_diffs()"
80
+
81
+ session_id = get_session_id(results.url)
82
+ diff_urls = get_diff_urls(session_id, view_key)
83
+ download_images(diff_urls, destination)
84
+ end
85
+
86
+ def download_images(diff_urls, destination)
87
+ diff_urls.each do |index, url|
88
+ File.open("#{destination}/step_#{index}_diff.png", 'wb') do |file|
89
+ file.write HTTParty.get(url)
90
+ end
91
+ end
92
+ end
93
+
94
+ def get_diff_urls(session_id, view_key)
95
+ info = "https://eyes.applitools.com/api/sessions/#{session_id}/?ApiKey=#{view_key}&format=json"
96
+ diff_template = "https://eyes.applitools.com/api/sessions/#{session_id}/steps/%s/diff?ApiKey=#{view_key}"
97
+ diff_urls = Hash.new
98
+
99
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " info => #{info}"
100
+ response = HTTParty.get(info)
101
+
102
+ begin
103
+ data = JSON.parse(response.body)
104
+ index = 1
105
+ data['actualOutput'].each do |elem|
106
+ if (elem['isMatching'] == false)
107
+ diff_urls[index] = diff_template % [index]
108
+ index+=1
109
+ end
110
+ end
111
+
112
+ diff_urls
113
+
114
+ rescue JSON::ParserError
115
+ ;
116
+ end
117
+
118
+ end
119
+
120
+ def get_session_id(url)
121
+ /sessions\/(?<session>\d+)/.match(url)[1]
122
+ end
123
+
124
+ end
125
+
126
+
127
+ end
@@ -0,0 +1,185 @@
1
+
2
+ require 'eyes_selenium'
3
+ require 'selenium-webdriver'
4
+
5
+ module Scoutui::Base
6
+
7
+
8
+ class QBrowser
9
+
10
+ attr_accessor :driver
11
+
12
+ def initialize()
13
+ end
14
+
15
+ def self.wait_for_displayed(drv, locator, _timeout=30)
16
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " wait_for_displayed(#{xpath}"
17
+ rc=nil
18
+ begin
19
+ Selenium::WebDriver::Wait.new(timeout: _timeout).until { rc=drv.find_element(:xpath => xpath).displayed? }
20
+ rescue => ex
21
+ ;
22
+ end
23
+ rc
24
+ end
25
+
26
+ def self.wait_for_exist(drv, xpath, _timeout=30)
27
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " wait_for_exist(#{xpath}"
28
+ rc=nil
29
+ begin
30
+ Selenium::WebDriver::Wait.new(timeout: _timeout).until { drv.find_element(:xpath => xpath) }
31
+ rc=drv.find_element(:xpath => xpath)
32
+ rescue => ex
33
+ ;
34
+ end
35
+ rc
36
+ end
37
+
38
+ def self.getFirstObject(drv, _locator, _timeout=30)
39
+
40
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getFirstObject(#{_locator})" if Scoutui::Utils::TestUtils.instance.isDebug?
41
+ rc=nil
42
+ locator=_locator
43
+
44
+ begin
45
+ locateBy=:xpath
46
+
47
+ if _locator.match(/^css\=/i)
48
+ locateBy = :css
49
+ locator = _locator.match(/css\=(.*)/i)[1].to_s
50
+ elsif _locator.match(/^#/i)
51
+ locateBy = :css
52
+ end
53
+
54
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " locator => #{locator.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
55
+ Selenium::WebDriver::Wait.new(timeout: _timeout).until { drv.find_elements(locateBy => locator).size > 0 }
56
+ rc=drv.find_elements(locateBy => locator)[0]
57
+ rescue => ex
58
+ Scoutui::Logger::LogMgr.instance.debug "getFirstObject.Exception: #{locator.to_s} - #{ex}"
59
+ ;
60
+ end
61
+
62
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{_locator} => #{rc}"
63
+ rc
64
+ end
65
+
66
+ # http://stackoverflow.com/questions/15164742/combining-implicit-wait-and-explicit-wait-together-results-in-unexpected-wait-ti#answer-15174978
67
+ def self.getObject(drv, obj, _timeout=30)
68
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getObject(#{obj}) class:#{obj.class.to_s} hash : #{obj.is_a?(Hash)}" if Scoutui::Utils::TestUtils.instance.isDebug?
69
+ rc=nil
70
+ visible_when=nil
71
+ locator=obj
72
+ locateBy=:xpath
73
+ locator=nil
74
+
75
+ begin
76
+
77
+ if obj.is_a?(Hash)
78
+
79
+
80
+ if obj.has_key?('visible_when')
81
+ visible_when=!obj['visible_when'].match(/always/i).nil?
82
+ end
83
+
84
+ locator = obj['locator'].to_s
85
+
86
+
87
+ elsif !obj.match(/^page\([\w\d]+\)/).nil?
88
+
89
+ elt = Scoutui::Utils::TestUtils.instance.getPageElement(obj)
90
+
91
+ if elt.is_a?(Hash)
92
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " JSON or Hash => #{elt}" if Scoutui::Utils::TestUtils.instance.isDebug?
93
+ locator = elt['locator'].to_s
94
+ else
95
+ locator=elt.to_s
96
+ end
97
+
98
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process page request #{obj} => #{locator}" if Scoutui::Utils::TestUtils.instance.isDebug?
99
+
100
+ else
101
+ locator=obj.to_s
102
+ end
103
+
104
+ if !locator.match(/\$\{.*\}/).nil?
105
+ _x = Scoutui::Base::UserVars.instance.get(locator)
106
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " User specified user var : #{locator} ==> #{_x}"
107
+ if !_x.nil?
108
+
109
+
110
+ if !_x.match(/^page\([\w\d]+\)/).nil?
111
+ elt = Scoutui::Utils::TestUtils.instance.getPageElement(_x)
112
+
113
+ if elt.is_a?(Hash)
114
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " JSON or Hash => #{elt}" if Scoutui::Utils::TestUtils.instance.isDebug?
115
+ locator = elt['locator'].to_s
116
+ else
117
+ locator=elt.to_s
118
+ end
119
+ end
120
+
121
+ end
122
+
123
+ end
124
+
125
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " locator : #{locator}" if Scoutui::Utils::TestUtils.instance.isDebug?
126
+
127
+ if locator.match(/^\s*css\s*\=\s*/i)
128
+ locateBy = :css
129
+ locator = locator.match(/css\s*\=\s*(.*)/i)[1].to_s
130
+ elsif locator.match(/^#/i)
131
+ locateBy = :css
132
+ # locator = locator.match(/\#(.*)/)[1].to_s
133
+ end
134
+
135
+
136
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " By => #{locateBy.to_s}"
137
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Locator => #{locator}"
138
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Visible_When => #{visible_when}"
139
+
140
+ # Selenium::WebDriver::Wait.new(timeout: _timeout).until { drv.find_element(:xpath => locator).displayed? }
141
+ # rc=drv.find_element(:xpath => locator)
142
+ Selenium::WebDriver::Wait.new(timeout: _timeout).until { rc=drv.find_element( locateBy => locator) }
143
+
144
+
145
+ rescue Selenium::WebDriver::Error::TimeOutError
146
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{locator} time out."
147
+ rc=nil
148
+
149
+ rescue Selenium::WebDriver::Error::NoSuchElementError
150
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " #{locator} not found."
151
+ rc=nil
152
+
153
+ rescue => ex
154
+ Scoutui::Logger::LogMgr.instance.debug "Error during processing: #{$!}"
155
+ Scoutui::Logger::LogMgr.instance.debug "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
156
+ end
157
+
158
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " getObject(#{locator}) => #{rc.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
159
+
160
+ # if rc.kind_of?(Selenium::WebDriver::Element)
161
+ #
162
+ # if visible_when
163
+ # Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Displayed => #{rc.displayed?}"
164
+ # Testmgr::TestReport.instance.getReq('UI').tc('visible_when').add(rc.displayed?, "Verify #{locator} is visible")
165
+ # end
166
+ #
167
+ # end
168
+
169
+ rc
170
+ end
171
+
172
+ def wait_for(seconds)
173
+ Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }
174
+ end
175
+
176
+ def driver
177
+ @driver
178
+ end
179
+
180
+
181
+
182
+ end
183
+
184
+
185
+ end