Class: Polonium::TestCase

Inherits:
Object
  • Object
show all
Includes:
SeleniumDsl
Defined in:
lib/polonium/test_case.rb

Overview

The Test Case class that runs your Selenium tests. You are able to use all methods provided by Selenium::SeleneseInterpreter with some additions.

Instance Attribute Summary collapse

Attributes included from SeleniumDsl

#selenium_driver

Attributes included from WaitFor

#default_timeout

Instance Method Summary collapse

Methods included from SeleniumDsl

#assert_attribute, #assert_element_contains, #assert_element_does_not_contain, #configuration, #download, element_assertion, #element_contains_text, page_assertion

Methods included from WaitFor

#default_wait_for_time, #flunk, #time_class, #wait_for

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Polonium::SeleniumDsl

Instance Attribute Details

#use_instantiated_fixturesObject

Returns the value of attribute use_instantiated_fixtures.



7
8
9
# File 'lib/polonium/test_case.rb', line 7

def use_instantiated_fixtures
  @use_instantiated_fixtures
end

#use_transactional_fixturesObject

Returns the value of attribute use_transactional_fixtures.



7
8
9
# File 'lib/polonium/test_case.rb', line 7

def use_transactional_fixtures
  @use_transactional_fixtures
end

Instance Method Details

#run(result, &block) ⇒ Object



34
35
36
37
# File 'lib/polonium/test_case.rb', line 34

def run(result, &block)
  return if @method_name.nil? || @method_name.to_sym == :default_test
  super
end

#selenium_test_caseObject



30
31
32
# File 'lib/polonium/test_case.rb', line 30

def selenium_test_case
  @selenium_test_case ||= TestCase
end

#setupObject



16
17
18
19
# File 'lib/polonium/test_case.rb', line 16

def setup
  raise "Cannot use transactional fixtures if ActiveRecord concurrency is turned on (which is required for Selenium tests to work)." if self.class.use_transactional_fixtures
  @selenium_driver = configuration.driver
end

#teardownObject



21
22
23
24
25
26
27
28
# File 'lib/polonium/test_case.rb', line 21

def teardown
  selenium_driver.stop if stop_driver?
  super
  if @beginning
    duration = (time_class.now - @beginning).to_f
    puts "#{duration} seconds"
  end
end