selenium_fury 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v0.5.2 Adding the custom generator and cucumber features to the project. Tests now execute against HomeAway.
1
2
  v0.5.1 Adding ability to name attributes in order of id, name, title.
2
3
  v0.5. Adding project files and connecting to a public facing site.
3
4
  v0.2. Adding Validator Code
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # A sample Gemfile
2
+ source "http://rubygems.org"
3
+
4
+ gem "echoe"
5
+ gem "bundler"
6
+ gem "builder"
7
+ gem "rake"
8
+ gem "rspec", "1.1.12"
9
+ gem "selenium-client", "1.2.18", :require => "selenium/client"
10
+ gem "nokogiri", '1.4.3.1'
11
+ gem "cucumber","0.5.3"
12
+
data/Gemfile.lock ADDED
@@ -0,0 +1,42 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ allison (2.0.3)
5
+ builder (3.0.0)
6
+ cucumber (0.5.3)
7
+ builder (>= 2.1.2)
8
+ diff-lcs (>= 1.1.2)
9
+ json_pure (>= 1.2.0)
10
+ polyglot (>= 0.2.9)
11
+ term-ansicolor (>= 1.0.4)
12
+ treetop (>= 1.4.2)
13
+ diff-lcs (1.1.2)
14
+ echoe (4.5.6)
15
+ allison
16
+ gemcutter
17
+ rubyforge
18
+ gemcutter (0.7.0)
19
+ json_pure (1.5.1)
20
+ nokogiri (1.4.3.1)
21
+ polyglot (0.3.1)
22
+ rake (0.8.7)
23
+ rspec (1.1.12)
24
+ rubyforge (2.0.4)
25
+ json_pure (>= 1.1.7)
26
+ selenium-client (1.2.18)
27
+ term-ansicolor (1.0.5)
28
+ treetop (1.4.9)
29
+ polyglot (>= 0.3.1)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ builder
36
+ bundler
37
+ cucumber (= 0.5.3)
38
+ echoe
39
+ nokogiri (= 1.4.3.1)
40
+ rake
41
+ rspec (= 1.1.12)
42
+ selenium-client (= 1.2.18)
data/Manifest CHANGED
@@ -1,19 +1,26 @@
1
1
  CHANGELOG
2
+ Gemfile
3
+ Gemfile.lock
2
4
  LICENSE
3
5
  Manifest
4
- README
6
+ README.md
5
7
  Rakefile
6
- examples/advanced_search.rb
7
- examples/create_browser_driver.rb
8
- examples/page_generator_spec.rb
9
- examples/page_validator_spec.rb
10
- examples/spec_helper.rb
8
+ features/custom_generator.feature
9
+ features/generate_page_object.feature
10
+ features/step_definitions/custom_generator_steps.rb
11
+ features/step_definitions/generate_page_object_steps.rb
12
+ features/step_definitions/require_helper.rb
13
+ features/step_definitions/validate_page_object_steps.rb
14
+ features/support/hooks.rb
15
+ features/validate_page_object.feature
16
+ lib/create_browser_driver.rb
17
+ lib/custom_generator.rb
11
18
  lib/page_generator.rb
12
19
  lib/page_validator.rb
13
20
  lib/selenium_fury.rb
14
- selenium_fury.gemspec
15
21
  spec/advanced_search.rb
16
- spec/create_browser_driver.rb
22
+ spec/advanced_search_custom_generator_configuration.rb
23
+ spec/custom_generators_spec.rb
17
24
  spec/page_generator_spec.rb
18
25
  spec/page_validator_spec.rb
19
26
  spec/spec_helper.rb
@@ -1,6 +1,5 @@
1
-
2
-
3
- = SeleniumFury
1
+ SeleniumFury
2
+ =========
4
3
  Selenium Fury allows an automated tester to quickly build page files to use in the page object pattern. Each page file represents
5
4
  a page under test with attributes of all the locators selenium needs to run tests on the page and methods that represent
6
5
  actions that can be performed on the page.
@@ -10,24 +9,33 @@ all of the selenium locators you are using in your page file and return a list o
10
9
  If there are missing locators you can then rerun the generator to generate new selenium locators for your page.
11
10
 
12
11
 
13
- == Generate
14
- * See the examples directory for full syntax.
15
- * include PageGenerator
16
- * get_source_and_print_elements(browser)
12
+ Generate
13
+ =========
14
+ * See specs and features for full syntax
15
+ * include PageGenerator
16
+ * get_source_and_print_elements(browser)
17
17
 
18
18
 
19
- == Validate
20
- * See the examples directory for full syntax.
21
- * include PageValidator
22
- * check_page_file_class(YourPageFileClass, "/optional_relative_url_path")
19
+ Validate
20
+ =========
21
+ * See specs and features for full syntax.
22
+ * include PageValidator
23
+ * check_page_file_class(YourPageFileClass, "/optional_relative_url_path")
23
24
 
24
- == Custom Configuration
25
+ Custom Configuration
26
+ =========
25
27
 
26
- * Coming Soon
28
+ * include CustomGenerator
29
+ * create a custom configuration class
30
+ * call custom_generator
27
31
 
32
+ Core Team
33
+ =========
28
34
 
