selenium_fury 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fd83fba7efc074d50e44f358412f6f6eeecc0628
4
+ data.tar.gz: aeb58034cad8ddf5956872a8eef08881ac3adc0e
5
+ SHA512:
6
+ metadata.gz: 7d01cef0793d4cab7eba865576d6afb3d90f8b172d206ee3a136fc129dcffbb176af500337488719df37dcd4e007d1898dfcbca87f301b823a93df0551b8173c
7
+ data.tar.gz: a5999ac5c9cfd76830bb58d807bd3de53ab347d21a1a5a5d5b6d3e25835a08f7f00452cbf7f823e066c86714242f4d8d01d44e3d19edc15e9207f16e9089ea73
data/Rakefile CHANGED
@@ -1,13 +1,11 @@
1
1
  #!/usr/bin/env rake
2
- #require 'rubygems'
3
- #require 'bundler/setup'
4
-
5
2
  require 'rspec'
6
3
  require 'rspec/core/rake_task'
7
4
  require 'cucumber'
8
5
  require 'cucumber/rake/task'
9
6
 
10
7
  require "bundler/gem_tasks"
8
+ require 'parallel_tests/tasks'
11
9
 
12
10
  RSpec::Core::RakeTask.new(:spec)
13
11
  Cucumber::Rake::Task.new(:feature)
@@ -15,12 +13,3 @@ Cucumber::Rake::Task.new(:feature)
15
13
  task :default => :spec
16
14
 
17
15
 
18
-
19
- #desc 'Push gem to gem server'
20
- # task 'release' => ['gem:build', 'gem:git:release'] do
21
- # jeweler = Rake.application.jeweler
22
- # gemspec = jeweler.gemspec
23
- # command = "gem push pkg/#{gemspec.name}-#{jeweler.version}.gem"
24
- # puts "Executing #{command.inspect}:"
25
- # system command
26
- # end
@@ -7,11 +7,12 @@ module SeleniumFury
7
7
  include ElementWaitHelpers
8
8
 
9
9
  def initialize(locator, driver=nil, opt={})
10
- @location = locator
10
+ @original_location = locator.freeze
11
+ @location = Marshal.load(Marshal.dump(@original_location))
11
12
  @driver = driver
12
13
  @tags = opt[:tags]
13
14
  # Should validate if opt[:validate] is nil, should not validate if doing dynamic matchin
14
- @validate = opt[:validate] != false && !locator.values.first.match(/\^([^=].*?)\$/)
15
+ @validate = opt[:validate] != false && !locator.values.first.match(/__/)
15
16
  # This is different from implicit_wait. This explicitly waits for this element, not for entire driver session.
16
17
  @wait = 10 || opt[:wait]
17
18
  end
@@ -24,12 +25,9 @@ module SeleniumFury
24
25
  end
25
26
 
26
27
  def update_locator(variables)
27
- locator_value = @location.values.first
28
- variables.each { |key, value|
29
- locator_value.scan(/\^([^=]\w*)\$/).flatten.each { |match|
30
- locator_value.gsub!("^#{match}$", value.to_s) if match == key.to_s
31
- }
32
- }
28
+ locator = Marshal.load(Marshal.dump(@original_location))
29
+ variables.each { |key, value| locator.first[1].gsub! ('__' + key.to_s.upcase + '__'), value.to_s }
30
+ @location = locator
33
31
  self
34
32
  end
35
33
 
@@ -48,11 +48,11 @@ module ElementWaitHelpers
48
48
  end
49
49
 
50
50
  def wait_present(timeout=@wait)
51
- wait_for(timeout: timeout) { present? }
51
+ wait_for(timeout: timeout, message: "Element at #{location} is not present") { present? }
52
52
  end
53
53
 
54
54
  def wait_not_present(timeout=@wait)
55
- wait_for(timeout: timeout) { !present? }
55
+ wait_for(timeout: timeout, message: "Element at #{location} is still present") { !present? }
56
56
  end
