symbiont 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/Gemfile.lock +1 -1
  2. data/HISTORY.md +6 -0
  3. data/app/app.rb +48 -0
  4. data/app/public/css/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
  5. data/app/public/css/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png +0 -0
  6. data/app/public/css/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
  7. data/app/public/css/cupertino/images/ui-bg_glass_50_3baae3_1x400.png +0 -0
  8. data/app/public/css/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
  9. data/app/public/css/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
  10. data/app/public/css/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
  11. data/app/public/css/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
  12. data/app/public/css/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
  13. data/app/public/css/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
  14. data/app/public/css/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
  15. data/app/public/css/cupertino/images/ui-icons_3d80b3_256x240.png +0 -0
  16. data/app/public/css/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
  17. data/app/public/css/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
  18. data/app/public/css/cupertino/jquery-ui-1.8.16.custom.css +290 -0
  19. data/app/public/css/demo_table_jui.css +471 -0
  20. data/app/public/css/font/ColabLig-webfont.eot +0 -0
  21. data/app/public/css/font/ColabLig-webfont.svg +149 -0
  22. data/app/public/css/font/ColabLig-webfont.ttf +0 -0
  23. data/app/public/css/font/ColabLig-webfont.woff +0 -0
  24. data/app/public/css/font/ColabMed-webfont.eot +0 -0
  25. data/app/public/css/font/ColabMed-webfont.svg +149 -0
  26. data/app/public/css/font/ColabMed-webfont.ttf +0 -0
  27. data/app/public/css/font/ColabMed-webfont.woff +0 -0
  28. data/app/public/css/font/ColabReg-webfont.eot +0 -0
  29. data/app/public/css/font/ColabReg-webfont.svg +149 -0
  30. data/app/public/css/font/ColabReg-webfont.ttf +0 -0
  31. data/app/public/css/font/ColabReg-webfont.woff +0 -0
  32. data/app/public/css/font/ColabThi-webfont.eot +0 -0
  33. data/app/public/css/font/ColabThi-webfont.svg +149 -0
  34. data/app/public/css/font/ColabThi-webfont.ttf +0 -0
  35. data/app/public/css/font/ColabThi-webfont.woff +0 -0
  36. data/app/public/css/normalize.css +376 -0
  37. data/app/public/css/site.css +430 -0
  38. data/app/public/fancybox/blank.gif +0 -0
  39. data/app/public/fancybox/fancy_close.png +0 -0
  40. data/app/public/fancybox/fancy_loading.png +0 -0
  41. data/app/public/fancybox/fancy_nav_left.png +0 -0
  42. data/app/public/fancybox/fancy_nav_right.png +0 -0
  43. data/app/public/fancybox/fancy_shadow_e.png +0 -0
  44. data/app/public/fancybox/fancy_shadow_n.png +0 -0
  45. data/app/public/fancybox/fancy_shadow_ne.png +0 -0
  46. data/app/public/fancybox/fancy_shadow_nw.png +0 -0
  47. data/app/public/fancybox/fancy_shadow_s.png +0 -0
  48. data/app/public/fancybox/fancy_shadow_se.png +0 -0
  49. data/app/public/fancybox/fancy_shadow_sw.png +0 -0
  50. data/app/public/fancybox/fancy_shadow_w.png +0 -0
  51. data/app/public/fancybox/fancy_title_left.png +0 -0
  52. data/app/public/fancybox/fancy_title_main.png +0 -0
  53. data/app/public/fancybox/fancy_title_over.png +0 -0
  54. data/app/public/fancybox/fancy_title_right.png +0 -0
  55. data/app/public/fancybox/fancybox-x.png +0 -0
  56. data/app/public/fancybox/fancybox-y.png +0 -0
  57. data/app/public/fancybox/fancybox.png +0 -0
  58. data/app/public/fancybox/jquery.fancybox-1.3.4.css +359 -0
  59. data/app/public/fancybox/jquery.fancybox-1.3.4.js +1156 -0
  60. data/app/public/fancybox/jquery.fancybox-1.3.4.min.js +1 -0
  61. data/app/public/img/Sorting icons.psd +0 -0
  62. data/app/public/img/back_disabled.png +0 -0
  63. data/app/public/img/back_enabled.png +0 -0
  64. data/app/public/img/back_enabled_hover.png +0 -0
  65. data/app/public/img/close.png +0 -0
  66. data/app/public/img/favicon.ico +0 -0
  67. data/app/public/img/forward_disabled.png +0 -0
  68. data/app/public/img/forward_enabled.png +0 -0
  69. data/app/public/img/forward_enabled_hover.png +0 -0
  70. data/app/public/img/lucid-bg.png +0 -0
  71. data/app/public/img/lucid-ft.png +0 -0
  72. data/app/public/img/open.png +0 -0
  73. data/app/public/img/sort_asc.png +0 -0
  74. data/app/public/img/sort_asc_disabled.png +0 -0
  75. data/app/public/img/sort_both.png +0 -0
  76. data/app/public/img/sort_desc.png +0 -0
  77. data/app/public/img/sort_desc_disabled.png +0 -0
  78. data/app/public/js/comics.js +11 -0
  79. data/app/public/js/signup.js +141 -0
  80. data/app/public/js/site.js +40 -0
  81. data/app/public/js/stardate.js +35 -0
  82. data/app/public/js/vendor/html5shiv.js +5 -0
  83. data/app/public/js/vendor/jquery-1.8.3.min.js +2 -0
  84. data/app/public/js/vendor/jquery.dataTables.min.js +151 -0
  85. data/app/public/js/vendor/jquery.validate.min.js +4 -0
  86. data/app/views/comics.erb +322 -0
  87. data/app/views/index.erb +7 -0
  88. data/app/views/layout.erb +72 -0
  89. data/app/views/layout_small.erb +21 -0
  90. data/app/views/stardate.erb +5 -0
  91. data/app/views/stardate_calc.erb +30 -0
  92. data/app/views/webobject.erb +147 -0
  93. data/lib/symbiont/enclosers.rb +18 -2
  94. data/lib/symbiont/evaluators.rb +1 -4
  95. data/lib/symbiont/generators.rb +22 -56
  96. data/lib/symbiont/locators.rb +10 -10
  97. data/lib/symbiont/platform_watir/platform_object.rb +28 -52
  98. data/lib/symbiont/platform_watir.rb +2 -11
  99. data/lib/symbiont/platforms.rb +8 -20
  100. data/lib/symbiont/version.rb +1 -1
  101. data/lib/symbiont/web_objects/_common.rb +110 -32
  102. data/lib/symbiont/web_objects/button.rb +2 -15
  103. data/lib/symbiont/web_objects/checkbox.rb +11 -17
  104. data/lib/symbiont/web_objects/div.rb +1 -5
  105. data/lib/symbiont/web_objects/link.rb +3 -20
  106. data/lib/symbiont/web_objects/radio.rb +10 -16
  107. data/lib/symbiont/web_objects/select_list.rb +60 -15
  108. data/lib/symbiont/web_objects/span.rb +1 -5
  109. data/lib/symbiont/web_objects/table.rb +22 -12
  110. data/lib/symbiont/web_objects/table_cell.rb +2 -6
  111. data/lib/symbiont/web_objects/table_row.rb +24 -13
  112. data/lib/symbiont/web_objects/text_field.rb +10 -19
  113. data/lib/symbiont/web_objects.rb +2 -2
  114. data/lib/symbiont.rb +13 -3
  115. data/spec/spec_helper.rb +1 -0
  116. data/spec/symbiont/enclosers_spec.rb +3 -0
  117. data/spec/symbiont/evaluators_spec.rb +5 -0
  118. data/spec/symbiont/generators/button_generators_spec.rb +1 -1
  119. data/spec/symbiont/generators/cell_generators_spec.rb +1 -1
  120. data/spec/symbiont/generators/checkbox_generators_spec.rb +1 -1
  121. data/spec/symbiont/generators/div_generators_spec.rb +2 -2
  122. data/spec/symbiont/generators/link_generators_spec.rb +1 -1
  123. data/spec/symbiont/generators/paragraph_generators_spec.rb +52 -0
  124. data/spec/symbiont/generators/radio_generators_spec.rb +1 -2
  125. data/spec/symbiont/generators/select_list_generators_spec.rb +3 -3
  126. data/spec/symbiont/generators/span_generators_spec.rb +1 -1
  127. data/spec/symbiont/generators/table_generators_spec.rb +8 -1
  128. data/spec/symbiont/generators/text_field_generators_spec.rb +1 -1
  129. data/spec/symbiont/symbiont_spec.rb +10 -0
  130. data/spec/symbiont/web_object_spec.rb +71 -10
  131. data/spec/symbiont/web_objects/paragraph_spec.rb +11 -0
  132. data/spec/symbiont/web_objects/radio_spec.rb +17 -1
  133. data/spec/symbiont/web_objects/table_cell_spec.rb +6 -0
  134. data/spec/symbiont/web_objects/table_row_spec.rb +20 -10
  135. metadata +94 -20
  136. data/lib/symbiont/platform_selenium/platform_object.rb +0 -236
  137. data/lib/symbiont/platform_selenium/web_objects/button.rb +0 -13
  138. data/lib/symbiont/platform_selenium/web_objects/checkbox.rb +0 -21
  139. data/lib/symbiont/platform_selenium/web_objects/common.rb +0 -104
  140. data/lib/symbiont/platform_selenium/web_objects/link.rb +0 -13
  141. data/lib/symbiont/platform_selenium/web_objects/radio.rb +0 -21
  142. data/lib/symbiont/platform_selenium/web_objects/select_list.rb +0 -79
  143. data/lib/symbiont/platform_selenium/web_objects/table.rb +0 -40
  144. data/lib/symbiont/platform_selenium/web_objects/table_row.rb +0 -36
  145. data/lib/symbiont/platform_selenium/web_objects/text_field.rb +0 -14
  146. data/lib/symbiont/platform_selenium.rb +0 -18
  147. data/lib/symbiont/platform_watir/web_objects/checkbox.rb +0 -21
  148. data/lib/symbiont/platform_watir/web_objects/common.rb +0 -82
  149. data/lib/symbiont/platform_watir/web_objects/radio.rb +0 -21
  150. data/lib/symbiont/platform_watir/web_objects/select_list.rb +0 -67
  151. data/lib/symbiont/platform_watir/web_objects/table.rb +0 -31
  152. data/lib/symbiont/platform_watir/web_objects/table_row.rb +0 -31
  153. data/lib/symbiont/platform_watir/web_objects/text_field.rb +0 -13