29
- == Copyright
35
+ * [Scott Sims](http://scottcsims.com/): Current maintainer.
30
36
 
31
- * Copyright (c) 2010 HomeAway, Inc.
32
- * All rights reserved. http://www.homeaway.com
37
+ Copyright
38
+ =========
39
+ * Copyright (c) 2010 HomeAway, Inc.
40
+ * All rights reserved. http://www.homeaway.com
33
41
  See LICENSE for details.
@@ -0,0 +1,20 @@
1
+ Feature: As an automated tester I want to create a page object with variable names that reflect business terms so the our test will reflect ubiquitous language.
2
+
3
+ Scenario: Use a custom generator configuration object to specify how to name our variables from another source than the id
4
+ Given I am on the advanced search page for HomeAway
5
+ When I have a custom generator configuration class
6
+ And I run the custom generator
7
+ Then I will have a ruby class produced that I can use as a page object
8
+
9
+
10
+ Scenario: I can specify a locator that I can pass to nokogiri to get a nokogiri node set that contains data that I want to use as an attribute name and locator value
11
+ Given I have a custom generator configuration class
12
+ When I specify a selector attribute
13
+ And I create a nokogiri document for the test page
14
+ Then I should get a nokogiri node set that I can iterate over to find a name and value for my page object locators
15
+ When I call the name method on the custom generator configuration class
16
+ Then I should get the raw string to name my page object attribute
17
+ When I call the value method on the custom generator configuration class
18
+ Then I should get a value that I can use as a selenium locator
19
+
20
+
@@ -0,0 +1,7 @@
1
+ Feature: As an automated tester I want to use a tool to find html elements on a web page so that I can reuse locators in in the page object pattern.
2
+
3
+
4
+ Scenario: The generator produces a ruby class on standard out that reflects the ids of page elements that can be used as a page object.
5
+ Given I am on the advanced search page for HomeAway
6
+ When I run the generator
7
+ Then I will have a ruby class produced that I can use as a page object
@@ -0,0 +1,163 @@
1
+ require File.dirname(__FILE__) + "/require_helper"
2
+ require File.dirname(__FILE__) + "/../../spec/advanced_search_custom_generator_configuration"
3
+
4
+ When /^I have a custom generator configuration class$/ do
5
+ @advanced_search_custom_generator_configuration = AdvancedSearchCustomGeneratorConfiguration.new()
6
+ @advanced_search_custom_generator_configuration.should_not be_nil
7
+ end
8
+ When /^I run the custom generator$/ do
9
+ @found_element_ids=custom_generator(:browser => browser,
10
+ :custom_configuration => @advanced_search_custom_generator_configuration)
11
+
12
+ end
13
+ When /^I specify a selector attribute$/ do
14
+ @advanced_search_custom_generator_configuration.selector.should_not be_nil
15
+
16
+ end
17
+ When /^I create a nokogiri document for the test page$/ do
18
+ @doc = Nokogiri::HTML(ADVANCED_SEARCH_HTML)
19
+ @doc.should_not be_nil
20
+ @doc.class.to_s.should == "Nokogiri::HTML::Document"
21
+ end
22
+
23
+ Then /^I should get a nokogiri node set that I can iterate over to find a name and value for my page object locators$/ do
24
+ @check_box_nokogiri_elements = @doc.css(@advanced_search_custom_generator_configuration.selector)
25
+ @check_box_nokogiri_elements.class.to_s.should == "Nokogiri::XML::NodeSet"
26
+ @check_box_nokogiri_elements.each do |nokogiri_element|
27
+ nokogiri_element.class.to_s.should == "Nokogiri::XML::Element"
28
+ end
29
+ end
30
+ When /^I call the name method on the custom generator configuration class$/ do
31
+ @advanced_search_custom_generator_configuration.nokogiri_element=@check_box_nokogiri_elements.last
32
+ @advanced_search_custom_generator_configuration.nokogiri_element=@check_box_nokogiri_elements.last
33
+ @locator_name = @advanced_search_custom_generator_configuration.name
34
+ end
35
+ Then /^I should get the raw string to name my page object attribute$/ do
36
+ @locator_name.should_not be_nil
37
+ @locator_name.should == "downtown"
38
+ end
39
+ When /^I call the value method on the custom generator configuration class$/ do
40
+ @locator_value = @advanced_search_custom_generator_configuration.value
41
+ end
42
+ Then /^I should get a value that I can use as a selenium locator$/ do
43
+ @locator_value.should_not be_nil
44
+ @locator_value.should == "location2.2"
45
+ end
46
+
47
+
48
+ ADVANCED_SEARCH_HTML=<<EOF
49
+ <form id=adv-search-form>
50
+ <div class="fieldset">
51
+ <div class="columns">
52
+ <div class="column">
53
+ <div class="cb-box">
54
+ <input class="checkbox" type="checkbox" id="suitability0.0" name="refinements" value="Suitability:children welcome">
55
+ <label for="suitability0.0">children welcome</label>
56
+ </div>
57
+ </div>
58
+ <div class="column">
59
+ <div class="cb-box">
60
+ <input class="checkbox" type="checkbox" id="suitability0.1" name="refinements" value="Suitability:wheelchair accessible">
61
+ <label for="suitability0.1">wheelchair accessible</label>
62
+ </div>
63
+ </div>
64
+ <div class="column">
65
+ <div class="cb-box">
66
+ <input class="checkbox" type="checkbox" id="suitability1.0" name="refinements" value="Suitability:suitable for elderly or infirm">
67
+ <label for="suitability1.0">suitable for elderly or infirm</label>
68
+ </div>
69
+ </div>
70
+ <div class="column">
71
+ <div class="cb-box">
72
+ <input class="checkbox" type="checkbox" id="suitability1.1" name="refinements" value="Suitability:pets considered">
73
+ <label for="suitability1.1">pet friendly</label>
74
+ </div>
75
+ </div>
76
+ <div class="column">
77
+ <div class="cb-box">
78
+ <input class="checkbox" type="checkbox" id="suitability2.0" name="refinements" value="Suitability:non smoking only">
79
+ <label for="suitability2.0">non smoking only</label>
80
+ </div>
81
+ </div>
82
+ <div class="column">
83
+ <div class="cb-box">
84
+ <input class="checkbox" type="checkbox" id="suitability2.1" name="refinements" value="Suitability:long term renters welcome">
85
+ <label for="suitability2.1">long term renters welcome</label>
86
+ </div>
87
+ </div>
88
+ <div class="clear"></div>
89
+ </div>
90
+ </div>
91
+ <div class="fieldset">
92
+ <div class="columns">
93
+ <div class="column">
94
+ <div class="cb-box">
95
+ <input class="checkbox" type="checkbox" id="location0.0" name="refinements" value="Location Type:beach">
96
+ <label for="location0.0">beach</label>
97
+ </div>
98
+ </div>
99
+ <div class="column">
100
+ <div class="cb-box">
101
+ <input class="checkbox" type="checkbox" id="location0.1" name="refinements" value="Location Type:lake">
102
+ <label for="location0.1">lake</label>
103
+ </div>
104
+ </div>
105
+ <div class="column">
106
+ <div class="cb-box">
107
+ <input class="checkbox" type="checkbox" id="location0.2" name="refinements" value="Location Type:waterfront">
108
+ <label for="location0.2">waterfront</label>
109
+ </div>
110
+ </div>
111
+ <div class="column">
112
+ <div class="cb-box">
113
+ <input class="checkbox" type="checkbox" id="location0.3" name="refinements" value="Location Type:mountain">
114
+ <label for="location0.3">mountain</label>
115
+ </div>
116
+ </div>
117
+ <div class="column">
118
+ <div class="cb-box">
119
+ <input class="checkbox" type="checkbox" id="location1.0" name="refinements" value="Location Type:near the ocean">
120
+ <label for="location1.0">near the ocean</label>
121
+ </div>
122
+ </div>
123
+ <div class="column">
124
+ <div class="cb-box">
125
+ <input class="checkbox" type="checkbox" id="location1.1" name="refinements" value="Location Type:resort">
126
+ <label for="location1.1">resort</label>
127
+ </div>
128
+ </div>
129
+ <div class="column">
130
+ <div class="cb-box">
131
+ <input class="checkbox" type="checkbox" id="location1.2" name="refinements" value="Location Type:rural">
132
+ <label for="location1.2">rural</label>
133
+ </div>
134
+ </div>
135
+ <div class="column">
136
+ <div class="cb-box">
137
+ <input class="checkbox" type="checkbox" id="location1.3" name="refinements" value="Location Type:town">
138
+ <label for="location1.3">town</label>
139
+ </div>
140
+ </div>
141
+ <div class="column">
142
+ <div class="cb-box">
143
+ <input class="checkbox" type="checkbox" id="location2.0" name="refinements" value="Location Type:village">
144
+ <label for="location2.0">village</label>
145
+ </div>
146
+ </div>
147
+ <div class="column">
148
+ <div class="cb-box">
149
+ <input class="checkbox" type="checkbox" id="location2.1" name="refinements" value="Location Type:river">
150
+ <label for="location2.1">river</label>
151
+ </div>
152
+ </div>
153
+ <div class="column">
154
+ <div class="cb-box">
155
+ <input class="checkbox" type="checkbox" id="location2.2" name="refinements" value="Location Type:downtown">
156
+ <label for="location2.2">downtown</label>
157
+ </div>
158
+ </div>
159
+ <div class="clear"></div>
160
+ </div>
161
+ </div>
162
+ <form>
163
+ EOF
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + "/require_helper"
2
+
3
+
4
+ Given /^I am on the advanced search page for HomeAway$/ do
5
+ create_selenium_driver("http://www.homeaway.com")
6
+ browser.start_new_browser_session
7
+ puts "Testing #{browser.browser_url} on #{browser.browser_string} "
8
+ browser.open "/searchForm"
9
+ end
10
+
11
+ When /^I run the generator$/ do
12
+ @found_element_ids=get_source_and_print_elements(browser)
13
+ end
14
+
15
+ Then /^I will have a ruby class produced that I can use as a page object$/ do
16
+ @found_element_ids.should_not be_nil
17
+ end
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ gem "rspec", "=1.1.12"
3
+ require "spec"
4
+ gem "selenium-client", ">=1.2.18"
5
+ require "selenium/client"
6
+ require 'nokogiri'
7
+
8
+ require File.dirname(__FILE__) + "/../../lib/custom_generator"
9
+ require File.dirname(__FILE__) + "/../../lib/page_generator"
10
+ require File.dirname(__FILE__) + "/../../lib/page_validator"
11
+ require File.dirname(__FILE__) + "/../../lib/create_browser_driver"
12
+
13
+ include CustomGenerator
14
+ include PageGenerator
15
+ include PageValidator
16
+ include CreateBrowserDriver
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + "/require_helper"
2
+ require File.dirname(__FILE__) + "/../../spec/advanced_search"
3
+
4
+ When /^I run the validator$/ do
5
+ check_page_file_class(AdvancedSearch, "/searchForm")
6
+ end
7
+ Then /^the advanced search page object locators will be checked$/ do
8
+ found_missing_locators.should have(0).elements
9
+ found_missing_locators.should_not be_nil
10
+ end
11
+ When /^I run the validator with missing locators$/ do
12
+ class AdvancedSearchBroken < AdvancedSearch
13
+ def initialize *browser
14
+ super
15
+ @missing_locator_attribute="missing_locator"
16
+ end
17
+
18
+ attr_reader :missing_locator_attribute
19
+ end
20
+ begin
21
+ check_page_file_class(AdvancedSearchBroken, "/searchForm")
22
+ rescue Exception=>e
23
+ end
24
+ end
25
+ Then /^there will be missing locators found$/ do
26
+ found_missing_locators["missing_locator_attribute"].should == "missing_locator"
27
+ end
@@ -0,0 +1,3 @@
1
+ After do
2
+ browser.close_current_browser_session if defined?(browser) && !browser.nil?
3
+ end
@@ -0,0 +1,11 @@
1
+ Feature: As an automated tester I want a tool to check if my page object locators are correct so that I can update invalid locators.
2
+
3
+ Scenario: Use reflection to open a page object and validate that the locators are valid
4
+ Given I am on the advanced search page for HomeAway
5
+ When I run the validator
6
+ Then the advanced search page object locators will be checked
7
+
8
+ Scenario: The validator will fail and return a list of missing locators
9
+ Given I am on the advanced search page for HomeAway
10
+ When I run the validator with missing locators
11
+ Then there will be missing locators found
@@ -0,0 +1,23 @@
1
+ require 'spec'
2
+ module CreateBrowserDriver
3
+
4
+ def browser
5
+ return @browser
6
+ end
7
+
8
+ Spec::Runner.configure do |config|
9
+ config.after(:each) do
10
+ browser.close_current_browser_session if defined?(browser) && !browser.nil?
11
+ end
12
+ end
13
+
14
+ def create_selenium_driver(url)
15
+
16
+ @browser = Selenium::Client::Driver.new(
17
+ :host => ENV['HOST'] || "localhost",
18
+ :port => 4444,
19
+ :browser => ENV['SELENIUM_RC_BROWSER'] || "*firefox",
20
+ :url => url,
21
+ :timeout_in_second => 60)
22
+ end
23
+ end
@@ -0,0 +1,61 @@
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
+ require File.dirname(__FILE__) + "/page_generator"
17
+ require 'nokogiri'
18
+ module CustomGenerator
19
+ include PageGenerator
20
+ #
21
+ # custom_configuration = options[:custom_configuration]
22
+ # browser = options[:browser]
23
+ # html = options[:html]
24
+ def custom_generator(options)
25
+ custom_configuration = options[:custom_configuration]
26
+ browser = options[:browser]
27
+ if !browser.nil?
28
+ html = browser.get_html_source
29
+ else
30
+ html = options[:html]
31
+ end
32
+ doc = Nokogiri::HTML(html)
33
+ html_menu_elements ={}
34
+ doc.css(custom_configuration.selector).each do |nokogiri_element|
35
+ custom_configuration.nokogiri_element = nokogiri_element
36
+ puts "Html element is #{nokogiri_element}" if $DEBUG
37
+ generated_name = clean_attribute_name(custom_configuration.name)
38
+ puts "generated name is #{generated_name}" if $DEBUG
39
+ generated_value = custom_configuration.value
40
+ puts "generated value is #{generated_value}" if $DEBUG
41
+ puts "@#{generated_name} = \"#{generated_value}\"" if $DEBUG
42
+ html_menu_elements[generated_name]= generated_value
43
+ end
44
+ merge_and_print_elements [html_menu_elements]
45
+ return html_menu_elements
46
+ end
47
+
48
+ def clean_attribute_name(attribute_name)
49
+ attribute_name.gsub!('input-', '')
50
+ attribute_name.gsub!('select-', '')
51
+ attribute_name.gsub!(/([A-Z]+)/, '_\1')
52
+ attribute_name.gsub!('\\', '')
53
+ attribute_name.gsub!(' ', '_')
54
+ attribute_name.gsub!('.', '_')
55
+ attribute_name.gsub!('-', '_')
56
+ attribute_name.gsub!('__', '_')
57
+ attribute_name.gsub!(/^_/, '')
58
+ attribute_name = attribute_name.to_s.downcase
59
+ return attribute_name
60
+ end
61
+ end
@@ -14,6 +14,7 @@
14
14
  # * limitations under the License.
15
15
  # */
16
16
  module PageGenerator
17
+
17
18
  def get_name_and_value(html_element)
18
19
  if html_element.get_attribute("id") != nil
19
20
  attribute_name = html_element.get_attribute("id")
@@ -62,43 +63,57 @@ module PageGenerator
62
63
  page_elements_types.each do |element_type|
63
64
  html_elements.merge!(element_type)
64
65
  end
65
-
66
- puts "found (#{html_elements.length} elements)"
67
- puts "class YourPageFile"
68
- puts "\tdef initialize *browser\n\t\t@browser = *browser"
66
+ $stdout.puts "found (#{html_elements.length} elements)"
67
+ $stdout.puts "class YourPageFile"
68
+ $stdout.puts "\tdef initialize *browser\n\t\t@browser = *browser"
69
69
  html_elements.keys.sort.each do |key|
70
- puts "\t\t@#{key} = \"#{html_elements[key]}\""
70
+ $stdout.puts "\t\t@#{key} = \"#{html_elements[key]}\""
71
71
  end
72
- puts "\tend"
72
+ $stdout.puts "\tend"
73
73
  count=1
74
74
  html_elements.keys.sort.each do |key|
75
75
  if count == 1
76
- print "\tattr_accessor :browser, "
76
+ $stdout.print "\tattr_accessor :browser, "
77
77
  end
78
78
  if count % 5 == 0
79
- print "\n\t"
79
+ $stdout.print "\n\t"
80
80
  end
81
81
  if count != html_elements.length
82
- print ":#{key}, "
82
+ $stdout.print ":#{key}, "
83
83
  else
84
- print ":#{key}"
84
+ $stdout.print ":#{key}"
85
85
  end
86
86
  count = count + 1
87
87
  end
88
- puts "\n\nend"
88
+ $stdout.puts "\n\nend"
89
+
89
90
  end
90
91
 
92
+
91
93
  def get_source_and_print_elements(browser)
92
94
  html =browser.get_html_source
95
+ return print_elements(html)
96
+ end
97
+
98
+ def print_elements(html)
93
99
  html_elements_select=generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "select")
