Module: SpecTest
- Defined in:
- lib/spectest.rb,
lib/spectest/logger.rb,
lib/spectest/version.rb,
lib/spectest/matchers.rb,
lib/spectest/enclosers.rb,
lib/spectest/platforms.rb,
lib/spectest/generators.rb,
lib/spectest/platform_watir.rb,
lib/spectest/web_objects/all.rb,
lib/spectest/web_objects/link.rb,
lib/spectest/platform_selenium.rb,
lib/spectest/web_objects/button.rb,
lib/spectest/web_objects/text_field.rb,
lib/spectest/platform_watir/platform_object.rb,
lib/spectest/platform_watir/web_objects/all.rb,
lib/spectest/platform_selenium/platform_object.rb,
lib/spectest/platform_selenium/web_objects/all.rb,
lib/spectest/platform_selenium/web_objects/link.rb,
lib/spectest/platform_selenium/web_objects/button.rb,
lib/spectest/platform_watir/web_objects/text_field.rb,
lib/spectest/platform_selenium/web_objects/text_field.rb
Defined Under Namespace
Modules: Enclosers, Generators, Matchers, Platforms, WebObjects
Constant Summary collapse
- VERSION =
"0.0.4"
Instance Attribute Summary collapse
Class Method Summary collapse
-
.included(caller) ⇒ Object
This makes sure that any page classes that include SpecTest will be given access to the generator and encloser methods based on web objects that are declared in the page class.
- .trace(message, level = 1) ⇒ Object
- .version_info ⇒ Object
Instance Method Summary collapse
- #initialize(browser, visit = nil) ⇒ Object
-
#is_enclosed_by(identifier, encloser = nil, &block) ⇒ Object
Used to identify a web object as existing within an enclosing object like a frame or an iframe.
-
#navigate_to(url) ⇒ Object
Navigate to the specified URL.
-
#text ⇒ Object
Returns the text of the current page.
-
#title ⇒ Object
Returns the title of the current page as displayed in the browser.
Methods included from Platforms
associate, list, #platform_for
Instance Attribute Details
#platform ⇒ TerminusSpec::Platforms::WatirWebDriver::PlatformObject, TerminusSpec::Platforms::SeleniumWebDriver::PlatformObject (readonly)
14 15 16 |
# File 'lib/spectest.rb', line 14 def platform @platform end |
Class Method Details
.included(caller) ⇒ Object
This makes sure that any page classes that include SpecTest will be given access to the generator and encloser methods based on web objects that are declared in the page class.
23 24 25 26 |
# File 'lib/spectest.rb', line 23 def self.included(caller) caller.extend SpecTest::Generators caller.extend SpecTest::Enclosers end |
.trace(message, level = 1) ⇒ Object
2 3 4 |
# File 'lib/spectest/logger.rb', line 2 def self.trace(, level=1) puts("*" * level + " #{}") if ENV['TRACE'] == 'on' end |
Instance Method Details
#initialize(browser, visit = nil) ⇒ Object
28 29 30 31 32 |
# File 'lib/spectest.rb', line 28 def initialize(browser, visit=nil) @browser = browser establish_platform_driver_for browser goto if visit && respond_to?(:goto) end |
#is_enclosed_by(identifier, encloser = nil, &block) ⇒ Object
Used to identify a web object as existing within an enclosing object like a frame or an iframe. There is a duplicate method in enclosers.rb. This method needs to be here so that test steps can be placed in an enclosed context.
64 65 66 67 68 |
# File 'lib/spectest.rb', line 64 def is_enclosed_by(identifier, encloser=nil, &block) encloser = [] if encloser.nil? encloser << identifier block.call(encloser) end |
#navigate_to(url) ⇒ Object
Navigate to the specified URL. The URL can be specified as a domain address or as a file-based link.
37 38 39 40 41 42 43 44 |
# File 'lib/spectest.rb', line 37 def navigate_to(url) # Here is exactly why a platform object is needed. Which version do I call: # @browser.goto(url) <-- this is for Watir # @browser.navigate.to(url) <-- this is for Selenium # I have to call the platform that has been established. The platform will # be responsible for containing the correct call. @platform.navigate_to url end |
#text ⇒ Object
Returns the text of the current page.
52 53 54 |
# File 'lib/spectest.rb', line 52 def text @platform.text end |
#title ⇒ Object
Returns the title of the current page as displayed in the browser.
47 48 49 |
# File 'lib/spectest.rb', line 47 def title @platform.title end |