57
57
 
58
58
  def wait_visible(timeout=@wait)
@@ -62,16 +62,16 @@ module ElementWaitHelpers
62
62
 
63
63
  # Raises error if not present
64
64
  def wait_visible!(timeout=@wait)
65
- wait_for(timeout: timeout) { visible? }
65
+ wait_for(timeout: timeout, message: "Element at #{location} is not visible") { visible? }
66
66
  end
67
67
 
68
68
  def wait_not_visible(timeout=@wait)
69
- wait_for(timeout: timeout) { !present? || !visible? }
69
+ wait_for(timeout: timeout, message: "Element at #{location} is still visible") { !present? || !visible? }
70
70
  end
71
71
 
72
72
  # Raises error if not present
73
73
  def wait_not_visible!(timeout=@wait)
74
- wait_for(timeout: timeout) { !visible? }
74
+ wait_for(timeout: timeout, message: "Element at #{location} is still visible") { !visible? }
75
75
  end
76
76
  end
77
77
 
@@ -1,3 +1,3 @@
1
1
  module SeleniumFury
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
data/lib/selenium_fury.rb CHANGED
@@ -1,39 +1,36 @@
1
1
  #/* Copyright (c) 2010 HomeAway, Inc.
2
2
  # * All rights reserved. http://www.homeaway.com
3
3
  # *
4
- # * Licensed under the Apache License, Version 2.0 (the "License");
4
+ # * Licensed under the Apache License, Version 2.0 (the 'License');
5
5
  # * you may not use this file except in compliance with the License.
6
6
  # * You may obtain a copy of the License at
7
7
  # *
8
8
  # * http://www.apache.org/licenses/LICENSE-2.0
9
9
  # *
10
10
  # * Unless required by applicable law or agreed to in writing, software
11
- # * distributed under the License is distributed on an "AS IS" BASIS,
11
+ # * distributed under the License is distributed on an 'AS IS' BASIS,
12
12
  # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  # * See the License for the specific language governing permissions and
14
14
  # * limitations under the License.
15
15
  # */
16
-
17
- require "selenium_fury/version"
18
16
  require 'rubygems'
19
17
  require 'bundler'
20
18
 
21
- require "selenium/webdriver/common/timeouts"
22
-
23
- require "selenium-webdriver"
24
- require "selenium-client"
19
+ require 'selenium-webdriver'
25
20
  require 'nokogiri'
26
21
 
27
- require "selenium_fury/common/page_parser"
28
- require "selenium_fury/selenium_web_driver/create_selenium_web_driver"
29
- require "selenium_fury/selenium_web_driver/element_finder"
30
- require "selenium_fury/selenium_web_driver/page_object_components"
31
- require "selenium_fury/selenium_web_driver/page_object"
32
- require "selenium_fury/selenium_web_driver/page_generator"
33
- require "selenium_fury/selenium_web_driver/page_validator"
22
+ require 'selenium_fury/version'
23
+ require 'selenium/webdriver/common/timeouts'
24
+ require 'selenium_fury/common/page_parser'
25
+ require 'selenium_fury/selenium_web_driver/create_selenium_web_driver'
26
+ require 'selenium_fury/selenium_web_driver/element_finder'
27
+ require 'selenium_fury/selenium_web_driver/page_object_components'
28
+ require 'selenium_fury/selenium_web_driver/page_object'
29
+ require 'selenium_fury/selenium_web_driver/page_generator'
30
+ require 'selenium_fury/selenium_web_driver/page_validator'
34
31
 
35
- require "selenium_fury/selenium_web_driver/generic_elements/generic_element_helpers"
36
- require "selenium_fury/selenium_web_driver/generic_elements/generic_element"
32
+ require 'selenium_fury/selenium_web_driver/generic_elements/generic_element_helpers'
33
+ require 'selenium_fury/selenium_web_driver/generic_elements/generic_element'
37
34
 
