class SpecTest::WebObjects::WebObject
Public Class Methods
have_selenium_find_object_with(locator)
click to toggle source
# File lib/spectest/web_objects/all.rb, line 24 def self.have_selenium_find_object_with(locator) if locator.length == 1 SpecTest::trace("What I got: #{locator}") object_locator = locator_for(locator, locators_for_selenium, mappings_for_selenium) SpecTest::trace("What I gave: #{object_locator}") return object_locator.keys.first, object_locator.values.first end end
have_watir_find_object_with(locator)
click to toggle source
# File lib/spectest/web_objects/all.rb, line 10 def self.have_watir_find_object_with(locator) locator_list = {} locator.each do |key, value| current = {key => value} SpecTest::trace("What I got: #{current}") object_locator = locator_for(current, locators_for_watir, mappings_for_watir) SpecTest::trace("What I gave: #{object_locator}") locator_list[object_locator.keys.first] = object_locator.values.first end locator_list end
new(web_object, platform)
click to toggle source
# File lib/spectest/web_objects/all.rb, line 5 def initialize(web_object, platform) @web_object = web_object mixin_web_objects_for platform end
Protected Class Methods
locator_for(locator, direct_find, mapping_find)
click to toggle source
# File lib/spectest/web_objects/all.rb, line 35 def self.locator_for(locator, direct_find, mapping_find) key, value = locator.keys.first, locator.values.first return key => value if direct_find.include? key return mapping_find[key] => value if mapping_find[key] return nil => value end
locators_for_selenium()
click to toggle source
# File lib/spectest/web_objects/all.rb, line 50 def self.locators_for_selenium [:class, :id, :index, :name, :xpath] end
locators_for_watir()
click to toggle source
# File lib/spectest/web_objects/all.rb, line 42 def self.locators_for_watir [:class, :id, :index, :name, :xpath] end
mappings_for_selenium()
click to toggle source
# File lib/spectest/web_objects/all.rb, line 54 def self.mappings_for_selenium {} end
mappings_for_watir()
click to toggle source
# File lib/spectest/web_objects/all.rb, line 46 def self.mappings_for_watir {} end
Protected Instance Methods
mixin_web_objects_for(platform)
click to toggle source
# File lib/spectest/web_objects/all.rb, line 58 def mixin_web_objects_for(platform) if platform[:platform] == :watir_webdriver require "spectest/platform_watir/web_objects/all" require "spectest/platform_watir/platform_object" self.class.send :include, SpecTest::Platforms::WatirWebDriver::WebObject @platform = SpecTest::Platforms::WatirWebDriver::PlatformObject.new(@web_object) elsif platform[:platform] == :selenium_webdriver require "spectest/platform_selenium/web_objects/all" require "spectest/platform_selenium/platform_object" self.class.send :include, SpecTest::Platforms::SeleniumWebDriver::WebObject @platform = SpecTest::Platforms::SeleniumWebDriver::PlatformObject.new(@web_object) else raise ArgumentError, "Unable to mixin web objects for the specified platform." end end