test-factory 0.4.7 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDMzMjlhNzBkMTYwYWE4MWM4ODQxZDNmZDJjZGMxMGViMDNhMjkzZg==
4
+ MjM2NDE3ZTk1MzI5ZjgyYjhhYjI2Zjg4MGY1NWQ3NmQ4MDk0MDgwMg==
5
5
  data.tar.gz: !binary |-
6
- MWNlOGFkNDkwZGQzNzVjZTc2MmJlNWE0Mzk4OGFkMzM2ZGUzNjVjNA==
6
+ ZDM2NzNjNmJkN2I0MTcwODc3MDg5ODc3MjM3YTczZTA2MjdkNTE2NQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZTI4ZGJhYTAxMjA5ODAyYTRhMjMxNzliNWU5ZGViODcyYzFmMzZiYWM3NmIy
10
- MTAwMTY0MzA3MjUxMDIwMjM1YzQzYzg4ZTQ1Mjk5MGUyYjhiNTIyZjQ4Njcw
11
- MjJiZGM4ZjA2MjVhZTUyOTk1NzgxMDlmZTU0ZDdjYTY3MjMyYzM=
9
+ ODhjMDg0OTE0OTkwODczZGM0YjZhNTUyYTE0MmVhNjE5MjNiNjg3M2QwOTkz
10
+ MmQxZjE3NWE5N2E4MjM2N2VkMDJjZTI3OWMwYWY1MTM2MWJiZGNiNjZkYjAx
11
+ MmIyOGM1ZjU4ZjhlNDk3MmVlM2RlODRkYmE0OGQ1NWYwOTg2MmU=
12
12
  data.tar.gz: !binary |-
13
- NTUzNjljNTBmMzI1MDFmOTg1MTk1NDQ0ZjU4MmMyODZmZjgyMjU1ZDgzMWRh
14
- MmJhZGUwY2MwMThiNmQ5MWFkMDI5MmJhMGE2YmIyN2JjYzdmOGM4NWVjYmE4
15
- MTdlNDdjZWFmMThkMjA3NDVkZjI5ZGFhYTFmNDZhNmFiYWYxYWE=
13
+ ZjU2MjEwMTdmOTkzMDU4NzJmY2JmODU2YmE0NjNjYTAyYzE0NDA5ODg5NWUx
14
+ ZDA2Y2M5YTQzNjgwOWJjYzIyNjEzZDM2MzBlNDc4MTc2ZThhNjNiYWIwZTI1
15
+ YTFmMTkwMWY4NjZjZWJkMThkMDQwMGVhYTczYTcxNjY2NmIyOGE=
@@ -116,7 +116,7 @@ class PageFactory
116
116
  # @example
117
117
  # link("Click Me For Fun!", :click_me) => Creates the methods #click_me and #click_me_link
118
118
  #
119
- def link(link_text, *alias_name)
119
+ def link link_text, *alias_name
120
120
  elementize(:link, link_text, *alias_name)
121
121
  end
122
122
 
@@ -143,19 +143,39 @@ class PageFactory
143
143
  # @example
144
144
  # link("Click Me For Fun!", :click_me) => Creates the methods #click_me and #click_me_link
145
145
  #
146
- def button(button_text, *alias_name)
146
+ def button button_text, *alias_name
147
147
  elementize(:button, button_text, *alias_name)
148
148
  end
149
149
 
150
+ def inherited klass
151
+ klass.instance_eval {
152
+
153
+ # Creates a method, #wait_for_ajax, usable in your Page Classes, that executes
154
+ # the 'jQuery.active' Javascript snippet each second until timeout.
155
+ #
156
+ # If timeout is exceeded, raises Watir::Wait::TimeoutError exception.
157
+ #
158
+ define_method 'wait_for_ajax' do |timeout=10|
159
+ timeout.times do
160
+ sleep 0.3
161
+ return true if @browser.execute_script('return jQuery.active').to_i == 0
162
+ sleep 0.7
163
+ end
164
+ raise Watir::Wait::TimeoutError, "Ajax calls continued beyond #{timeout} seconds."
165
+ end
166
+
167
+ }
168
+ end
169
+
150
170
  private
151
171
  # A helper method that converts the passed string into snake case. See the StringFactory
152
172
  # module for more info.
153
173
  #
154
- def damballa(text)
174
+ def damballa text
155
175
  StringFactory.damballa(text)
156
176
  end
157
177
 
158
- def elementize(type, text, *alias_name)
178
+ def elementize type, text, *alias_name
159
179
  hash={:link=>:text, :button=>:value}
160
180
  if alias_name.empty?
161
181
  el_name=damballa("#{text}_#{type}")
data/test-factory.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'test-factory'
3
- s.version = '0.4.7'
3
+ s.version = '0.4.9'
4
4
  s.summary = %q{rSmart's framework for creating automated testing scripts}
5
5
  s.description = %q{This gem provides a set of modules and methods to help quickly and DRYly create a test automation framework using Ruby and Watir (or watir-webdriver).}
6
6
  s.files = Dir.glob("**/**/**")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-factory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abraham Heward
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-12 00:00:00.000000000 Z
11
+ date: 2014-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir-webdriver