RubyApp 0.6.47 → 0.6.48

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.
@@ -238,6 +238,24 @@ module RubyApp
238
238
  self.assert_not_exists_selector_value_for("label:contains('#{text}')", value) if value
239
239
  end
240
240
 
241
+ def assert_is_text_visible(text)
242
+ self.assert_is_selector_visible("*:visible:contains('#{text}')")
243
+ end
244
+
245
+ def assert_not_is_text_visible(text)
246
+ self.assert_not_is_selector_visible("*:visible:contains('#{text}')")
247
+ end
248
+
249
+ def assert_is_selector_visible(selector)
250
+ _selector = ".ui-page-active #{selector}:last"
251
+ self.execute("RubyApp.assertIsVisible(#{_selector.to_json});")
252
+ end
253
+
254
+ def assert_not_is_selector_visible(selector)
255
+ _selector = ".ui-page-active #{selector}:last"
256
+ self.execute("RubyApp.assertNotIsVisible(#{_selector.to_json});")
257
+ end
258
+
241
259
  def assert(name, expression = nil)
242
260
  self.execute("RubyApp.assert(#{name.to_json}, #{(expression ? expression : yield).to_json});")
243
261
  end
@@ -42,6 +42,14 @@ module RubyApp
42
42
  item.attributes.merge!('disabled' => true)
43
43
  @list.items += [ item ]
44
44
 
45
+ (0..91).each do |index|
46
+ @list.items += [ RubyApp::Elements::Mobile::List::ListItem.new('Filler') ]
47
+ end
48
+
49
+ item = RubyApp::Elements::Mobile::List::ListItem.new('Item 09')
50
+ item.attributes.merge!('class' => 'hidden')
51
+ @list.items += [ item ]
52
+
45
53
  @list.searched do |element, event|
46
54
  RubyApp::Elements::Mobile::Dialog.show(event, RubyApp::Elements::Mobile::Dialogs::AcknowledgementDialog.new('List', "You input #{event.value}."))
47
55
  event.update_element(@list)
@@ -184,6 +184,19 @@
184
184
  this.swipeRight = function() {
185
185
  $('.ui-page-active').swiperight();
186
186
  },
187
+ this.isVisible = function(selector) {
188
+ var windowTop = $(window).scrollTop();
189
+ var windowBottom = windowTop + $(window).height();
190
+ var elementTop = $(selector).offset().top;
191
+ var elementBottom = elementTop + $(selector).height();
192
+
193
+ RubyApp.log('windowTop=' + windowTop);
194
+ RubyApp.log('windowBottom=' + windowBottom);
195
+ RubyApp.log('elementTop=' + elementTop);
196
+ RubyApp.log('elementBottom=' + elementBottom);
197
+
198
+ return ((elementBottom >= windowTop) && (elementTop <= windowBottom) && (elementBottom <= windowBottom) && (elementTop >= windowTop) );
199
+ },
187
200
  this.assertExists = function(selector) {
188
201
  RubyApp.assert('selector=' + selector, $(selector).length > 0);
189
202
  },
@@ -216,6 +229,12 @@
216
229
  var _value = $('#' + _for).val();
217
230
  RubyApp.assert('selector=' + selector + ', for=' + _for + ', value=' + value, _value != value);
218
231
  },
232
+ this.assertIsVisible = function(selector) {
233
+ RubyApp.assert('selector=' + selector + ', visible', RubyApp.isVisible(selector) == true);
234
+ },
235
+ this.assertNotIsVisible = function(selector) {
236
+ RubyApp.assert('selector=' + selector + ', not visible', RubyApp.isVisible(selector) == false);
237
+ },
219
238
  this.assert = function(name, value) {
220
239
  RubyApp.sendEvent({_class:'RubyApp::Element::AssertedEvent', source:$('html').attr('id'), name:name, value:eval(value)});
221
240
  },
@@ -30,6 +30,13 @@ add_step! (RubyApp::Element::AssertedEvent) { |event| event.click_li
30
30
 
31
31
  add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.assert_not_exists_link('Item 08') }
32
32
 
33
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_is_text_visible('Item 01') }
34
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_not_is_text_visible('Item 09') }
35
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.execute('$("body").scrollTop(10000);')
36
+ event.execute {} }
37
+ add_step! (RubyApp::Element::ExecutedEvent) { |event| event.assert_not_is_text_visible('Item 01') }
38
+ add_step! (RubyApp::Element::AssertedEvent) { |event| event.assert_is_text_visible('Item 09') }
39
+
33
40
  add_step! (RubyApp::Element::AssertedEvent) { |event| event.click_link('Back') }
34
41
  add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.click_link('Back') }
35
42
  add_step! (RubyApp::Elements::Mobile::Page::ShownEvent) { |event| event.execute {} }
@@ -1,4 +1,4 @@
1
1
  module RubyApp
2
- VERSION = "0.6.47"
2
+ VERSION = "0.6.48"
3
3
  ROOT = File.expand_path(File.dirname(__FILE__))
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RubyApp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 89
4
+ hash: 103
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 47
10
- version: 0.6.47
9
+ - 48
10
+ version: 0.6.48
11
11
  platform: ruby
12
12
  authors:
13
13
  - Frank G. Ficnar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-01 00:00:00 Z
18
+ date: 2012-12-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement