selenium_fury 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/LICENSE +210 -0
- data/Manifest +19 -0
- data/README +33 -0
- data/Rakefile +2 -0
- data/examples/advanced_search.rb +71 -0
- data/examples/create_browser_driver.rb +18 -0
- data/examples/page_generator_spec.rb +19 -0
- data/examples/page_validator_spec.rb +16 -0
- data/examples/spec_helper.rb +7 -0
- data/lib/page_generator.rb +93 -0
- data/lib/page_validator.rb +106 -0
- data/lib/selenium_fury.rb +18 -0
- data/selenium_fury.gemspec +37 -0
- data/spec/advanced_search.rb +71 -0
- data/spec/create_browser_driver.rb +18 -0
- data/spec/page_generator_spec.rb +29 -0
- data/spec/page_validator_spec.rb +16 -0
- data/spec/spec_helper.rb +7 -0
- metadata +95 -0
data/CHANGELOG
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
Certain components of this software are provided or made available only
|
2
|
+
subject to the licenses under which such components were licensed to
|
3
|
+
HomeAway. The relevant components and corresponding licenses are listed
|
4
|
+
[in the folder in the distribution titled 'licenses']. In any event, the
|
5
|
+
disclaimer of warranty and limitation of liability provision in this
|
6
|
+
Agreement will apply to all Software in this distribution.
|
7
|
+
|
8
|
+
|
9
|
+
Apache License
|
10
|
+
Version 2.0, January 2004
|
11
|
+
http://www.apache.org/licenses/
|
12
|
+
|
13
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
14
|
+
|
15
|
+
1. Definitions.
|
16
|
+
|
17
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
18
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
19
|
+
|
20
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
21
|
+
the copyright owner that is granting the License.
|
22
|
+
|
23
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
24
|
+
other entities that control, are controlled by, or are under common
|
25
|
+
control with that entity. For the purposes of this definition,
|
26
|
+
"control" means (i) the power, direct or indirect, to cause the
|
27
|
+
direction or management of such entity, whether by contract or
|
28
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
29
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
30
|
+
|
31
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
32
|
+
exercising permissions granted by this License.
|
33
|
+
|
34
|
+
"Source" form shall mean the preferred form for making modifications,
|
35
|
+
including but not limited to software source code, documentation
|
36
|
+
source, and configuration files.
|
37
|
+
|
38
|
+
"Object" form shall mean any form resulting from mechanical
|
39
|
+
transformation or translation of a Source form, including but
|
40
|
+
not limited to compiled object code, generated documentation,
|
41
|
+
and conversions to other media types.
|
42
|
+
|
43
|
+
"Work" shall mean the work of authorship, whether in Source or
|
44
|
+
Object form, made available under the License, as indicated by a
|
45
|
+
copyright notice that is included in or attached to the work
|
46
|
+
(an example is provided in the Appendix below).
|
47
|
+
|
48
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
49
|
+
form, that is based on (or derived from) the Work and for which the
|
50
|
+
editorial revisions, annotations, elaborations, or other modifications
|
51
|
+
represent, as a whole, an original work of authorship. For the purposes
|
52
|
+
of this License, Derivative Works shall not include works that remain
|
53
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
54
|
+
the Work and Derivative Works thereof.
|
55
|
+
|
56
|
+
"Contribution" shall mean any work of authorship, including
|
57
|
+
the original version of the Work and any modifications or additions
|
58
|
+
to that Work or Derivative Works thereof, that is intentionally
|
59
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
60
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
61
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
62
|
+
means any form of electronic, verbal, or written communication sent
|
63
|
+
to the Licensor or its representatives, including but not limited to
|
64
|
+
communication on electronic mailing lists, source code control systems,
|
65
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
66
|
+
Licensor for the purpose of discussing and improving the Work, but
|
67
|
+
excluding communication that is conspicuously marked or otherwise
|
68
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
69
|
+
|
70
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
71
|
+
on behalf of whom a Contribution has been received by Licensor and
|
72
|
+
subsequently incorporated within the Work.
|
73
|
+
|
74
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
copyright license to reproduce, prepare Derivative Works of,
|
78
|
+
publicly display, publicly perform, sublicense, and distribute the
|
79
|
+
Work and such Derivative Works in Source or Object form.
|
80
|
+
|
81
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
82
|
+
this License, each Contributor hereby grants to You a perpetual,
|
83
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
84
|
+
(except as stated in this section) patent license to make, have made,
|
85
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
86
|
+
where such license applies only to those patent claims licensable
|
87
|
+
by such Contributor that are necessarily infringed by their
|
88
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
89
|
+
with the Work to which such Contribution(s) was submitted. If You
|
90
|
+
institute patent litigation against any entity (including a
|
91
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
92
|
+
or a Contribution incorporated within the Work constitutes direct
|
93
|
+
or contributory patent infringement, then any patent licenses
|
94
|
+
granted to You under this License for that Work shall terminate
|
95
|
+
as of the date such litigation is filed.
|
96
|
+
|
97
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
98
|
+
Work or Derivative Works thereof in any medium, with or without
|
99
|
+
modifications, and in Source or Object form, provided that You
|
100
|
+
meet the following conditions:
|
101
|
+
|
102
|
+
(a) You must give any other recipients of the Work or
|
103
|
+
Derivative Works a copy of this License; and
|
104
|
+
|
105
|
+
(b) You must cause any modified files to carry prominent notices
|
106
|
+
stating that You changed the files; and
|
107
|
+
|
108
|
+
(c) You must retain, in the Source form of any Derivative Works
|
109
|
+
that You distribute, all copyright, patent, trademark, and
|
110
|
+
attribution notices from the Source form of the Work,
|
111
|
+
excluding those notices that do not pertain to any part of
|
112
|
+
the Derivative Works; and
|
113
|
+
|
114
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
115
|
+
distribution, then any Derivative Works that You distribute must
|
116
|
+
include a readable copy of the attribution notices contained
|
117
|
+
within such NOTICE file, excluding those notices that do not
|
118
|
+
pertain to any part of the Derivative Works, in at least one
|
119
|
+
of the following places: within a NOTICE text file distributed
|
120
|
+
as part of the Derivative Works; within the Source form or
|
121
|
+
documentation, if provided along with the Derivative Works; or,
|
122
|
+
within a display generated by the Derivative Works, if and
|
123
|
+
wherever such third-party notices normally appear. The contents
|
124
|
+
of the NOTICE file are for informational purposes only and
|
125
|
+
do not modify the License. You may add Your own attribution
|
126
|
+
notices within Derivative Works that You distribute, alongside
|
127
|
+
or as an addendum to the NOTICE text from the Work, provided
|
128
|
+
that such additional attribution notices cannot be construed
|
129
|
+
as modifying the License.
|
130
|
+
|
131
|
+
You may add Your own copyright statement to Your modifications and
|
132
|
+
may provide additional or different license terms and conditions
|
133
|
+
for use, reproduction, or distribution of Your modifications, or
|
134
|
+
for any such Derivative Works as a whole, provided Your use,
|
135
|
+
reproduction, and distribution of the Work otherwise complies with
|
136
|
+
the conditions stated in this License.
|
137
|
+
|
138
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
139
|
+
any Contribution intentionally submitted for inclusion in the Work
|
140
|
+
by You to the Licensor shall be under the terms and conditions of
|
141
|
+
this License, without any additional terms or conditions.
|
142
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
143
|
+
the terms of any separate license agreement you may have executed
|
144
|
+
with Licensor regarding such Contributions.
|
145
|
+
|
146
|
+
6. Trademarks. This License does not grant permission to use the trade
|
147
|
+
names, trademarks, service marks, or product names of the Licensor,
|
148
|
+
except as required for reasonable and customary use in describing the
|
149
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
150
|
+
|
151
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
152
|
+
agreed to in writing, Licensor provides the Work (and each
|
153
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
154
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
155
|
+
implied, including, without limitation, any warranties or conditions
|
156
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
157
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
158
|
+
appropriateness of using or redistributing the Work and assume any
|
159
|
+
risks associated with Your exercise of permissions under this License.
|
160
|
+
|
161
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
162
|
+
whether in tort (including negligence), contract, or otherwise,
|
163
|
+
unless required by applicable law (such as deliberate and grossly
|
164
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
165
|
+
liable to You for damages, including any direct, indirect, special,
|
166
|
+
incidental, or consequential damages of any character arising as a
|
167
|
+
result of this License or out of the use or inability to use the
|
168
|
+
Work (including but not limited to damages for loss of goodwill,
|
169
|
+
work stoppage, computer failure or malfunction, or any and all
|
170
|
+
other commercial damages or losses), even if such Contributor
|
171
|
+
has been advised of the possibility of such damages.
|
172
|
+
|
173
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
174
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
175
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
176
|
+
or other liability obligations and/or rights consistent with this
|
177
|
+
License. However, in accepting such obligations, You may act only
|
178
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
179
|
+
of any other Contributor, and only if You agree to indemnify,
|
180
|
+
defend, and hold each Contributor harmless for any liability
|
181
|
+
incurred by, or claims asserted against, such Contributor by reason
|
182
|
+
of your accepting any such warranty or additional liability.
|
183
|
+
|
184
|
+
END OF TERMS AND CONDITIONS
|
185
|
+
|
186
|
+
APPENDIX: How to apply the Apache License to your work.
|
187
|
+
|
188
|
+
To apply the Apache License to your work, attach the following
|
189
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
190
|
+
replaced with your own identifying information. (Don't include
|
191
|
+
the brackets!) The text should be enclosed in the appropriate
|
192
|
+
comment syntax for the file format. We also recommend that a
|
193
|
+
file or class name and description of purpose be included on the
|
194
|
+
same "printed page" as the copyright notice for easier
|
195
|
+
identification within third-party archives.
|
196
|
+
|
197
|
+
Copyright [2010] [HomeAway, Inc.]
|
198
|
+
|
199
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
200
|
+
you may not use this file except in compliance with the License.
|
201
|
+
You may obtain a copy of the License at
|
202
|
+
|
203
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
204
|
+
|
205
|
+
Unless required by applicable law or agreed to in writing, software
|
206
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
207
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
208
|
+
See the License for the specific language governing permissions and
|
209
|
+
limitations under the License.
|
210
|
+
|
data/Manifest
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
CHANGELOG
|
2
|
+
LICENSE
|
3
|
+
Manifest
|
4
|
+
README
|
5
|
+
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
|
11
|
+
lib/page_generator.rb
|
12
|
+
lib/page_validator.rb
|
13
|
+
lib/selenium_fury.rb
|
14
|
+
selenium_fury.gemspec
|
15
|
+
spec/advanced_search.rb
|
16
|
+
spec/create_browser_driver.rb
|
17
|
+
spec/page_generator_spec.rb
|
18
|
+
spec/page_validator_spec.rb
|
19
|
+
spec/spec_helper.rb
|
data/README
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
= SeleniumFury
|
4
|
+
Selenium Fury allows an automated tester to quickly build page files to use in the page object pattern. Each page file represents
|
5
|
+
a page under test with attributes of all the locators selenium needs to run tests on the page and methods that represent
|
6
|
+
actions that can be performed on the page.
|
7
|
+
|
8
|
+
You use the generator to build the page files. After the page has been updated you can use the validator to go through
|
9
|
+
all of the selenium locators you are using in your page file and return a list of the locators that it could not find.
|
10
|
+
If there are missing locators you can then rerun the generator to generate new selenium locators for your page.
|
11
|
+
|
12
|
+
|
13
|
+
== Generate
|
14
|
+
* See the examples directory for full syntax.
|
15
|
+
* include PageGenerator
|
16
|
+
* get_source_and_print_elements(browser)
|
17
|
+
|
18
|
+
|
19
|
+
== Validate
|
20
|
+
* See the examples directory for full syntax.
|
21
|
+
* include PageValidator
|
22
|
+
* check_page_file_class(YourPageFileClass, "/optional_relative_url_path")
|
23
|
+
|
24
|
+
== Custom Configuration
|
25
|
+
|
26
|
+
* Coming Soon
|
27
|
+
|
28
|
+
|
29
|
+
== Copyright
|
30
|
+
|
31
|
+
* Copyright (c) 2010 HomeAway, Inc.
|
32
|
+
* All rights reserved. http://www.homeaway.com
|
33
|
+
See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,71 @@
|
|
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
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,19 @@
|
|
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
|
@@ -0,0 +1,16 @@
|
|
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
|
@@ -0,0 +1,93 @@
|
|
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 PageGenerator
|
17
|
+
|
18
|
+
def generate_instance_variables_from_html(options)
|
19
|
+
if options.kind_of?(Hash)
|
20
|
+
@html = options[:html]
|
21
|
+
@locator_type = options[:locator_type]
|
22
|
+
@locator = options[:locator]
|
23
|
+
end
|
24
|
+
doc = Nokogiri::HTML(@html)
|
25
|
+
html_elements = {}
|
26
|
+
if (@locator_type=="css")
|
27
|
+
doc.css(@locator).each do |html_element|
|
28
|
+
attribute_name = html_element.get_attribute("id")
|
29
|
+
attribute_value = html_element.get_attribute("id")
|
30
|
+
if !attribute_name.nil?
|
31
|
+
attribute_name.gsub!('input-', '')
|
32
|
+
attribute_name.gsub!('select-', '')
|
33
|
+
attribute_name.gsub!(/([A-Z]+)/, '_\1')
|
34
|
+
attribute_name.gsub!('\\', '')
|
35
|
+
attribute_name.gsub!(' ', '_')
|
36
|
+
attribute_name.gsub!('.', '_')
|
37
|
+
attribute_name.gsub!('-', '_')
|
38
|
+
attribute_name.gsub!('__', '_')
|
39
|
+
attribute_name = attribute_name.to_s.downcase
|
40
|
+
puts "@#{attribute_name} = \"#{attribute_value}\"" if $debug
|
41
|
+
html_elements[attribute_name]= attribute_value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
return html_elements
|
46
|
+
end
|
47
|
+
|
48
|
+
def merge_and_print_elements(page_elements_types)
|
49
|
+
html_elements={}
|
50
|
+
page_elements_types.each do |element_type|
|
51
|
+
html_elements.merge!(element_type)
|
52
|
+
end
|
53
|
+
|
54
|
+
puts "found (#{html_elements.length} elements)"
|
55
|
+
puts "class YourPageFile"
|
56
|
+
puts "\tdef initialize *browser\n\t\t@browser = *browser"
|
57
|
+
html_elements.keys.sort.each do |key|
|
58
|
+
puts "\t\t@#{key} = \"#{html_elements[key]}\""
|
59
|
+
end
|
60
|
+
puts "\tend"
|
61
|
+
count=1
|
62
|
+
html_elements.keys.sort.each do |key|
|
63
|
+
if count == 1
|
64
|
+
print "\tattr_accessor :browser, "
|
65
|
+
end
|
66
|
+
if count % 5 == 0
|
67
|
+
print "\n\t"
|
68
|
+
end
|
69
|
+
if count != html_elements.length
|
70
|
+
print ":#{key}, "
|
71
|
+
else
|
72
|
+
print ":#{key}"
|
73
|
+
end
|
74
|
+
count = count + 1
|
75
|
+
end
|
76
|
+
puts "\n\nend"
|
77
|
+
end
|
78
|
+
|
79
|
+
def get_source_and_print_elements(browser)
|
80
|
+
html =browser.get_html_source
|
81
|
+
html_elements_select=generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "select")
|
82
|
+
html_elements_text_area=generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "textarea")
|
83
|
+
html_elements_form = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "form")
|
84
|
+
html_elements_check_boxes = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='checkbox']")
|
85
|
+
html_elements_image = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='image']")
|
86
|
+
html_elements_radio = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='radio']")
|
87
|
+
html_elements_text = generate_instance_variables_from_html(:html =>html, :locator_type => "css", :locator => "input[type='text']")
|
88
|
+
merge_and_print_elements([html_elements_check_boxes, html_elements_select, html_elements_text,
|
89
|
+
html_elements_text_area, html_elements_image, html_elements_radio, html_elements_form])
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
end
|
@@ -0,0 +1,106 @@
|
|
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 'spec'
|
17
|
+
module PageValidator
|
18
|
+
|
19
|
+
|
20
|
+
def check_page_file_class(page_file_class, *live_url)
|
21
|
+
missing_locators={}
|
22
|
+
puts "Validating the #{page_file_class} class"
|
23
|
+
#all initialize methods of page files should have *browser specified as the argument. This is an optional argument
|
24
|
+
test_page = page_file_class.new(@browser)
|
25
|
+
test_page.should_not be_nil
|
26
|
+
#skip the open if we don't need to open the url agian
|
27
|
+
if !live_url.empty?
|
28
|
+
$stderr.puts "Opening #{@browser.browser_url}/#{live_url}" if $DEBUG
|
29
|
+
browser.open live_url
|
30
|
+
end
|
31
|
+
|
32
|
+
#check for class methods and execute.
|
33
|
+
verify_class_variables(test_page, missing_locators) if test_page.public_methods(all=false).length > 0
|
34
|
+
|
35
|
+
#check for instance methods and execute.
|
36
|
+
verify_instance_variables(test_page, missing_locators) if test_page.instance_variables.length > 0
|
37
|
+
print_missing_locators(missing_locators)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def print_missing_locators missing_locators
|
43
|
+
puts "Missing locators are " if missing_locators != {}
|
44
|
+
missing_locators.each_pair do |locator_name, locator_value|
|
45
|
+
puts " #{locator_name} => #{locator_value}"
|
46
|
+
end
|
47
|
+
missing_locators.should have(0).missing_locators
|
48
|
+
end
|
49
|
+
|
50
|
+
def attribute_name_filter locator_name
|
51
|
+
#Add names of attributes to filter
|
52
|
+
skip_words=["browser"]
|
53
|
+
|
54
|
+
skip_words=skip_words+@known_missing_locators if !@known_missing_locators.nil?
|
55
|
+
|
56
|
+
return skip_words.include?(locator_name)
|
57
|
+
end
|
58
|
+
|
59
|
+
def verify_instance_variables(test_page, missing_locators)
|
60
|
+
#test_page.print_properties browser
|
61
|
+
test_page.instance_variables.each do |locator_name|
|
62
|
+
#prepare the locator values
|
63
|
+
locator_name.slice!(0)
|
64
|
+
if attribute_name_filter(locator_name)
|
65
|
+
puts "Skipping validation for #{locator_name}"
|
66
|
+
next
|
67
|
+
end
|
68
|
+
next if (test_page.method(locator_name).call.class.to_s != "String")
|
69
|
+
puts " Validating the #{locator_name} page element locator" #chomp the @ sign off of the method name.
|
70
|
+
locator_value = test_page.method(locator_name) # Create the reference to the get method of the instance variable
|
71
|
+
begin
|
72
|
+
browser.wait_for_element(locator_value.call, {:timeout_in_seconds => "5"})
|
73
|
+
rescue
|
74
|
+
puts " ----------------------------------- Could not find #{locator_name}"
|
75
|
+
end
|
76
|
+
missing_locators[locator_name]= locator_value.call if !browser.element?(locator_value.call) # Use the value of the instance variable
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def verify_class_variables(test_page, missing_locators)
|
81
|
+
test_page.public_methods(all=false).each do |locator_name|
|
82
|
+
#Only operate with the set methods not the get methods
|
83
|
+
next if (!locator_name.include?("="))
|
84
|
+
|
85
|
+
locator_name.slice!(locator_name.length-1)
|
86
|
+
|
87
|
+
if attribute_name_filter(locator_name)
|
88
|
+
puts "Skipping validation for #{locator_name}"
|
89
|
+
next
|
90
|
+
end
|
91
|
+
next if (test_page.method(locator_name).call.class.to_s != "String")
|
92
|
+
puts " Validating the #{locator_name} page element locator" #chomp the @ sign off of the method name.
|
93
|
+
locator_value = test_page.method(locator_name) # Create the reference to the get method of the instance variable
|
94
|
+
|
95
|
+
#Now validate the page
|
96
|
+
begin
|
97
|
+
browser.wait_for_element(locator_value.call, {:timeout_in_seconds => "5"})
|
98
|
+
rescue
|
99
|
+
puts " ----------------------------------- Could not find #{locator_name}"
|
100
|
+
end
|
101
|
+
missing_locators[locator_name]= locator_value.call if !browser.element?(locator_value.call) # Use the value of the instance variable
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
@@ -0,0 +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
|
+
# */
|
16
|
+
require File.dirname(__FILE__) + "/page_generator"
|
17
|
+
require File.dirname(__FILE__) + "/page_validator"
|
18
|
+
require 'nokogiri'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{selenium_fury}
|
5
|
+
s.version = "0.5"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Scott Sims"]
|
9
|
+
s.date = %q{2010-11-04}
|
10
|
+
s.description = %q{Generate and validate page objects with this page object factory for Selenium.}
|
11
|
+
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"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{selenium_fury}
|
19
|
+
s.rubygems_version = %q{1.3.7}
|
20
|
+
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.
|
23
|
+
|
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
|
+
|
28
|
+
if s.respond_to? :specification_version then
|
29
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
30
|
+
s.specification_version = 3
|
31
|
+
|
32
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
33
|
+
else
|
34
|
+
end
|
35
|
+
else
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,71 @@
|
|
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
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,29 @@
|
|
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
|
+
|
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
|
+
end
|
@@ -0,0 +1,16 @@
|
|
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
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: selenium_fury
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
version: "0.5"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Scott Sims
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-11-04 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Generate and validate page objects with this page object factory for Selenium.
|
22
|
+
email: ssims98@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- CHANGELOG
|
29
|
+
- LICENSE
|
30
|
+
- README
|
31
|
+
- lib/page_generator.rb
|
32
|
+
- lib/page_validator.rb
|
33
|
+
- lib/selenium_fury.rb
|
34
|
+
files:
|
35
|
+
- CHANGELOG
|
36
|
+
- LICENSE
|
37
|
+
- Manifest
|
38
|
+
- README
|
39
|
+
- Rakefile
|
40
|
+
- lib/page_generator.rb
|
41
|
+
- lib/page_validator.rb
|
42
|
+
- lib/selenium_fury.rb
|
43
|
+
- selenium_fury.gemspec
|
44
|
+
- spec/advanced_search.rb
|
45
|
+
- spec/create_browser_driver.rb
|
46
|
+
- spec/page_generator_spec.rb
|
47
|
+
- spec/page_validator_spec.rb
|
48
|
+
- spec/spec_helper.rb
|
49
|
+
- examples/advanced_search.rb
|
50
|
+
- examples/create_browser_driver.rb
|
51
|
+
- examples/page_generator_spec.rb
|
52
|
+
- examples/page_validator_spec.rb
|
53
|
+
- examples/spec_helper.rb
|
54
|
+
has_rdoc: true
|
55
|
+
homepage: http://www.github.com/scottcsims/SeleniumFury
|
56
|
+
licenses: []
|
57
|
+
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options:
|
60
|
+
- --line-numbers
|
61
|
+
- --inline-source
|
62
|
+
- --title
|
63
|
+
- Selenium_fury
|
64
|
+
- --main
|
65
|
+
- README
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
hash: 11
|
83
|
+
segments:
|
84
|
+
- 1
|
85
|
+
- 2
|
86
|
+
version: "1.2"
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project: selenium_fury
|
90
|
+
rubygems_version: 1.3.7
|
91
|
+
signing_key:
|
92
|
+
specification_version: 3
|
93
|
+
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
|
94
|
+
test_files: []
|
95
|
+
|