selenium_fury 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.md +29 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +31 -18
- data/Rakefile +2 -2
- data/features/custom_generator.feature +2 -1
- data/features/generate_page_object.feature +2 -1
- data/features/step_definitions/validate_page_object_steps.rb +4 -4
- data/features/validate_page_object.feature +2 -1
- data/lib/selenium_fury/common/page_parser.rb +49 -0
- data/lib/selenium_fury/common/selenium_api_chooser.rb +22 -0
- data/lib/selenium_fury/selenium_client/create_selenium_client_driver.rb +38 -0
- data/lib/selenium_fury/selenium_client/custom_generator.rb +65 -0
- data/lib/selenium_fury/selenium_client/locator_finder.rb +54 -0
- data/lib/selenium_fury/selenium_client/page_generator.rb +63 -0
- data/lib/selenium_fury/selenium_client/page_validator.rb +117 -0
- data/lib/selenium_fury/selenium_web_driver/create_selenium_web_driver.rb +35 -0
- data/lib/selenium_fury/selenium_web_driver/element_finder.rb +54 -0
- data/lib/selenium_fury/selenium_web_driver/page_generator.rb +47 -0
- data/lib/selenium_fury/selenium_web_driver/page_object.rb +26 -0
- data/lib/selenium_fury/selenium_web_driver/page_object_components.rb +67 -0
- data/lib/selenium_fury/selenium_web_driver/page_validator.rb +44 -0
- data/lib/selenium_fury.rb +24 -8
- data/selenium_fury.gemspec +46 -24
- data/spec/common/page_parser_spec.rb +9 -0
- data/spec/common/selenium_api_chooser_spec.rb +44 -0
- data/spec/{advanced_search.rb → selenium_client/advanced_search.rb} +1 -1
- data/spec/{advanced_search_custom_generator_configuration.rb → selenium_client/advanced_search_custom_generator_configuration.rb} +0 -0
- data/spec/{advanced_search_spec.rb → selenium_client/advanced_search_spec.rb} +0 -0
- data/spec/{custom_generators_spec.rb → selenium_client/custom_generators_spec.rb} +2 -1
- data/spec/selenium_client/locator_finder_spec.rb +20 -0
- data/spec/{page_generator_spec.rb → selenium_client/page_generator_spec.rb} +3 -2
- data/spec/selenium_client/page_validator_spec.rb +31 -0
- data/spec/selenium_web_driver/advanced_search.rb +47 -0
- data/spec/selenium_web_driver/element_finder_spec.rb +23 -0
- data/spec/selenium_web_driver/inquiry_side_bar.rb +7 -0
- data/spec/selenium_web_driver/page_generator_spec.rb +9 -0
- data/spec/selenium_web_driver/page_object_spec.rb +60 -0
- data/spec/selenium_web_driver/page_validator_spec.rb +21 -0
- data/spec/selenium_web_driver/property_page.rb +3 -0
- data/spec/spec_helper.rb +8 -4
- metadata +93 -59
- data/CHANGELOG +0 -5
- data/lib/selenium_fury/create_browser_driver.rb +0 -19
- data/lib/selenium_fury/custom_generator.rb +0 -62
- data/lib/selenium_fury/page_generator.rb +0 -130
- data/lib/selenium_fury/page_validator.rb +0 -113
- data/spec/page_validator_spec.rb +0 -9
@@ -1,113 +0,0 @@
|
|
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
|
-
# */
|
16
|
-
module PageValidator
|
17
|
-
@found_missing_locators
|
18
|
-
attr_accessor :found_missing_locators
|
19
|
-
# @param page_file_class [Class] The page object class you want to test
|
20
|
-
# @param live_url [String] the url of the page your testing
|
21
|
-
def check_page_file_class(page_file_class, *live_url)
|
22
|
-
missing_locators={}
|
23
|
-
puts "Validating the #{page_file_class} class"
|
24
|
-
#all initialize methods of page files should have *browser specified as the argument. This is an optional argument
|
25
|
-
test_page = page_file_class.new(@browser)
|
26
|
-
test_page.should_not be_nil
|
27
|
-
#skip the open if we don't need to open the url agian
|
28
|
-
if !live_url.empty?
|
29
|
-
$stderr.puts "Opening #{@browser.browser_url}/#{live_url}" if $DEBUG
|
30
|
-
browser.open live_url
|
31
|
-
end
|
32
|
-
|
33
|
-
#check for class methods and execute.
|
34
|
-
verify_class_variables(test_page, missing_locators) if test_page.public_methods(all=false).length > 0
|
35
|
-
|
36
|
-
#check for instance methods and execute.
|
37
|
-
verify_instance_variables(test_page, missing_locators) if test_page.instance_variables.length > 0
|
38
|
-
@found_missing_locators=missing_locators
|
39
|
-
print_missing_locators(missing_locators)
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
# @param missing_locators [Hash] locator name and values
|
44
|
-
def print_missing_locators missing_locators
|
45
|
-
puts "Missing locators are " if missing_locators != {}
|
46
|
-
missing_locators.each_pair do |locator_name, locator_value|
|
47
|
-
puts " #{locator_name} => #{locator_value}"
|
48
|
-
end
|
49
|
-
missing_locators.should have(0).missing_locators
|
50
|
-
end
|
51
|
-
|
52
|
-
def attribute_name_filter locator_name
|
53
|
-
#Add names of attributes to filter
|
54
|
-
skip_words=["browser"]
|
55
|
-
|
56
|
-
skip_words=skip_words+@known_missing_locators if !@known_missing_locators.nil?
|
57
|
-
|
58
|
-
return skip_words.include?(locator_name)
|
59
|
-
end
|
60
|
-
|
61
|
-
# @param test_page [Object] an instantiated page object
|
62
|
-
# @param missing_locators [Hash]
|
63
|
-
def verify_instance_variables(test_page, missing_locators)
|
64
|
-
#test_page.print_properties browser
|
65
|
-
test_page.instance_variables.each do |locator_name|
|
66
|
-
#prepare the locator values
|
67
|
-
locator_name.slice!(0)
|
68
|
-
if attribute_name_filter(locator_name)
|
69
|
-
puts "Skipping validation for #{locator_name}"
|
70
|
-
next
|
71
|
-
end
|
72
|
-
next if (test_page.method(locator_name).call.class.to_s != "String")
|
73
|
-
puts " Validating the #{locator_name} page element locator" #chomp the @ sign off of the method name.
|
74
|
-
locator_value = test_page.method(locator_name) # Create the reference to the get method of the instance variable
|
75
|
-
begin
|
76
|
-
browser.wait_for_element(locator_value.call, {:timeout_in_seconds => "5"})
|
77
|
-
rescue
|
78
|
-
puts " ----------------------------------- Could not find #{locator_name}"
|
79
|
-
end
|
80
|
-
missing_locators[locator_name]= locator_value.call if !browser.element?(locator_value.call) # Use the value of the instance variable
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# @param test_page [Object] an instantiated page object
|
85
|
-
# @param missing_locators [Hash]
|
86
|
-
def verify_class_variables(test_page, missing_locators)
|
87
|
-
test_page.public_methods(all=false).each do |locator_name|
|
88
|
-
#Only operate with the set methods not the get methods
|
89
|
-
next if (!locator_name.include?("="))
|
90
|
-
|
91
|
-
locator_name.slice!(locator_name.length-1)
|
92
|
-
|
93
|
-
if attribute_name_filter(locator_name)
|
94
|
-
puts "Skipping validation for #{locator_name}"
|
95
|
-
next
|
96
|
-
end
|
97
|
-
next if (test_page.method(locator_name).call.class.to_s != "String")
|
98
|
-
puts " Validating the #{locator_name} page element locator" #chomp the @ sign off of the method name.
|
99
|
-
locator_value = test_page.method(locator_name) # Create the reference to the get method of the instance variable
|
100
|
-
|
101
|
-
#Now validate the page
|
102
|
-
begin
|
103
|
-
browser.wait_for_element(locator_value.call, {:timeout_in_seconds => "5"})
|
104
|
-
rescue
|
105
|
-
puts " ----------------------------------- Could not find #{locator_name}"
|
106
|
-
end
|
107
|
-
missing_locators[locator_name]= locator_value.call if !browser.element?(locator_value.call) # Use the value of the instance variable
|
108
|
-
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
end
|
data/spec/page_validator_spec.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
describe PageValidator do
|
3
|
-
it "should validate the elements contained on the AdvancedSearch page object" do
|
4
|
-
create_selenium_driver("http://www.homeaway.com")
|
5
|
-
browser.start_new_browser_session
|
6
|
-
puts "Testing #{browser.browser_url} on #{browser.browser_string} "
|
7
|
-
check_page_file_class(AdvancedSearch, "/searchForm")
|
8
|
-
end
|
9
|
-
end
|