38
35
  include SeleniumFury::SeleniumWebDriver::PageGenerator
39
36
  include SeleniumFury::SeleniumWebDriver::PageValidator
@@ -13,10 +13,12 @@ Gem::Specification.new do |gem|
13
13
  gem.name = "selenium_fury"
14
14
  gem.require_paths = ["lib"]
15
15
  gem.version = SeleniumFury::VERSION
16
- gem.add_dependency('selenium-webdriver')
17
- gem.add_dependency('nokogiri')
16
+ gem.add_dependency('selenium-webdriver','~> 2')
17
+ gem.add_dependency('nokogiri','~> 1')
18
18
  gem.add_development_dependency('rspec','~>2.12')
19
19
  gem.add_development_dependency('cucumber')
20
20
  gem.add_development_dependency('redcarpet')
21
21
  gem.add_development_dependency('rake')
22
+ gem.add_development_dependency('json', '~> 1.7.7')
23
+ gem.add_development_dependency('parallel_tests')
22
24
  end
@@ -22,6 +22,15 @@ describe PageObject do
22
22
  specific_element.location.should == {css: "a[id='link333333']"}
23
23
  specific_element.link.should == 'http://google.com/'
24
24
  end
25
+
26
+ it 'should allow changing the selector to allow for different selections with the same element' do
27
+ specific_element = test_page.dynamic_locator_css.update_locator(locator: 'id', id: 333333)
28
+ specific_element.location.should == {css: "a[id='link333333']"}
29
+ specific_element.link.should == 'http://google.com/'
30
+ specific_element = test_page.dynamic_locator_css.update_locator(locator: 'id', id: 222222)
31
+ specific_element.location.should == {css: "a[id='link222222']"}
32
+ specific_element.link.should == 'http://yahoo.com/'
33
+ end
25
34
  end
26
35
 
27
36
  describe SeleniumFury::SeleniumWebDriver::PageObjectComponents::GenericElement do
@@ -34,8 +34,8 @@ class TestPage < PageObject
34
34
  image_element :input_image_element, {id: 'input_image'}
35
35
 
36
36
  link_element :link_element, {id: 'link111111'}
37
- link_element :dynamic_locator_css, {css: "a[^locator$='link^id$']"}
38
- link_element :dynamic_locator_id, {id: 'link^id$'}
37
+ link_element :dynamic_locator_css, {css: "a[__LOCATOR__='link__ID__']"}
38
+ link_element :dynamic_locator_id, {id: 'link__ID__'}
39
39
 
40
40
  radio_button_element :input_radio_element, {id: 'input_radio'}
41
41
 
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium_fury
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
5
- prerelease:
4
+ version: 1.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Scott Sims
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-05 00:00:00.000000000 Z
11
+ date: 2013-07-15 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: selenium-webdriver
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '2'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: '2'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: nokogiri
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ~>
36
32
  - !ruby/object:Gem::Version
37
- version: '0'
33
+ version: '1'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ~>
44
39
  - !ruby/object:Gem::Version
45
- version: '0'
40
+ version: '1'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,49 +55,71 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: cucumber
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: redcarpet
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: json
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.7.7
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.7.7
111
+ - !ruby/object:Gem::Dependency
112
+ name: parallel_tests
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
100
116
  - !ruby/object:Gem::Version
101
117
  version: '0'
102
118
  type: :development
103
119
  prerelease: false
104
120
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
121
  requirements:
107
- - - ! '>='
122
+ - - '>='
108
123
  - !ruby/object:Gem::Version
109
124
  version: '0'
110
125
  description: Generate and validate page objects with this page object factory for
@@ -142,13 +157,13 @@ files:
142
157
  - lib/selenium_fury/selenium_web_driver/page_validator.rb
143
158
  - lib/selenium_fury/version.rb
