selenium_fury 0.5.12 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +2 -7
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/features/custom_generator.feature +1 -1
- data/features/generate_page_object.feature +1 -1
- data/features/step_definitions/custom_generator_steps.rb +81 -125
- data/features/step_definitions/generate_page_object_steps.rb +3 -3
- data/features/step_definitions/validate_page_object_steps.rb +4 -4
- data/features/support/env.rb +10 -4
- data/features/support/hooks.rb +2 -1
- data/features/validate_page_object.feature +3 -3
- data/lib/selenium_fury.rb +3 -4
- data/lib/selenium_fury/common/selenium_api_chooser.rb +19 -7
- data/lib/selenium_fury/selenium_client/locator_finder.rb +15 -0
- data/lib/selenium_fury/selenium_client/page_generator.rb +1 -0
- data/lib/selenium_fury/selenium_client/page_validator.rb +12 -37
- data/lib/selenium_fury/selenium_web_driver/element_finder.rb +16 -1
- data/lib/selenium_fury/selenium_web_driver/page_object.rb +2 -2
- data/lib/selenium_fury/selenium_web_driver/page_object_components.rb +1 -1
- data/spec/common/selenium_api_chooser_spec.rb +11 -11
- data/spec/selenium_client/custom_generators_spec.rb +23 -7
- data/spec/selenium_client/page_generator_spec.rb +3 -3
- data/spec/selenium_client/page_validator_spec.rb +5 -5
- data/spec/selenium_client/test_page_rc_spec.rb +14 -0
- data/spec/selenium_web_driver/element_finder_spec.rb +1 -1
- data/spec/selenium_web_driver/page_generator_spec.rb +10 -10
- data/spec/selenium_web_driver/page_object_spec.rb +69 -40
- data/spec/selenium_web_driver/page_validator_spec.rb +5 -5
- data/spec/spec_helper.rb +13 -12
- data/spec/test_page/test_page.html +70 -0
- data/spec/test_page/test_page.rb +21 -0
- data/spec/test_page/test_page_custom_generator_configuration.rb +16 -0
- data/spec/test_page/test_page_rc.rb +25 -0
- metadata +194 -181
- data/selenium_fury.gemspec +0 -118
- data/spec/selenium_client/advanced_search.rb +0 -55
- data/spec/selenium_client/advanced_search_custom_generator_configuration.rb +0 -16
- data/spec/selenium_client/advanced_search_spec.rb +0 -15
- data/spec/selenium_web_driver/advanced_search.rb +0 -47
- data/spec/selenium_web_driver/inquiry_side_bar.rb +0 -7
- data/spec/selenium_web_driver/property_page.rb +0 -3
@@ -20,7 +20,7 @@ module SeleniumFury
|
|
20
20
|
attr_accessor :found_missing_locators
|
21
21
|
# @param page_file_class [Class] The page object class you want to test
|
22
22
|
# @param live_url [String] the url of the page your testing
|
23
|
-
def check_page_file_class(page_file_class,
|
23
|
+
def check_page_file_class(page_file_class, live_url = nil)
|
24
24
|
raise "cannot access the selenium client driver" if browser.nil?
|
25
25
|
missing_locators={}
|
26
26
|
puts "Validating the #{page_file_class} class"
|
@@ -28,16 +28,14 @@ module SeleniumFury
|
|
28
28
|
test_page = page_file_class.new(browser)
|
29
29
|
raise "The test class is nil" if test_page.nil?
|
30
30
|
#skip the open if we don't need to open the url again
|
31
|
-
|
31
|
+
if live_url
|
32
32
|
puts "Opening #{browser.browser_url}/#{live_url}" #if $DEBUG
|
33
33
|
browser.open live_url
|
34
34
|
end
|
35
35
|
|
36
|
-
#check for class methods and execute.
|
37
|
-
verify_class_variables(test_page, missing_locators) if test_page.public_methods(all=false).length > 0
|
38
|
-
|
39
36
|
#check for instance methods and execute.
|
40
37
|
verify_instance_variables(test_page, missing_locators) if test_page.instance_variables.length > 0
|
38
|
+
|
41
39
|
@found_missing_locators=missing_locators
|
42
40
|
return print_missing_locators(missing_locators)
|
43
41
|
end
|
@@ -66,48 +64,25 @@ module SeleniumFury
|
|
66
64
|
def verify_instance_variables(test_page, missing_locators)
|
67
65
|
#test_page.print_properties browser
|
68
66
|
test_page.instance_variables.each do |locator_name|
|
67
|
+
locator_name_string = locator_name.to_s
|
69
68
|
#prepare the locator values
|
70
|
-
|
71
|
-
if attribute_name_filter(locator_name)
|
72
|
-
puts "Skipping validation for #{locator_name}"
|
73
|
-
next
|
74
|
-
end
|
75
|
-
next if (test_page.method(locator_name).call.class.to_s != "String")
|
76
|
-
puts " Validating the #{locator_name} page element locator" #chomp the @ sign off of the method name.
|
77
|
-
locator_value = test_page.method(locator_name) # Create the reference to the get method of the instance variable
|
78
|
-
begin
|
79
|
-
browser.wait_for_element(locator_value.call, {:timeout_in_seconds => "5"})
|
80
|
-
rescue
|
81
|
-
puts " ----------------------------------- Could not find '#{locator_name}'"
|
82
|
-
end
|
83
|
-
missing_locators[locator_name]= locator_value.call if !browser.element?(locator_value.call) # Use the value of the instance variable
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
# @param test_page [Object] an instantiated page object
|
88
|
-
# @param missing_locators [Hash]
|
89
|
-
def verify_class_variables(test_page, missing_locators)
|
90
|
-
test_page.public_methods(all=false).each do |locator_name|
|
91
|
-
#Only operate with the set methods not the get methods
|
92
|
-
next if (!locator_name.include?("="))
|
93
|
-
|
94
|
-
locator_name.slice!(locator_name.length-1)
|
69
|
+
locator_name_string.slice!(0)
|
95
70
|
|
96
|
-
if attribute_name_filter(
|
71
|
+
if attribute_name_filter(locator_name_string)
|
97
72
|
puts "Skipping validation for #{locator_name}"
|
98
73
|
next
|
99
74
|
end
|
100
|
-
|
75
|
+
|
76
|
+
# I don't understand where this would ever be true, but I'll leave it I guess?
|
77
|
+
# next if (test_page.method(locator_name_string.to_sym).class.to_s != "String")
|
101
78
|
puts " Validating the #{locator_name} page element locator" #chomp the @ sign off of the method name.
|
102
|
-
locator_value = test_page.method(
|
103
|
-
#Now validate the page
|
79
|
+
locator_value = test_page.method(locator_name_string.to_sym) # Create the reference to the get method of the instance variable
|
104
80
|
begin
|
105
81
|
browser.wait_for_element(locator_value.call, {:timeout_in_seconds => "5"})
|
106
82
|
rescue
|
107
|
-
puts " -----------------------------------
|
83
|
+
puts " ----------------------------------- Could not find '#{locator_name}'"
|
84
|
+
missing_locators[locator_name_string]= locator_value.call
|
108
85
|
end
|
109
|
-
missing_locators[locator_name]= locator_value.call if !browser.element?(locator_value.call) # Use the value of the instance variable
|
110
|
-
|
111
86
|
end
|
112
87
|
end
|
113
88
|
|
@@ -1,3 +1,18 @@
|
|
1
|
+
#/* Copyright (c) 2010 HomeAway, Inc.
|
2
|
+
# * All rights reserved. http://www.homeaway.com
|
3
|
+
# *
|
4
|
+
# * Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# * you may not use this file except in compliance with the License.
|
6
|
+
# * You may obtain a copy of the License at
|
7
|
+
# *
|
8
|
+
# * http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
# *
|
10
|
+
# * Unless required by applicable law or agreed to in writing, software
|
11
|
+
# * distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# * See the License for the specific language governing permissions and
|
14
|
+
# * limitations under the License.
|
15
|
+
# */
|
1
16
|
module SeleniumFury
|
2
17
|
module SeleniumWebDriver
|
3
18
|
class ElementFinder
|
@@ -13,7 +28,7 @@ module SeleniumFury
|
|
13
28
|
nokogiri_elements.each do |nokogiri_element|
|
14
29
|
valid_locators.each do |valid_locator|
|
15
30
|
if nokogiri_element.get_attribute(valid_locator) != nil
|
16
|
-
locators.push({valid_locator.to_sym
|
31
|
+
locators.push({valid_locator.to_sym => nokogiri_element.get_attribute(valid_locator)})
|
17
32
|
break
|
18
33
|
end
|
19
34
|
end
|
@@ -18,8 +18,8 @@ class PageObject
|
|
18
18
|
include SeleniumFury::SeleniumWebDriver::PageObjectComponents
|
19
19
|
include SeleniumFury::SeleniumWebDriver::CreateSeleniumWebDriver
|
20
20
|
|
21
|
-
def initialize
|
22
|
-
@driver =
|
21
|
+
def initialize driver = nil
|
22
|
+
@driver = driver
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
@@ -57,7 +57,7 @@ module SeleniumFury
|
|
57
57
|
# @return [PageObject]
|
58
58
|
def page(page_sym, page_class)
|
59
59
|
send :define_method, page_sym do
|
60
|
-
raise "#{page_class} does not inherit from PageObject" unless page_class.superclass == PageObject
|
60
|
+
raise "#{page_class.to_s} does not inherit from PageObject" unless page_class.superclass == PageObject
|
61
61
|
page_class.new(driver)
|
62
62
|
end
|
63
63
|
end
|
@@ -2,38 +2,38 @@ require 'spec_helper'
|
|
2
2
|
describe SeleniumFury::SeleniumApiChooser do
|
3
3
|
context "Finding generate/validate methods" do
|
4
4
|
it "should find the generator for selenium client tests" do
|
5
|
-
create_selenium_client_driver
|
5
|
+
create_selenium_client_driver TEST_PAGE_URL
|
6
6
|
should_receive(:get_source_and_print_elements)
|
7
7
|
generate(browser)
|
8
8
|
end
|
9
9
|
it "should find the generator for selenium web_driver tests" do
|
10
|
-
launch_web_driver
|
10
|
+
launch_web_driver TEST_PAGE_URL
|
11
11
|
should_receive(:web_driver_generate)
|
12
12
|
generate(driver)
|
13
13
|
end
|
14
14
|
it "should find the validator for selenium client tests" do
|
15
|
-
create_selenium_client_driver
|
16
|
-
should_receive(:check_page_file_class).with(NilClass)
|
17
|
-
validate(NilClass)
|
15
|
+
create_selenium_client_driver TEST_PAGE_URL
|
16
|
+
should_receive(:check_page_file_class).with(NilClass, nil)
|
17
|
+
validate(NilClass, nil)
|
18
18
|
end
|
19
19
|
it "should find the validator for selenium web driver tests" do
|
20
|
-
launch_web_driver
|
20
|
+
launch_web_driver TEST_PAGE_URL
|
21
21
|
should_receive(:web_driver_validate).with(NilClass)
|
22
22
|
validate(NilClass)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
context "Integrating with generator/validator methods" do
|
26
26
|
it "should find generate method for selenium client tests" do
|
27
|
-
create_selenium_driver
|
27
|
+
create_selenium_driver TEST_PAGE_URL
|
28
28
|
browser.start_new_browser_session
|
29
|
-
browser.open
|
30
|
-
generate(browser).should include("found (
|
29
|
+
browser.open TEST_PAGE_URL
|
30
|
+
generate(browser).should include("found (15 elements)")
|
31
31
|
end
|
32
32
|
it "should find validate method for selenium client tests" do
|
33
|
-
create_selenium_driver
|
33
|
+
create_selenium_driver TEST_PAGE_URL
|
34
34
|
browser.start_new_browser_session
|
35
35
|
puts "Testing #{browser.browser_url} on #{browser.browser_string} "
|
36
|
-
validate(
|
36
|
+
validate(TestPageRc, TEST_PAGE_URL)
|
37
37
|
end
|
38
38
|
it "should have found missing locators in module", SeleniumFury::SeleniumApiChooser do
|
39
39
|
SeleniumFury::SeleniumClient::PageValidator.respond_to?(:found_missing_locators).should be_true
|
@@ -1,13 +1,29 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
describe
|
3
|
-
|
4
|
-
|
2
|
+
describe TestPageCustomGeneratorConfiguration do
|
3
|
+
|
4
|
+
it "should generate the test page link locators" do
|
5
|
+
create_selenium_driver TEST_PAGE_URL
|
5
6
|
browser.start_new_browser_session
|
6
7
|
puts "Testing #{browser.browser_url} on #{browser.browser_string} "
|
7
|
-
browser.open
|
8
|
-
|
8
|
+
browser.open TEST_PAGE_URL
|
9
|
+
test_page_custom_generator_configuration = TestPageCustomGeneratorConfiguration.new
|
9
10
|
result = custom_generator(:browser => browser,
|
10
|
-
:custom_configuration =>
|
11
|
-
result.should
|
11
|
+
:custom_configuration => test_page_custom_generator_configuration)
|
12
|
+
result.should == custom_generator_result
|
12
13
|
end
|
14
|
+
let(:custom_generator_result){
|
15
|
+
<<EOF
|
16
|
+
found (3 elements)
|
17
|
+
class YourPageFile
|
18
|
+
def initialize *browser
|
19
|
+
@browser = *browser
|
20
|
+
@link_1 = "link111111"
|
21
|
+
@link_2 = "link222222"
|
22
|
+
@link_3 = "link333333"
|
23
|
+
end
|
24
|
+
attr_accessor :browser, :link_1, :link_2, :link_3
|
25
|
+
|
26
|
+
end
|
27
|
+
EOF
|
28
|
+
}
|
13
29
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
describe SeleniumFury::SeleniumClient::PageGenerator do
|
3
3
|
it "should find elements on the HomeAway advanced search page" do
|
4
|
-
create_selenium_driver
|
4
|
+
create_selenium_driver TEST_PAGE_URL
|
5
5
|
browser.start_new_browser_session
|
6
6
|
puts "Testing #{browser.browser_url} on #{browser.browser_string} "
|
7
|
-
browser.open
|
7
|
+
browser.open TEST_PAGE_URL
|
8
8
|
result = generate(browser)
|
9
|
-
result.should include("found (
|
9
|
+
result.should include("found (15 elements)")
|
10
10
|
end
|
11
11
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
describe SeleniumFury::SeleniumClient::PageValidator do
|
3
|
-
it "should validate the elements contained on the
|
4
|
-
create_selenium_driver
|
3
|
+
it "should validate the elements contained on the TestPage page object" do
|
4
|
+
create_selenium_driver TEST_PAGE_URL
|
5
5
|
browser.start_new_browser_session
|
6
|
-
validate(
|
6
|
+
validate(TestPageRc, TEST_PAGE_URL)
|
7
7
|
@found_missing_locators.should_not be_nil
|
8
8
|
@found_missing_locators.should have(0).missing_locators
|
9
9
|
end
|
10
10
|
it "should fail if there are missing locators" do
|
11
|
-
create_selenium_driver
|
11
|
+
create_selenium_driver TEST_PAGE_URL
|
12
12
|
class MissingLocators
|
13
13
|
def initialize *browser
|
14
14
|
@browser=browser
|
@@ -19,7 +19,7 @@ describe SeleniumFury::SeleniumClient::PageValidator do
|
|
19
19
|
end
|
20
20
|
browser.start_new_browser_session
|
21
21
|
begin
|
22
|
-
validate(MissingLocators,
|
22
|
+
validate(MissingLocators, TEST_PAGE_URL)
|
23
23
|
rescue Exception => e
|
24
24
|
puts e.message.should include("found missing locators")
|
25
25
|
@found_missing_locators["missing"].should =="missing_id"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
describe TestPageRc do
|
3
|
+
it "should use elements on the TestPageRc" do
|
4
|
+
create_selenium_driver TEST_PAGE_URL
|
5
|
+
browser.start_new_browser_session
|
6
|
+
puts "Testing #{browser.browser_url} on #{browser.browser_string} "
|
7
|
+
browser.open TEST_PAGE_URL
|
8
|
+
test_page = TestPageRc.new(browser)
|
9
|
+
browser.click test_page.input_message
|
10
|
+
browser.type test_page.input_message, "this is awesome"
|
11
|
+
browser.click test_page.input_msg_button
|
12
|
+
browser.text("message").should == "this is awesome"
|
13
|
+
end
|
14
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
describe SeleniumFury::SeleniumWebDriver::PageGenerator do
|
3
|
-
it "should find elements on the
|
4
|
-
launch_web_driver
|
3
|
+
it "should find elements on the Test page" do
|
4
|
+
launch_web_driver TEST_PAGE_URL
|
5
5
|
result = generate(driver)
|
6
|
-
result.should include
|
7
|
-
result.should include
|
6
|
+
result.should include 'found (15 elements)'
|
7
|
+
result.should include 'element :form, {:id => "form"}'
|
8
8
|
end
|
9
|
-
it "should return a page object" do
|
10
|
-
launch_web_driver
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
it "should return a TestPage page object" do
|
10
|
+
launch_web_driver TEST_PAGE_URL
|
11
|
+
test_page = get_page_object driver, "TestPage"
|
12
|
+
test_page.should be_instance_of TestPage
|
13
|
+
test_page.input_button.should be_instance_of Selenium::WebDriver::Element
|
14
14
|
end
|
15
15
|
end
|
@@ -1,55 +1,84 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
describe
|
2
|
+
describe SeleniumFury::SeleniumWebDriver::CreateSeleniumWebDriver do
|
3
|
+
it "should go to page using launch_web_driver" do
|
4
|
+
launch_web_driver TEST_PAGE_URL
|
5
|
+
driver.current_url.should include "/spec/test_page/test_page.html"
|
6
|
+
driver.title.should == "SeleniumFury Test Page"
|
7
|
+
end
|
8
|
+
end
|
3
9
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
10
|
+
describe PageObject do
|
11
|
+
it "should have a text area method on the test page" do
|
12
|
+
launch_web_driver TEST_PAGE_URL
|
13
|
+
test_page = TestPage.new(driver)
|
14
|
+
test_page.should_not be_nil
|
15
|
+
test_page.textarea.should be_a(Selenium::WebDriver::Element)
|
9
16
|
end
|
10
|
-
it "should have
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
17
|
+
it "should have a test page" do
|
18
|
+
class ComponentPage < PageObject
|
19
|
+
|
20
|
+
end
|
21
|
+
TestPage.page(:component_page, ComponentPage)
|
22
|
+
TestPage.new().component_page.should be_a(ComponentPage)
|
16
23
|
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
search.search_keywords Faker::Lorem.words
|
24
|
+
|
25
|
+
it "should have an error if a non page object class is passed to page method" do
|
26
|
+
TestPage.page(:not_a_page, String)
|
27
|
+
expect { TestPage.new().not_a_page }.to(raise_exception(RuntimeError, "String does not inherit from PageObject"))
|
22
28
|
end
|
23
29
|
|
24
|
-
it "should
|
25
|
-
launch_web_driver
|
26
|
-
|
27
|
-
|
28
|
-
|
30
|
+
it "should use elements on the TestPage" do
|
31
|
+
launch_web_driver TEST_PAGE_URL
|
32
|
+
test_page = TestPage.new(driver)
|
33
|
+
test_page.input_message.send_keys "this is awesome"
|
34
|
+
test_page.input_msg_button.click
|
35
|
+
driver.find_element(:id => "message").text.should == "this is awesome"
|
29
36
|
end
|
30
37
|
|
31
|
-
it "should
|
32
|
-
launch_web_driver
|
33
|
-
|
34
|
-
|
35
|
-
|
38
|
+
it "should use some methods man" do
|
39
|
+
launch_web_driver TEST_PAGE_URL
|
40
|
+
test_page = TestPage.new(driver)
|
41
|
+
test_page.click_check_box
|
42
|
+
driver.find_element(:id => "input_checkbox").selected?.should be_true
|
36
43
|
end
|
37
44
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
45
|
+
# OK, so here's some great info about the "magic" behind ruby.
|
46
|
+
# When ruby spins up, an Object class is created, and everything runs "inside" it
|
47
|
+
# When you do code like this: TestPage.new() an instance of TestPage is added as a constant
|
48
|
+
# to the instance of this "global" Object class
|
49
|
+
# Therefore, since rspec is running "inside" this Object Class, an instance of TestPage is
|
50
|
+
# instantiated and shared from test to test, BUT when you do get_page_object, an instance
|
51
|
+
# of the page object must be created and added as a constant, but if it already exists,
|
52
|
+
# you're gonna have bad time. Therefore, for testing sake, we must check for this,
|
53
|
+
# and handle it appropriately.
|
54
|
+
#
|
55
|
+
# It should also be noted that get_page_object only adds page elements to the class
|
56
|
+
# and currently doesn't look for a pre-defined page object in the project
|
57
|
+
|
58
|
+
it "should have elements" do
|
59
|
+
Object.instance_eval { remove_const :TestPage } if Object.const_defined? :TestPage
|
60
|
+
launch_web_driver TEST_PAGE_URL
|
61
|
+
test_page = get_page_object(driver, 'TestPage')
|
62
|
+
test_page.class.elements.should_not be_nil
|
63
|
+
test_page.class.elements.should have(15).elements
|
64
|
+
test_page.method(test_page.class.elements[0]).call.class.should == Selenium::WebDriver::Element
|
65
|
+
Object.instance_eval { remove_const :TestPage }
|
42
66
|
end
|
43
|
-
it "should
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
67
|
+
it "should return a web_driver element when an attribute is accessed" do
|
68
|
+
Object.instance_eval { remove_const :TestPage } if Object.const_defined? :TestPage
|
69
|
+
launch_web_driver TEST_PAGE_URL
|
70
|
+
test_page = get_page_object(driver, 'TestPage')
|
71
|
+
test_page.textarea.class.should == Selenium::WebDriver::Element
|
72
|
+
Object.instance_eval { remove_const :TestPage }
|
48
73
|
end
|
49
74
|
|
50
|
-
it "should
|
51
|
-
|
52
|
-
|
53
|
-
|
75
|
+
it "should raise an exception when the element can't be found'" do
|
76
|
+
Object.instance_eval { remove_const :TestPage } if Object.const_defined? :TestPage
|
77
|
+
launch_web_driver TEST_PAGE_URL
|
78
|
+
test_page = get_page_object(driver, 'TestPage')
|
79
|
+
TestPage.element :not_a_element, {:id => "not a element"}
|
80
|
+
expect { test_page.not_a_element }.to raise_exception RuntimeError, "Could not find element not_a_element"
|
81
|
+
Object.instance_eval { remove_const :TestPage }
|
54
82
|
end
|
83
|
+
|
55
84
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
describe SeleniumFury::SeleniumWebDriver::PageValidator do
|
3
3
|
|
4
4
|
it "should have a missing element exception" do
|
@@ -6,13 +6,13 @@ describe SeleniumFury::SeleniumWebDriver::PageValidator do
|
|
6
6
|
element :not_a_element1, {:id=>"not a element1"}
|
7
7
|
element :not_a_element2, {:id=>"not a element2"}
|
8
8
|
end
|
9
|
-
launch_web_driver
|
10
|
-
|
9
|
+
launch_web_driver TEST_PAGE_URL
|
10
|
+
expect{web_driver_validate(MissingElement)}.to raise_exception RuntimeError,"Found Missing Elements: [:not_a_element1, :not_a_element2]"
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should validate elements" do
|
14
|
-
launch_web_driver
|
15
|
-
validate
|
14
|
+
launch_web_driver TEST_PAGE_URL
|
15
|
+
validate TestPage
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|