Class: Applitools::Selenium::RunningTest
- Inherits:
-
Object
- Object
- Applitools::Selenium::RunningTest
- Extended by:
- Forwardable
- Defined in:
- lib/applitools/selenium/visual_grid/running_test.rb
Instance Attribute Summary collapse
-
#browser_info ⇒ Object
Returns the value of attribute browser_info.
-
#close_queue ⇒ Object
Returns the value of attribute close_queue.
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#eyes ⇒ Object
Returns the value of attribute eyes.
-
#open_queue ⇒ Object
Returns the value of attribute open_queue.
-
#pending_exceptions ⇒ Object
Returns the value of attribute pending_exceptions.
-
#render_queue ⇒ Object
Returns the value of attribute render_queue.
-
#task_lock ⇒ Object
Returns the value of attribute task_lock.
-
#task_queue ⇒ Object
Returns the value of attribute task_queue.
-
#test_result ⇒ Object
Returns the value of attribute test_result.
-
#watch_close ⇒ Object
Returns the value of attribute watch_close.
-
#watch_open ⇒ Object
Returns the value of attribute watch_open.
-
#watch_render ⇒ Object
Returns the value of attribute watch_render.
-
#watch_task ⇒ Object
Returns the value of attribute watch_task.
Instance Method Summary collapse
- #all_tasks_completed?(watch) ⇒ Boolean
- #check(tag, target, result, visual_grid_manager, region_selectors, size_mod, region_to_check, mod = nil) ⇒ Object
- #init ⇒ Object
-
#initialize(eyes, browser_info, driver) ⇒ RunningTest
constructor
A new instance of RunningTest.
Constructor Details
#initialize(eyes, browser_info, driver) ⇒ RunningTest
Returns a new instance of RunningTest.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 123 def initialize(eyes, browser_info, driver) Applitools::ArgumentGuard.is_a? eyes, 'eyes', Applitools::Selenium::EyesConnector self.eyes = eyes self.browser_info = browser_info self.driver = driver self.open_queue = [] self.task_queue = [] self.render_queue = [] self.close_queue = [] self.watch_open = {} self.watch_task = {} self.watch_render = {} self.watch_close = {} self.task_lock = nil self.pending_exceptions = [] super() init end |
Instance Attribute Details
#browser_info ⇒ Object
Returns the value of attribute browser_info.
121 122 123 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 121 def browser_info @browser_info end |
#close_queue ⇒ Object
Returns the value of attribute close_queue.
119 120 121 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 119 def close_queue @close_queue end |
#driver ⇒ Object
Returns the value of attribute driver.
121 122 123 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 121 def driver @driver end |
#eyes ⇒ Object
Returns the value of attribute eyes.
121 122 123 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 121 def eyes @eyes end |
#open_queue ⇒ Object
Returns the value of attribute open_queue.
119 120 121 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 119 def open_queue @open_queue end |
#pending_exceptions ⇒ Object
Returns the value of attribute pending_exceptions.
121 122 123 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 121 def pending_exceptions @pending_exceptions end |
#render_queue ⇒ Object
Returns the value of attribute render_queue.
119 120 121 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 119 def render_queue @render_queue end |
#task_lock ⇒ Object
Returns the value of attribute task_lock.
121 122 123 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 121 def task_lock @task_lock end |
#task_queue ⇒ Object
Returns the value of attribute task_queue.
119 120 121 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 119 def task_queue @task_queue end |
#test_result ⇒ Object
Returns the value of attribute test_result.
121 122 123 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 121 def test_result @test_result end |
#watch_close ⇒ Object
Returns the value of attribute watch_close.
119 120 121 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 119 def watch_close @watch_close end |
#watch_open ⇒ Object
Returns the value of attribute watch_open.
119 120 121 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 119 def watch_open @watch_open end |
#watch_render ⇒ Object
Returns the value of attribute watch_render.
119 120 121 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 119 def watch_render @watch_render end |
#watch_task ⇒ Object
Returns the value of attribute watch_task.
119 120 121 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 119 def watch_task @watch_task end |
Instance Method Details
#all_tasks_completed?(watch) ⇒ Boolean
196 197 198 199 200 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 196 def all_tasks_completed?(watch) return true if state_name == :completed uniq_values = watch.values.uniq uniq_values.count == 1 && uniq_values.first == true end |
#check(tag, target, result, visual_grid_manager, region_selectors, size_mod, region_to_check, mod = nil) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 156 def check(tag, target, result, visual_grid_manager, region_selectors, size_mod, region_to_check, mod = nil) render_task = RenderTask.new( "Render #{eyes.config.short_description} - #{tag}", result, self, visual_grid_manager.resource_cache, visual_grid_manager.put_cache, visual_grid_manager.rendering_info(eyes.server_connector), eyes.server_connector, region_selectors, size_mod, region_to_check, target.[:script_hooks], mod ) check_task = VGTask.new("perform check #{tag} #{target}") do eyes.check(tag, target, render_task.uuid) end check_task.on_task_completed do watch_task[check_task] = true self.task_lock = nil if task_lock.uuid == check_task.uuid becomes_tested if all_tasks_completed?(watch_task) end task_queue.insert(0, check_task) watch_task[check_task] = false render_task.on_task_succeeded do |r| eyes.render_status_for_task(render_task.uuid, r) if r watch_render[render_task] = true becomes_rendered if all_tasks_completed?(watch_render) end.on_task_error do becomes_completed end render_queue << render_task watch_render[render_task] = false end |
#init ⇒ Object
147 148 149 150 151 152 153 154 |
# File 'lib/applitools/selenium/visual_grid/running_test.rb', line 147 def init open_task = Applitools::Selenium::VGTask.new("open #{browser_info}") { eyes.open(driver, browser_info) } open_task.on_task_succeeded { watch_open[open_task] = true; becomes_opened if all_tasks_completed?(watch_open) }. on_task_error { |e| pending_exceptions << e; becomes_completed } open_queue << open_task watch_open[open_task] = false end |