144
159
  - selenium_fury.gemspec
145
- - spec/common/page_parser_spec.rb
146
160
  - spec/selenium/webdriver/common/timeouts_spec.rb
147
- - spec/selenium_web_driver/element_finder_spec.rb
148
- - spec/selenium_web_driver/generic_elements_spec.rb
149
- - spec/selenium_web_driver/page_generator_spec.rb
150
- - spec/selenium_web_driver/page_object_spec.rb
151
- - spec/selenium_web_driver/page_validator_spec.rb
161
+ - spec/selenium_fury/common/page_parser_spec.rb
162
+ - spec/selenium_fury/selenium_web_driver/element_finder_spec.rb
163
+ - spec/selenium_fury/selenium_web_driver/generic_elements/generic_elements_spec.rb
164
+ - spec/selenium_fury/selenium_web_driver/page_generator_spec.rb
165
+ - spec/selenium_fury/selenium_web_driver/page_object_spec.rb
166
+ - spec/selenium_fury/selenium_web_driver/page_validator_spec.rb
152
167
  - spec/spec_helper.rb
153
168
  - spec/test_page/Spacer.gif
154
169
  - spec/test_page/test_page.html
@@ -156,33 +171,26 @@ files:
156
171
  - spec/test_page/test_page_custom_generator_configuration.rb
157
172
  homepage: https://github.com/scottcsims/SeleniumFury
158
173
  licenses: []
174
+ metadata: {}
159
175
  post_install_message:
160
176
  rdoc_options: []
161
177
  require_paths:
162
178
  - lib
163
179
  required_ruby_version: !ruby/object:Gem::Requirement
164
- none: false
165
180
  requirements:
166
- - - ! '>='
181
+ - - '>='
167
182
  - !ruby/object:Gem::Version
168
183
  version: '0'
169
- segments:
170
- - 0
171
- hash: -1088754158506320944
172
184
  required_rubygems_version: !ruby/object:Gem::Requirement
173
- none: false
174
185
  requirements:
175
- - - ! '>='
186
+ - - '>='
176
187
  - !ruby/object:Gem::Version
177
188
  version: '0'
178
- segments:
179
- - 0
180
- hash: -1088754158506320944
181
189
  requirements: []
182
190
  rubyforge_project:
183
- rubygems_version: 1.8.25
191
+ rubygems_version: 2.0.3
184
192
  signing_key:
185
- specification_version: 3
193
+ specification_version: 4
186
194
  summary: Generate Selenium Page Objects
187
195
  test_files:
188
196
  - features/generate_page_object.feature
@@ -191,13 +199,13 @@ test_files:
191
199
  - features/support/env.rb
192
200
  - features/support/hooks.rb
193
201
  - features/validate_page_object.feature
194
- - spec/common/page_parser_spec.rb
195
202
  - spec/selenium/webdriver/common/timeouts_spec.rb
196
- - spec/selenium_web_driver/element_finder_spec.rb
197
- - spec/selenium_web_driver/generic_elements_spec.rb
198
- - spec/selenium_web_driver/page_generator_spec.rb
199
- - spec/selenium_web_driver/page_object_spec.rb
200
- - spec/selenium_web_driver/page_validator_spec.rb
203
+ - spec/selenium_fury/common/page_parser_spec.rb
204
+ - spec/selenium_fury/selenium_web_driver/element_finder_spec.rb
205
+ - spec/selenium_fury/selenium_web_driver/generic_elements/generic_elements_spec.rb
206
+ - spec/selenium_fury/selenium_web_driver/page_generator_spec.rb
207
+ - spec/selenium_fury/selenium_web_driver/page_object_spec.rb
208
+ - spec/selenium_fury/selenium_web_driver/page_validator_spec.rb
201
209
  - spec/spec_helper.rb
202
210
  - spec/test_page/Spacer.gif
203
211
  - spec/test_page/test_page.html