@@ -1,104 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
- module WebObject
5
-
6
- def visible?
7
- web_object.displayed?
8
- end
9
-
10
- def exists?
11
- not web_object.nil?
12
- end
13
-
14
- def id
15
- web_object.attribute(:id)
16
- end
17
-
18
- def value
19
- web_object.attribute('value')
20
- end
21
-
22
- def tag
23
- web_object.tag_name
24
- end
25
-
26
- def flash
27
- original_color = attribute('backgroundColor')
28
- bridge = driver_bridge
29
- 10.times do |n|
30
- color = (n % 2 == 0) ? 'red' : original_color
31
- bridge.executeScript("arguments[0].style.backgroundColor = '#{color}'", web_object)
32
- end
33
- end
34
-
35
- def attribute(name)
36
- web_object.attribute(name)
37
- end
38
-
39
- def focus
40
- driver_bridge.executeScript("return arguments[0].focus()", web_object)
41
- end
42
-
43
- def wait_until(timeout=::Symbiont.element_level_wait, message=nil, &block)
44
- wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => message})
45
- wait.until &block
46
- end
47
-
48
- def when_actionable(timeout=::Symbiont.element_level_wait)
49
- wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Object not present in #{timeout} seconds"})
50
- wait.until do
51
- self.exists?
52
- end
53
- self
54
- end
55
-
56
- alias_method :when_present, :when_actionable
57
-
58
- def when_not_actionable(timeout=::Symbiont.element_level_wait)
59
- wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Object still present in #{timeout} seconds"})
60
- wait.until do
61
- not_present = false
62
- begin
63
- not_present = false if web_object and web_object.displayed?
64
- rescue Selenium::WebDriver::Error::ObsoleteElementError
65
- not_present = true
66
- end
67
- not_present
68
- end
69
- end
70
-
71
- alias_method :when_not_present, :when_not_actionable
72
-
73
- def when_visible(timeout=::Symbiont.element_level_wait)
74
- wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Object not visible in #{timeout} seconds"})
75
- wait.until do
76
- self.visible?
77
- end
78
- self
79
- end
80
-
81
- def when_not_visible(timeout=::Symbiont.element_level_wait)
82
- wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => "Object still visible in #{timeout} seconds"})
83
- wait.until do
84
- not self.visible?
85
- end
86
- self
87
- end
88
-
89
- alias_method :must_be_visible, :when_visible
90
- alias_method :must_not_be_visible, :when_not_visible
91
-
92
- def scroll_into_view(wait=2)
93
- sleep wait
94
- web_object.location_once_scrolled_into_view
95
- end
96
-
97
- def driver_bridge
98
- bridge = web_object.instance_variable_get(:@bridge)
99
- end
100
-
101
- end
102
- end
103
- end
104
- end
@@ -1,13 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
- module Link
5
-
6
- def value
7
- raise "Currently Selenium is not very good at grabbing the value from a link."
8
- end
9
-
10
- end
11
- end
12
- end
13
- end
@@ -1,21 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
- module Radio
5
-
6
- def select
7
- web_object.click unless selected?
8
- end
9
-
10
- def clear
11
- web_object.click if selected?
12
- end
13
-
14
- def selected?
15
- web_object.selected?
16
- end
17
-
18
- end
19
- end
20
- end
21
- end
@@ -1,79 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
- module SelectList
5
-
6
- # This method is used to return an Option object based on the index provided.
7
- # @return [Symbiont::WebObjects::Option]
8
- def [](idx)
9
- options[idx]
10
- #::Symbiont::WebObjects::Option.new(options[idx], :platform => :watir_webdriver)
11
- end
12
-
13
- # Selects an option from the select list.
14
- def select(value)
15
- find_options.find do |option|
16
- option.text == value
17
- end.click
18
- end
19
-
20
- # Selects the option whose value attribute matches the provided string.
21
- def select_value(value)
22
- options = find_options.find_all do |option|
23
- option.attribute('value') == value
24
- end
25
- options.each {|opt| opt.click}
26
- end
27
-
28
- # This method returns an array of Option objects that are contained within
29
- # a select list object.
30
- # @return [array of Symbiont::WebObjects::Option]
31
- def options
32
- find_options.map { |e| ::Symbiont::WebObjects::Option.new(e, :platform => :selenium_webdriver) }
33
- end
34
-
35
- # This method returns an array of strings that contain the text of the
36
- # currently selected options in a select list.
37
- # @return [Array<String>]
38
- def selected_options
39
- find_options.map { |e| e.text if e.selected? }.compact
40
- end
41
-
42
- # This method returns an array of strings that contain the values of the
43
- # currently selected options in a select list.
44
- # @return [Array<String>]
45
- def selected_values
46
- find_options.map { |e| e.attribute('value') if e.selected? }.compact
47
- end
48
-
49
- # This method returns true if any of the text or the lable of any option
50
- # that is selected matches the provided value.
51
- # @param [String, Regexp] value A value to check for
52
- # @return [Boolean]
53
- def selected?(value)
54
- selected = find_options.select { |e| e if e.selected? }
55
- selected.any? { |e| e.text == value }
56
- end
57
-
58
- # This method checks to see if the select list has one or more options
59
- # where the text or the label matches the provided value.
60
- # @param [String, Regexp] value A value to check for.
61
- # @return [Boolean]
62
- def include?(value)
63
- find_options.any? { |e| e.text == value }
64
- end
65
-
66
- def clear
67
- find_options.select { |e| e.selected? }.each { |o| o.click }
68
- end
69
-
70
- private
71
-
72
- def find_options
73
- web_object.find_elements(:xpath, option_xpath)
74
- end
75
-
76
- end
77
- end
78
- end
79
- end
@@ -1,40 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
- module Table
5
-
6
- # This method is used to return a TableRow object based on the index provided. When
7
- # the index provided is a string, the text will be matched with the text from the first
8
- # column.
9
- # @return [Symbiont::WebObjects::TableRow]
10
- def [](index)
11
- all_rows = table_rows
12
- index = find_by_title(index, all_rows) if index.kind_of?(String)
13
- return nil unless index
14
- ::Symbiont::WebObjects::TableRow.new(all_rows[index], :platform => :selenium_webdriver)
15
- end
16
-
17
- # This method will return the number of rows in a table.
18
- def rows
19
- table_rows.size
20
- end
21
-
22
- def find_by_title(row_text, all_rows)
23
- all_rows.find_index do |row|
24
- columns = row.find_elements(:xpath, ".//child::td|th")
25
- columns.any? { |col| col.text.include? row_text }
26
- end
27
- end
28
-
29
- def table_rows
30
- web_object.find_elements(:xpath, row_xpath)
31
- end
32
-
33
- def exists?
34
- raise "Currently Selenium is not very good at checking if a table exists."
35
- end
36
-
37
- end
38
- end
39
- end
40
- end
@@ -1,36 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
- module TableRow
5
-
6
- # This method is used to return a TableCell object based on the index provided. When
7
- # the index provided is a string, the text will be matched with the text from the
8
- # columns in the first row.
9
- # @return [Symbiont::WebObjects::TableCell]
10
- def [](index)
11
- all_cells = table_cells
12
- index = find_by_title(index) if index.kind_of?(String)
13
- return nil unless index && columns >= idx + 1
14
- ::Symbiont::WebObjects::TableCell.new(all_cells[index], :platform => :selenium_webdriver)
15
- end
16
-
17
- # This method returns the number of columns in a table object.
18
- def columns
19
- table_cells.size
20
- end
21
-
22
- def find_by_title(column_text)
23
- table = parent
24
- parent_tag = parent.web_object.tag_name
25
- table = table.parent if (parent_tag == 'tbody' || parent_tag == 'thead')
26
- table[0].find_index { |column| column.text.include? column_text }
27
- end
28
-
29
- def table_cells
30
- web_object.find_elements(:xpath, cell_xpath)
31
- end
32
-
33
- end
34
- end
35
- end
36
- end
@@ -1,14 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
- module TextField
5
-
6
- def value=(value)
7
- web_object.clear
8
- web_object.send_keys(value)
9
- end
10
-
11
- end
12
- end
13
- end
14
- end
@@ -1,18 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module SeleniumWebDriver
4
-
5
- def self.create_platform_object_for(browser)
6
- require_relative 'platform_selenium/platform_object'
7
- SeleniumWebDriver::PlatformObject.new(browser)
8
- end
9
-
10
- def self.works_with(browser)
11
- browser.is_a?(::Selenium::WebDriver::Driver)
12
- end
13
-
14
- end
15
- end
16
- end
17
-
18
- Symbiont::Platforms.register(:selenium_webdriver, Symbiont::Platforms::SeleniumWebDriver)
@@ -1,21 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module WatirWebDriver
4
- module CheckBox
5
-
6
- def check
7
- web_object.set
8
- end
9
-
10
- def uncheck
11
- web_object.clear
12
- end
13
-
14
- def checked?
15
- web_object.set?
16
- end
17
-
18
- end
19
- end
20
- end
21
- end
@@ -1,82 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module WatirWebDriver
4
- module WebObject
5
-
6
- def visible?
7
- web_object.present?
8
- end
9
-
10
- def exists?
11
- web_object.exists?
12
- end
13
-
14
- def id
15
- web_object.id
16
- end
17
-
18
- def value
19
- web_object.value
20
- end
21
-
22
- def flash
23
- web_object.flash
24
- end
25
-
26
- def attribute(name)
27
- web_object.attribute_value(name)
28
- end
29
-
30
- def focus
31
- web_object.focus
32
- end
33
-
34
- def parent
35
- parent = web_object.parent
36
- type = web_object.type if parent.tag_name.to_sym == :input
37
- object_class = ::Symbiont::WebObjects.get_class_for(parent.tag_name, type)
38
- object_class.new(parent, :platform => :watir_webdriver)
39
- end
40
-
41
- def wait_until(timeout=::Symbiont.element_level_wait, message=nil, &block)
42
- Object::Watir::Wait.until(timeout, message, &block)
43
- end
44
-
45
- def when_actionable(timeout=::Symbiont.element_level_wait)
46
- web_object.wait_until_present(timeout)
47
- self
48
- end
49
-
50
- alias_method :when_present, :when_actionable
51
-
52
- def when_not_actionable(timeout=::Symbiont.element_level_wait)
53
- web_object.wait_while_present(timeout)
54
- end
55
-
56
- alias_method :when_not_present, :when_not_actionable
57
-
58
- def when_visible(timeout=::Symbiont.element_level_wait)
59
- Object::Watir::Wait.until(timeout, "Object not visible within #{timeout} seconds.") do
60
- visible?
61
- end
62
- self
63
- end
64
-
65
- def when_not_visible(timeout=::Symbiont.element_level_wait)
66
- Object::Watir::Wait.while(timeout, "Object still visible after #{timeout} seconds.") do
67
- visible?
68
- end
69
- self
70
- end
71
-
72
- alias_method :must_be_visible, :when_visible
73
- alias_method :must_not_be_visible, :when_not_visible
74
-
75
- def scroll_into_view(wait=2)
76
- sleep wait
77
- web_object.wd.location_once_scrolled_into_view
78
- end
79
- end
80
- end
81
- end
82
- end
@@ -1,21 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module WatirWebDriver
4
- module Radio
5
-
6
- def select
7
- web_object.set
8
- end
9
-
10
- def clear
11
- web_object.clear
12
- end
13
-
14
- def selected?
15
- web_object.set?
16
- end
17
-
18
- end
19
- end
20
- end
21
- end
@@ -1,67 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module WatirWebDriver
4
- module SelectList
5
-
6
- # This method is used to return an Option object based on the index provided.
7
- # @return [Symbiont::WebObjects::Option]
8
- def [](idx)
9
- ::Symbiont::WebObjects::Option.new(options[idx], :platform => :watir_webdriver)
10
- end
11
-
12
- # Selects an option from the select list.
13
- def select(value)
14
- web_object.select(value)
15
- end
16
-
17
- # Selects the option whose value attribute matches the provided string.
18
- def select_value(value)
19
- web_object.select_value(value)
20
- end
21
-
22
- # This method returns an array of Option objects that are contained within
23
- # a select list object.
24
- # @return [array of Symbiont::WebObjects::Option]
25
- def options
26
- web_objects = []
27
- options = web_object.wd.find_elements(:xpath, option_xpath)
28
- options.each do |opt|
29
- web_objects << ::Symbiont::WebObjects::Option.new(opt, :platform => :watir_webdriver)
30
- end
31
- web_objects
32
- end
33
-
34
- # This method returns an array of strings that contain the text of the
35
- # currently selected options in a select list.
36
- # @return [Array<String>]
37
- def selected_options
38
- web_object.selected_options.map { |e| e.text }.compact
39
- end
40
-
41
- # This method returns an array of strings that contain the values of the
42
- # currently selected options in a select list.
43
- # @return [Array<String>]
44
- def selected_values
45
- web_object.selected_options.map { |e| e.value }.compact
46
- end
47
-
48
- # This method returns true if any of the text or the lable of any option
49
- # that is selected matches the provided value.
50
- # @param [String, Regexp] value A value to check for
51
- # @return [Boolean]
52
- def selected?(value)
53
- web_object.selected? value
54
- end
55
-
56
- # This method checks to see if the select list has one or more options
57
- # where the text or the label matches the provided value.
58
- # @param [String, Regexp] value A value to check for.
59
- # @return [Boolean]
60
- def include?(value)
61
- web_object.include? value
62
- end
63
-
64
- end
65
- end
66
- end
67
- end
@@ -1,31 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module WatirWebDriver
4
- module Table
5
-
6
- # This method is used to return a TableRow object based on the index provided. When
7
- # the index provided is a string, the text will be matched with the text from the first
8
- # column.
9
- # @return [Symbiont::WebObjects::TableRow]
10
- def [](index)
11
- index = find_by_title(index) if index.kind_of?(String)
12
- return nil unless index
13
- ::Symbiont::WebObjects::TableRow.new(@web_object[index], :platform => :watir_webdriver)
14
- end
15
-
16
- # This method will return the number of rows in a table.
17
- def rows
18
- web_object.wd.find_elements(:xpath, row_xpath).size
19
- end
20
-
21
- def find_by_title(row_text)
22
- #web_object.rows.find_index {|row| row[0].text == row_text}
23
- web_object.rows.find_index do |row|
24
- row.cells.any? { |col| col.text.include? row_text }
25
- end
26
- end
27
-
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module WatirWebDriver
4
- module TableRow
5
-
6
- # This method is used to return a TableCell object based on the index provided. When
7
- # the index provided is a string, the text will be matched with the text from the
8
- # columns in the first row.
9
- # @return [Symbiont::WebObjects::TableCell]
10
- def [](index)
11
- index = find_by_title(index) if index.kind_of?(String)
12
- return nil unless index && columns >= idx + 1
13
- ::Symbiont::WebObjects::TableCell.new(web_object[index], :platform => :watir_webdriver)
14
- end
15
-
16
- # This method returns the number of columns in a table object.
17
- def columns
18
- web_object.wd.find_elements(:xpath, cell_xpath).size
19
- end
20
-
21
- def find_by_title(column_text)
22
- table = web_object.parent
23
- table = table.parent if table.tag_name == 'tbody'
24
- first_row = table[0]
25
- first_row.cells.find_index {|column| column.text.include? column_text}
26
- end
27
-
28
- end
29
- end
30
- end
31
- end
@@ -1,13 +0,0 @@
1
- module Symbiont
2
- module Platforms
3
- module WatirWebDriver
4
- module TextField
5
-
6
- def value=(value)
7
- web_object.set value
8
- end
9
-
10
- end
11
- end
12
- end
13
- end