94
100
  html_elements_text_area=generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "textarea")
95
101
  html_elements_form = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "form")
102
+ html_elements_buttons = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='button']")
103
+ html_elements_file = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='file']")
96
104
  html_elements_check_boxes = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='checkbox']")
97
- html_elements_image = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='image']")
105
+ html_elements_password = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='password']")
98
106
  html_elements_radio = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='radio']")
107
+ html_elements_reset = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='reset']")
108
+ html_elements_image = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='image']")
109
+ html_elements_submit = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='submit']")
99
110
  html_elements_text = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='text']")
100
- merge_and_print_elements([html_elements_check_boxes, html_elements_select, html_elements_text,
101
- html_elements_text_area, html_elements_image, html_elements_radio, html_elements_form])
111
+
112
+ elements = [html_elements_check_boxes, html_elements_select, html_elements_text, html_elements_buttons, html_elements_file,
113
+ html_elements_password, html_elements_text_area, html_elements_image, html_elements_radio, html_elements_reset,
114
+ html_elements_form, html_elements_submit]
115
+ merge_and_print_elements(elements)
116
+ return elements
102
117
  end
103
118
 
104
119
 
@@ -15,7 +15,8 @@
15
15
  # */
16
16
  require 'spec'
17
17
  module PageValidator
18
-
18
+ @found_missing_locators
19
+ attr_accessor :found_missing_locators
19
20
 
20
21
  def check_page_file_class(page_file_class, *live_url)
21
22
  missing_locators={}
@@ -34,8 +35,8 @@ module PageValidator
34
35
 
35
36
  #check for instance methods and execute.
36
37
  verify_instance_variables(test_page, missing_locators) if test_page.instance_variables.length > 0
38
+ @found_missing_locators=missing_locators
37
39
  print_missing_locators(missing_locators)
38
-
39
40
  end
40
41
 
41
42
 
data/lib/selenium_fury.rb CHANGED
@@ -15,4 +15,5 @@
15
15
  # */
16
16
  require File.dirname(__FILE__) + "/page_generator"
17
17
  require File.dirname(__FILE__) + "/page_validator"
18
+ require File.dirname(__FILE__) + "/custom_generator"
18
19
  require 'nokogiri'
@@ -2,31 +2,28 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{selenium_fury}
5
- s.version = "0.5.1"
6
-
5
+ s.version = "0.5.2"
7
6
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
7
  s.authors = ["Scott Sims"]
9
- s.date = %q{2010-11-04}
8
+ s.date = %q{2011-04-01}
10
9
  s.description = %q{Generate and validate page objects with this page object factory for Selenium.}
11
10
  s.email = %q{ssims98@gmail.com}
12
- s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/page_generator.rb", "lib/page_validator.rb", "lib/selenium_fury.rb"]
13
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "lib/page_generator.rb", "lib/page_validator.rb", "lib/selenium_fury.rb", "selenium_fury.gemspec", "spec/advanced_search.rb", "spec/create_browser_driver.rb", "spec/page_generator_spec.rb", "spec/page_validator_spec.rb", "spec/spec_helper.rb",
14
- "examples/advanced_search.rb", "examples/create_browser_driver.rb", "examples/page_generator_spec.rb", "examples/page_validator_spec.rb", "examples/spec_helper.rb"]
15
- s.homepage = %q{http://www.github.com/scottcsims/SeleniumFury}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Selenium_fury", "--main", "README"]
11
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.md", "lib/create_browser_driver.rb", "lib/custom_generator.rb", "lib/page_generator.rb", "lib/page_validator.rb", "lib/selenium_fury.rb"]
12
+ s.files = ["CHANGELOG", "Gemfile", "Gemfile.lock", "LICENSE", "Manifest", "README.md", "Rakefile", "features/custom_generator.feature", "features/generate_page_object.feature", "features/step_definitions/custom_generator_steps.rb", "features/step_definitions/generate_page_object_steps.rb", "features/step_definitions/require_helper.rb", "features/step_definitions/validate_page_object_steps.rb", "features/support/hooks.rb", "features/validate_page_object.feature", "lib/create_browser_driver.rb", "lib/custom_generator.rb", "lib/page_generator.rb", "lib/page_validator.rb", "lib/selenium_fury.rb", "spec/advanced_search.rb", "spec/advanced_search_custom_generator_configuration.rb", "spec/custom_generators_spec.rb", "spec/page_generator_spec.rb", "spec/page_validator_spec.rb", "spec/spec_helper.rb", "selenium_fury.gemspec"]
13
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Selenium_fury", "--main", "README.md"]
17
14
  s.require_paths = ["lib"]
18
15
  s.rubyforge_project = %q{selenium_fury}
19
- s.rubygems_version = %q{1.3.7}
16
+ s.rubygems_version = %q{1.4.2}
20
17
  s.summary = %q{ Selenium Fury allows an automated tester to quickly build page files to use in the page object pattern. Each page file represents
21
- a page under test with attributes of all the locators selenium needs to run tests on the page and methods that represent
22
- actions that can be performed on the page.
18
+ a page under test with attributes of all the locators selenium needs to run tests on the page and methods that represent
19
+ actions that can be performed on the page.
20
+
21
+ You use the generator to build the page files. After the page has been updated you can use the validator to go through
22
+ all of the selenium locators you are using in your page file and return a list of the locators that it could not find.
23
+ If there are missing locators you can then rerun the generator to generate new selenium locators for your page. http://www.scottcsims.com}
23
24
 
24
- You use the generator to build the page files. After the page has been updated you can use the validator to go through
25
- all of the selenium locators you are using in your page file and return a list of the locators that it could not find.
26
- If there are missing locators you can then rerun the generator to generate new selenium locators for your page. http://www.scottcsims.com}
27
25
 
28
26
  if s.respond_to? :specification_version then
29
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
30
27
  s.specification_version = 3
31
28
 
32
29
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -1,71 +1,54 @@
1
1
  class AdvancedSearch
2
- def initialize *browser
3
- @browser = *browser
4
- @_ex_kw = "_ex_kw"
5
- @_fss = "_fss"
6
- @_in_kw = "_in_kw"
7
- @_lh_avail_to_radio = "LH_AvailToRadio"
8
- @_lh_fav_sellers_id = "LH_FavSellers_id"
9
- @_lh_located_in_radio = "LH_LocatedInRadio"
10
- @_lh_pref_loc_radio = "LH_PrefLocRadio"
11
- @_lh_sale_currencydrop_down = "LH_SALE_CURRENCYDropDown"
12
- @_lh_seller_with_store_id = "LH_SellerWithStore_id"
13
- @_lh_specific_seller_id = "LH_SpecificSeller_id"
14
- @_lh_sub_location = "LH_SubLocation"
15
- @_lh_top_rated_sellers_id = "LH_TopRatedSellers_id"
16
- @_m_pr_rng_cbx = "_mPrRngCbx"
17
- @_nkw = "_nkw"
18
- @_saact_select = "_saactSelect"
19
- @_sacat = "_sacat"
20
- @_salic_select = "_salicSelect"
21
- @_sargn_select = "_sargnSelect"
22
- @_sasl = "_sasl"
23
- @_saslop = "_saslop"
24
- @_udhi = "_udhi"
25
- @_udlo = "_udlo"
26
- @adv_search_from = "adv_search_from"
27
- @header_search = "headerSearch"
28
- @html_idfor_checboxv4_17 = "htmlIDforChecboxv4-17"
29
- @html_idfor_cityv4_21 = "htmlIDforCityv4-21"
30
- @html_idfor_radiusv4_19 = "htmlIDforRadiusv4-19"
31
- @html_idfor_zip_codev4_20 = "htmlIDforZipCodev4-20"
32
- @sr_con_nkw = "sr_con__nkw"
33
- @v4_1 = "v4-1"
34
- @v4_2 = "v4-2"
35
- @v4_advsearch0_lh_auction = "v4-advsearch0_LH_Auction"
36
- @v4_advsearch0_lh_gifast = "v4-advsearch0_LH_GIFAST"
37
- @v4_advsearch0_lh_pay_pal = "v4-advsearch0_LH_PayPal"
38
- @v4_advsearch0_lh_title_desc = "v4-advsearch0_LH_TitleDesc"
39
- @v4_advsearch1__lh_time = "v4-advsearch1__LH_Time"
40
- @v4_advsearch1_ftrt = "v4-advsearch1__ftrt"
41
- @v4_advsearch1_ftrv = "v4-advsearch1__ftrv"
42
- @v4_advsearch1_lh_bin = "v4-advsearch1_LH_BIN"
43
- @v4_advsearch1_lh_complete = "v4-advsearch1_LH_Complete"
44
- @v4_advsearch1_lh_fs = "v4-advsearch1_LH_FS"
45
- @v4_advsearch2__lh_nob = "v4-advsearch2__LH_NOB"
46
- @v4_advsearch2_lh_cads = "v4-advsearch2_LH_CAds"
47
- @v4_advsearch2_lh_lpickup = "v4-advsearch2_LH_LPickup"
48
- @v4_advsearch2_sabdhi = "v4-advsearch2__sabdhi"
49
- @v4_advsearch2_sabdlo = "v4-advsearch2__sabdlo"
50
- @v4_advsearch3__lh_mil = "v4-advsearch3__LH_MIL"
51
- @v4_advsearch3_samihi = "v4-advsearch3__samihi"
52
- @v4_advsearch3_samilow = "v4-advsearch3__samilow"
53
- @v4_advsearch4_lh_lots = "v4-advsearch4_LH_Lots"
54
- @v4_advsearch5_lh_sale_items = "v4-advsearch5_LH_SaleItems"
55
- @v4_advsearch6_lh_bo = "v4-advsearch6_LH_BO"
56
- @v4_advsearch7_lh_charity = "v4-advsearch7_LH_Charity"
57
- @v4_advsearch8_lh_rebate_eligible = "v4-advsearch8_LH_RebateEligible"
58
- end
59
- attr_accessor :browser, :_ex_kw, :_fss, :_in_kw, :_lh_avail_to_radio,
60
- :_lh_fav_sellers_id, :_lh_located_in_radio, :_lh_pref_loc_radio, :_lh_sale_currencydrop_down, :_lh_seller_with_store_id,
61
- :_lh_specific_seller_id, :_lh_sub_location, :_lh_top_rated_sellers_id, :_m_pr_rng_cbx, :_nkw,
62
- :_saact_select, :_sacat, :_salic_select, :_sargn_select, :_sasl,
63
- :_saslop, :_udhi, :_udlo, :adv_search_from, :header_search,
64
- :html_idfor_checboxv4_17, :html_idfor_cityv4_21, :html_idfor_radiusv4_19, :html_idfor_zip_codev4_20, :sr_con_nkw,
65
- :v4_1, :v4_2, :v4_advsearch0_lh_auction, :v4_advsearch0_lh_gifast, :v4_advsearch0_lh_pay_pal,
66
- :v4_advsearch0_lh_title_desc, :v4_advsearch1__lh_time, :v4_advsearch1_ftrt, :v4_advsearch1_ftrv, :v4_advsearch1_lh_bin,
67
- :v4_advsearch1_lh_complete, :v4_advsearch1_lh_fs, :v4_advsearch2__lh_nob, :v4_advsearch2_lh_cads, :v4_advsearch2_lh_lpickup,
68
- :v4_advsearch2_sabdhi, :v4_advsearch2_sabdlo, :v4_advsearch3__lh_mil, :v4_advsearch3_samihi, :v4_advsearch3_samilow,
69
- :v4_advsearch4_lh_lots, :v4_advsearch5_lh_sale_items, :v4_advsearch6_lh_bo, :v4_advsearch7_lh_charity, :v4_advsearch8_lh_rebate_eligible
2
+ def initialize *browser
3
+ @browser = *browser
4
+ @adv_search_form = "adv-search-form"
5
+ @bathrooms = "bathrooms"
6
+ @bedrooms = "bedrooms"
7
+ @end_date_input = "endDateInput"
8
+ @price_from = "priceFrom"
9
+ @price_to = "priceTo"
10
+ @property_type = "propertyType"
11
+ @sleeps = "sleeps"
12
+ @special_offers = "specialOffers"
13
+ @start_date_input = "startDateInput"
14
+ @themes = "themes"
15
+
16
+ @air_conditioning = "amenity0.0"
17
+ @beach = "location0.0"
18
+ @children_welcome = "suitability0.0"
19
+ @dishwasher = "amenity2.0"
20
+ @downtown = "location2.2"
21
+ @fishing = "leisure2.0"
22
+ @golf = "leisure0.0"
23
+ @internet_access = "amenity1.1"
24
+ @lake = "location0.1"
25
+ @long_term_renters_welcome = "suitability2.1"
26
+ @mountain = "location0.3"
27
+ @near_the_ocean = "location1.0"
28
+ @non_smoking_only = "suitability2.0"
29
+ @pet_friendly = "suitability1.1"
30
+ @pool = "amenity1.0"
31
+ @resort = "location1.1"
32
+ @river = "location2.1"
33
+ @rural = "location1.2"
34
+ @satellite_or_cable_tv = "amenity0.1"
35
+ @skiing = "leisure1.0"
36
+ @suitable_for_elderly_or_infirm = "suitability1.0"
37
+ @town = "location1.3"
38
+ @village = "location2.0"
39
+ @washing_machine = "amenity2.1"
40
+ @waterfront = "location0.2"
41
+ @wheelchair_accessible = "suitability0.1"
42
+
43
+ end
44
+
45
+ attr_accessor :browser, :adv_search_form, :bathrooms, :bedrooms, :end_date_input, :start_date_input, :price_from, :price_to,
46
+ :property_type, :sleeps, :special_offers, :start_date_input, :themes,
47
+ :air_conditioning, :beach, :children_welcome, :dishwasher,
48
+ :downtown, :fishing, :golf, :internet_access, :lake,
49
+ :long_term_renters_welcome, :mountain, :near_the_ocean, :non_smoking_only, :pet_friendly,
50
+ :pool, :resort, :river, :rural, :satellite_or_cable_tv,
51
+ :skiing, :suitable_for_elderly_or_infirm, :town, :village, :washing_machine,
52
+ :waterfront, :wheelchair_accessible
70
53
 
71
54
  end
@@ -0,0 +1,16 @@
1
+ class AdvancedSearchCustomGeneratorConfiguration
2
+ def initialize(options={})
3
+ @selector ="form#adv-search-form div.cb-box"
4
+ @nokogiri_element=options[:nokogiri_element]
5
+ end
6
+
7
+ attr_accessor :selector, :nokogiri_element
8
+
9
+ def name
10
+ return nokogiri_element.at_css("input[name=refinements]+label").text
11
+ end
12
+
13
+ def value
14
+ return nokogiri_element.at_css("input").get_attribute("id")
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+ describe AdvancedSearchCustomGeneratorConfiguration do
3
+ it "should generate the advanced search locators" 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
+ browser.open "/searchForm"
8
+ advanced_search_custom_generator_configuration = AdvancedSearchCustomGeneratorConfiguration.new
9
+ custom_generator(:browser => browser,
10
+ :custom_configuration => advanced_search_custom_generator_configuration)
11
+ end
12
+ end
@@ -1,29 +1,10 @@
1
1
  require File.dirname(__FILE__) + "/spec_helper"
2
- require File.dirname(__FILE__) + "/../lib/page_generator"
3
2
  describe PageGenerator do
4
- include CreateBrowserDriver
5
- include PageGenerator
6
- append_after(:each) do
7
- if @browser
8
- browser.close_current_browser_session
9
- end
10
- end
11
-
12
- it "should find elements on ebay advanced search" do
13
- create_selenium_driver("http://computers.shop.ebay.com")
3
+ it "should find elements on the HomeAway advanced search page" do
4
+ create_selenium_driver("http://www.homeaway.com")
14
5
  browser.start_new_browser_session
15
6
  puts "Testing #{browser.browser_url} on #{browser.browser_string} "
16
- browser.open "/ebayadvsearch"
7
+ browser.open "/searchForm"
17
8
  get_source_and_print_elements(browser)
18
9
  end
19
-
20
- it "should create a nokogiri doc" do
21
- doc = <<EOF
22
- <a href="/index/1">First</a>
23
- EOF
24
- @parser = Nokogiri.HTML doc
25
- @parser.css("a").each do |html_element|
26
- puts html_element
27
- end
28
- end
29
10
  end
@@ -1,16 +1,9 @@
1
1
  require File.dirname(__FILE__) + "/spec_helper"
2
- require File.dirname(__FILE__) + "/../lib/page_validator"
3
- require File.dirname(__FILE__) + "/advanced_search"
4
2
  describe PageValidator do
5
- include CreateBrowserDriver
6
- include PageValidator
7
- append_after(:each) do
8
- browser.close_current_browser_session
9
- end
10
- it "should validate the elements contained on the page file" do
11
- create_selenium_driver("http://computers.shop.ebay.com")
3
+ it "should validate the elements contained on the AdvancedSearch page object" do
4
+ create_selenium_driver("http://www.homeaway.com")
12
5
  browser.start_new_browser_session
13
6
  puts "Testing #{browser.browser_url} on #{browser.browser_string} "
14
- check_page_file_class(AdvancedSearch, "/ebayadvsearch")
7
+ check_page_file_class(AdvancedSearch, "/searchForm")
15
8
  end
16
9
  end
data/spec/spec_helper.rb CHANGED
@@ -3,5 +3,17 @@ gem "rspec", "=1.1.12"
3
3
  require "spec"
4
4
  gem "selenium-client", ">=1.2.18"
5
5
  require "selenium/client"
6
- require File.dirname(__FILE__) + "/create_browser_driver"
7
- require 'nokogiri'
6
+ require 'nokogiri'
7
+
8
+ require File.dirname(__FILE__) + "/../lib/custom_generator"
9
+ require File.dirname(__FILE__) + "/../lib/page_generator"
10
+ require File.dirname(__FILE__) + "/../lib/page_validator"
11
+ require File.dirname(__FILE__) + "/../lib/create_browser_driver"
12
+ require File.dirname(__FILE__) + "/advanced_search_custom_generator_configuration"
13
+ require File.dirname(__FILE__) + "/advanced_search"
14
+
15
+ include CustomGenerator
16
+ include PageGenerator
17
+ include PageValidator
18
+ include CreateBrowserDriver
19
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium_fury
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
4
+ hash: 15
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 1
10
- version: 0.5.1
9
+ - 2
10
+ version: 0.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Scott Sims
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-04 00:00:00 -05:00
18
+ date: 2011-04-01 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -28,32 +28,42 @@ extensions: []
28
28
  extra_rdoc_files:
29
29
  - CHANGELOG
30
30
  - LICENSE
31
- - README
31
+ - README.md
32
+ - lib/create_browser_driver.rb
33
+ - lib/custom_generator.rb
32
34
  - lib/page_generator.rb
33
35
  - lib/page_validator.rb
34
36
  - lib/selenium_fury.rb
35
37
  files:
36
38
  - CHANGELOG
39
+ - Gemfile
40
+ - Gemfile.lock
37
41
  - LICENSE
38
42
  - Manifest
39
- - README
43
+ - README.md
40
44
  - Rakefile
45
+ - features/custom_generator.feature
46
+ - features/generate_page_object.feature
47
+ - features/step_definitions/custom_generator_steps.rb
48
+ - features/step_definitions/generate_page_object_steps.rb
49
+ - features/step_definitions/require_helper.rb
50
+ - features/step_definitions/validate_page_object_steps.rb
51
+ - features/support/hooks.rb
52
+ - features/validate_page_object.feature
53
+ - lib/create_browser_driver.rb
54
+ - lib/custom_generator.rb
41
55
  - lib/page_generator.rb
42
56
  - lib/page_validator.rb
43
57
  - lib/selenium_fury.rb
44
- - selenium_fury.gemspec
45
58
  - spec/advanced_search.rb
46
- - spec/create_browser_driver.rb
59
+ - spec/advanced_search_custom_generator_configuration.rb
60
+ - spec/custom_generators_spec.rb
47
61
  - spec/page_generator_spec.rb
48
62
  - spec/page_validator_spec.rb
49
63
  - spec/spec_helper.rb
50
- - examples/advanced_search.rb
51
- - examples/create_browser_driver.rb
52
- - examples/page_generator_spec.rb
53
- - examples/page_validator_spec.rb
54
- - examples/spec_helper.rb
64
+ - selenium_fury.gemspec
55
65
  has_rdoc: true
56
- homepage: http://www.github.com/scottcsims/SeleniumFury
66
+ homepage:
57
67
  licenses: []
58
68
 
59
69
  post_install_message:
@@ -63,7 +73,7 @@ rdoc_options:
63
73
  - --title
64
74
  - Selenium_fury
65
75
  - --main
66
- - README
76
+ - README.md
67
77
  require_paths:
68
78
  - lib
69
79
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -88,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
98
  requirements: []
89
99
 
90
100
  rubyforge_project: selenium_fury
91
- rubygems_version: 1.3.7
101
+ rubygems_version: 1.4.2
92
102
  signing_key:
93
103
  specification_version: 3
94
104
  summary: Selenium Fury allows an automated tester to quickly build page files to use in the page object pattern. Each page file represents a page under test with attributes of all the locators selenium needs to run tests on the page and methods that represent actions that can be performed on the page. You use the generator to build the page files. After the page has been updated you can use the validator to go through all of the selenium locators you are using in your page file and return a list of the locators that it could not find. If there are missing locators you can then rerun the generator to generate new selenium locators for your page. http://www.scottcsims.com
@@ -1,71 +0,0 @@
1
- class AdvancedSearch
2
- def initialize *browser
3
- @browser = *browser
4
- @_ex_kw = "_ex_kw"
5
- @_fss = "_fss"
6
- @_in_kw = "_in_kw"
7
- @_lh_avail_to_radio = "LH_AvailToRadio"
8
- @_lh_fav_sellers_id = "LH_FavSellers_id"
9
- @_lh_located_in_radio = "LH_LocatedInRadio"
10
- @_lh_pref_loc_radio = "LH_PrefLocRadio"
11
- @_lh_sale_currencydrop_down = "LH_SALE_CURRENCYDropDown"
12
- @_lh_seller_with_store_id = "LH_SellerWithStore_id"
13
- @_lh_specific_seller_id = "LH_SpecificSeller_id"
14
- @_lh_sub_location = "LH_SubLocation"
15
- @_lh_top_rated_sellers_id = "LH_TopRatedSellers_id"
16
- @_m_pr_rng_cbx = "_mPrRngCbx"
17
- @_nkw = "_nkw"
18
- @_saact_select = "_saactSelect"
19
- @_sacat = "_sacat"
20
- @_salic_select = "_salicSelect"
21
- @_sargn_select = "_sargnSelect"
22
- @_sasl = "_sasl"
23
- @_saslop = "_saslop"
24
- @_udhi = "_udhi"
25
- @_udlo = "_udlo"
26
- @adv_search_from = "adv_search_from"
27
- @header_search = "headerSearch"
28
- @html_idfor_checboxv4_17 = "htmlIDforChecboxv4-17"
29
- @html_idfor_cityv4_21 = "htmlIDforCityv4-21"
30
- @html_idfor_radiusv4_19 = "htmlIDforRadiusv4-19"
31
- @html_idfor_zip_codev4_20 = "htmlIDforZipCodev4-20"
32
- @sr_con_nkw = "sr_con__nkw"
33
- @v4_1 = "v4-1"
34
- @v4_2 = "v4-2"
35
- @v4_advsearch0_lh_auction = "v4-advsearch0_LH_Auction"
36
- @v4_advsearch0_lh_gifast = "v4-advsearch0_LH_GIFAST"
37
- @v4_advsearch0_lh_pay_pal = "v4-advsearch0_LH_PayPal"
38
- @v4_advsearch0_lh_title_desc = "v4-advsearch0_LH_TitleDesc"
39
- @v4_advsearch1__lh_time = "v4-advsearch1__LH_Time"
40
- @v4_advsearch1_ftrt = "v4-advsearch1__ftrt"
41
- @v4_advsearch1_ftrv = "v4-advsearch1__ftrv"
42
- @v4_advsearch1_lh_bin = "v4-advsearch1_LH_BIN"
43
- @v4_advsearch1_lh_complete = "v4-advsearch1_LH_Complete"
44
- @v4_advsearch1_lh_fs = "v4-advsearch1_LH_FS"
45
- @v4_advsearch2__lh_nob = "v4-advsearch2__LH_NOB"
46
- @v4_advsearch2_lh_cads = "v4-advsearch2_LH_CAds"
47
- @v4_advsearch2_lh_lpickup = "v4-advsearch2_LH_LPickup"
48
- @v4_advsearch2_sabdhi = "v4-advsearch2__sabdhi"
49
- @v4_advsearch2_sabdlo = "v4-advsearch2__sabdlo"
50
- @v4_advsearch3__lh_mil = "v4-advsearch3__LH_MIL"
51
- @v4_advsearch3_samihi = "v4-advsearch3__samihi"
52
- @v4_advsearch3_samilow = "v4-advsearch3__samilow"
53
- @v4_advsearch4_lh_lots = "v4-advsearch4_LH_Lots"
54
- @v4_advsearch5_lh_sale_items = "v4-advsearch5_LH_SaleItems"
55
- @v4_advsearch6_lh_bo = "v4-advsearch6_LH_BO"
56
- @v4_advsearch7_lh_charity = "v4-advsearch7_LH_Charity"
57
- @v4_advsearch8_lh_rebate_eligible = "v4-advsearch8_LH_RebateEligible"
58
- end
59
- attr_accessor :browser, :_ex_kw, :_fss, :_in_kw, :_lh_avail_to_radio,
60
- :_lh_fav_sellers_id, :_lh_located_in_radio, :_lh_pref_loc_radio, :_lh_sale_currencydrop_down, :_lh_seller_with_store_id,
61
- :_lh_specific_seller_id, :_lh_sub_location, :_lh_top_rated_sellers_id, :_m_pr_rng_cbx, :_nkw,
62
- :_saact_select, :_sacat, :_salic_select, :_sargn_select, :_sasl,
63
- :_saslop, :_udhi, :_udlo, :adv_search_from, :header_search,
64
- :html_idfor_checboxv4_17, :html_idfor_cityv4_21, :html_idfor_radiusv4_19, :html_idfor_zip_codev4_20, :sr_con_nkw,
65
- :v4_1, :v4_2, :v4_advsearch0_lh_auction, :v4_advsearch0_lh_gifast, :v4_advsearch0_lh_pay_pal,
66
- :v4_advsearch0_lh_title_desc, :v4_advsearch1__lh_time, :v4_advsearch1_ftrt, :v4_advsearch1_ftrv, :v4_advsearch1_lh_bin,
67
- :v4_advsearch1_lh_complete, :v4_advsearch1_lh_fs, :v4_advsearch2__lh_nob, :v4_advsearch2_lh_cads, :v4_advsearch2_lh_lpickup,
68
- :v4_advsearch2_sabdhi, :v4_advsearch2_sabdlo, :v4_advsearch3__lh_mil, :v4_advsearch3_samihi, :v4_advsearch3_samilow,
69
- :v4_advsearch4_lh_lots, :v4_advsearch5_lh_sale_items, :v4_advsearch6_lh_bo, :v4_advsearch7_lh_charity, :v4_advsearch8_lh_rebate_eligible
70
-
71
- end
@@ -1,18 +0,0 @@
1
- gem "selenium-client", ">=1.2.18"
2
- require "selenium/client"
3
- module CreateBrowserDriver
4
-
5
- def browser
6
- return @browser
7
- end
8
-
9
- def create_selenium_driver(url)
10
-
11
- @browser = Selenium::Client::Driver.new(
12
- :host => ENV['HOST'] || "localhost",
13
- :port => 4444,
14
- :browser => ENV['SELENIUM_RC_BROWSER'] || "*firefox",
15
- :url => url,
16
- :timeout_in_second => 60)
17
- end
18
- end
@@ -1,19 +0,0 @@
1
- require File.dirname(__FILE__) + "/spec_helper"
2
- require File.dirname(__FILE__) + "/../lib/page_generator"
3
- describe PageGenerator do
4
- include CreateBrowserDriver
5
- include PageGenerator
6
- append_after(:each) do
7
- if @browser
8
- browser.close_current_browser_session
9
- end
10
- end
11
-
12
- it "should find elements on ebay advanced search" do
13
- create_selenium_driver("http://computers.shop.ebay.com")
14
- browser.start_new_browser_session
15
- puts "Testing #{browser.browser_url} on #{browser.browser_string} "
16
- browser.open "/ebayadvsearch"
17
- get_source_and_print_elements(browser)
18
- end
19
- end
@@ -1,16 +0,0 @@
1
- require File.dirname(__FILE__) + "/spec_helper"
2
- require File.dirname(__FILE__) + "/../lib/page_validator"
3
- require File.dirname(__FILE__) + "/advanced_search"
4
- describe PageValidator do
5
- include CreateBrowserDriver
6
- include PageValidator
7
- append_after(:each) do
8
- browser.close_current_browser_session
9
- end
10
- it "should validate the elements contained on the page file" do
11
- create_selenium_driver("http://computers.shop.ebay.com")
12
- browser.start_new_browser_session
13
- puts "Testing #{browser.browser_url} on #{browser.browser_string} "
14
- check_page_file_class(AdvancedSearch, "/ebayadvsearch")
15
- end
16
- end
@@ -1,7 +0,0 @@
1
- require 'rubygems'
2
- gem "rspec", "=1.1.12"
3
- require "spec"
4
- gem "selenium-client", ">=1.2.18"
5
- require "selenium/client"
6
- require File.dirname(__FILE__) + "/create_browser_driver"
7
- require 'nokogiri'
@@ -1,18 +0,0 @@
1
- gem "selenium-client", ">=1.2.18"
2
- require "selenium/client"
3
- module CreateBrowserDriver
4
-
5
- def browser
6
- return @browser
7
- end
8
-
9
- def create_selenium_driver(url)
10
-
11
- @browser = Selenium::Client::Driver.new(
12
- :host => ENV['HOST'] || "localhost",
13
- :port => 4444,
14
- :browser => ENV['SELENIUM_RC_BROWSER'] || "*firefox",
15
- :url => url,
16
- :timeout_in_second => 60)
17
- end
18
- end