Module: MiniAutobot::Utils::AssertionHelper

Included in:
TestCase
Defined in:
lib/mini_autobot/utils/assertion_helper.rb

Overview

A collection of custom, but frequently-used assertions.

Instance Method Summary collapse

Instance Method Details

#assert_element_absent(how, what) ⇒ Object

Assert that an element, specified by ‘how` and `what`, are absent from the current page’s context.

Parameters:

  • how (:class, :class_name, :css, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath)
  • what (String, Symbol)


15
16
17
18
19
# File 'lib/mini_autobot/utils/assertion_helper.rb', line 15

def assert_element_absent(how, what)
  assert_raises Selenium::WebDriver::Error::NoSuchElementError do
    @driver.find_element(how, what)
  end
end

#assert_element_present(how, what) ⇒ Object

Assert that an element, specified by ‘how` and `what`, are present from the current page’s context.

Parameters:

  • how (:class, :class_name, :css, :id, :link_text, :link, :partial_link_text, :name, :tag_name, :xpath)
  • what (String, Symbol)


27
28
29
# File 'lib/mini_autobot/utils/assertion_helper.rb', line 27

def assert_element_present(how, what)
  @driver.find_element(how, what)
end