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
@@ -3,30 +3,24 @@ module Symbiont
3
3
 
4
4
  class Radio < WebObject
5
5
 
6
- def initialize(web_object, platform)
6
+ def initialize(web_object)
7
7
  @web_object = web_object
8
- include_platform_specifics_for(platform)
9
8
  end
10
9
 
11
- def self.usable_selectors_for_watir
10
+ def self.usable_selectors
12
11
  super + [:value]
13
12
  end
14
13
 
15
- def self.usable_selectors_for_selenium
16
- super + [:value]
14
+ def select
15
+ web_object.set
16
+ end
17
+
18
+ def clear
19
+ web_object.clear
17
20
  end
18
21
 
19
- def include_platform_specifics_for(platform)
20
- super
21
- if platform[:platform] == :watir_webdriver
22
- require 'symbiont/platform_watir/web_objects/radio'
23
- self.class.send :include, Symbiont::Platforms::WatirWebDriver::Radio
24
- elsif platform[:platform] == :selenium_webdriver
25
- require 'symbiont/platform_selenium/web_objects/radio'
26
- self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::Radio
27
- else
28
- raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
29
- end
22
+ def selected?
23
+ web_object.set?
30
24
  end
31
25
 
32
26
  end # class: Radio
@@ -2,33 +2,78 @@ module Symbiont
2
2
  module WebObjects
3
3
 
4
4
  class SelectList < WebObject
5
- def initialize(web_object, platform)
5
+ def initialize(web_object)
6
6
  @web_object = web_object
7
- include_platform_specifics_for(platform)
8
7
  end
9
8
 
10
- def self.usable_selectors_for_watir
9
+ def self.usable_selectors
11
10
  super + [:value, :text]
12
11
  end
13
12
 
13
+ # This method is used to return an Option object based on the index provided.
14
+ # @return [Symbiont::WebObjects::Option]
15
+ def [](idx)
16
+ ::Symbiont::WebObjects::Option.new(options[idx])
17
+ end
18
+
19
+ # Selects an option from the select list.
20
+ def select(value)
21
+ web_object.select(value)
22
+ end
23
+
24
+ # Selects the option whose value attribute matches the provided string.
25
+ def select_value(value)
26
+ web_object.select_value(value)
27
+ end
28
+
29
+ # This method returns an array of Option objects that are contained within
30
+ # a select list object.
31
+ # @return [array of Symbiont::WebObjects::Option]
32
+ def options
33
+ web_objects = []
34
+ options = web_object.wd.find_elements(:xpath, option_xpath)
35
+ options.each do |opt|
36
+ web_objects << ::Symbiont::WebObjects::Option.new(opt)
37
+ end
38
+ web_objects
39
+ end
40
+
41
+ # This method returns an array of strings that contain the text of the
42
+ # currently selected options in a select list.
43
+ # @return [Array<String>]
44
+ def selected_options
45
+ web_object.selected_options.map { |e| e.text }.compact
46
+ end
47
+
48
+ # This method returns an array of strings that contain the values of the
49
+ # currently selected options in a select list.
50
+ # @return [Array<String>]
51
+ def selected_values
52
+ web_object.selected_options.map { |e| e.value }.compact
53
+ end
54
+
55
+ # This method returns true if any of the text or the label of any option
56
+ # that is selected matches the provided value.
57
+ # @param [String, Regexp] value A value to check for
58
+ # @return [Boolean]
59
+ def selected?(value)
60
+ web_object.selected? value
61
+ end
62
+
63
+ # This method checks to see if the select list has one or more options
64
+ # where the text or the label matches the provided value.
65
+ # @param [String, Regexp] value A value to check for.
66
+ # @return [Boolean]
67
+ def include?(value)
68
+ web_object.include? value
69
+ end
70
+
14
71
  protected
15
72
 
16
73
  def option_xpath
17
74
  ".//child::option"
18
75
  end
19
76
 
20
- def include_platform_specifics_for(platform)
21
- super
22
- if platform[:platform] == :watir_webdriver
23
- require 'symbiont/platform_watir/web_objects/select_list'
24
- self.class.send :include, Symbiont::Platforms::WatirWebDriver::SelectList
25
- elsif platform[:platform] == :selenium_webdriver
26
- require 'symbiont/platform_selenium/web_objects/select_list'
27
- self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::SelectList
28
- else
29
- raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
30
- end
31
- end
32
77
  end # class: SelectList
33
78
 
34
79
  ::Symbiont::WebObjects.class_for_tag[:select] = ::Symbiont::WebObjects::SelectList
@@ -3,11 +3,7 @@ module Symbiont
3
3
 
4
4
  class Span < WebObject
5
5
 
6
- def self.usable_selectors_for_watir
7
- super + [:text, :title]
8
- end
9
-
10
- def self.usable_selectors_for_selenium
6
+ def self.usable_selectors
11
7
  super + [:text, :title]
12
8
  end
13
9
 
@@ -4,9 +4,18 @@ module Symbiont
4
4
  class Table < WebObject
5
5
  include Enumerable
6
6
 
7
- def initialize(web_object, platform)
7
+ def initialize(web_object)
8
8
  @web_object = web_object
9
- include_platform_specifics_for(platform)
9
+ end
10
+
11
+ # This method is used to return a TableRow object based on the index provided. When
12
+ # the index provided is a string, the text will be matched with the text from the first
13
+ # column.
14
+ # @return [Symbiont::WebObjects::TableRow]
15
+ def [](index)
16
+ index = find_by_title(index) if index.kind_of?(String)
17
+ return nil unless index
18
+ ::Symbiont::WebObjects::TableRow.new(web_object[index])
10
19
  end
11
20
 
12
21
  # This method is an iterator that returns a TableRow object each time through
@@ -18,6 +27,11 @@ module Symbiont
18
27
  end
19
28
  end
20
29
 
30
+ # This method will return the number of rows in a table.
31
+ def rows
32
+ web_object.wd.find_elements(:xpath, row_xpath).size
33
+ end
34
+
21
35
  # Returns a reference to the first row web object of a table.
22
36
  # @return [Symbiont::WebObjects::TableRow]
23
37
  def first_row
@@ -36,16 +50,12 @@ module Symbiont
36
50
  ".//child::tr"
37
51
  end
38
52
 
39
- def include_platform_specifics_for(platform)
40
- super
41
- if platform[:platform] == :watir_webdriver
42
- require 'symbiont/platform_watir/web_objects/table'
43
- self.class.send :include, Symbiont::Platforms::WatirWebDriver::Table
44
- elsif platform[:platform] == :selenium_webdriver
45
- require 'symbiont/platform_selenium/web_objects/table'
46
- self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::Table
47
- else
48
- raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
53
+ private
54
+
55
+ def find_by_title(row_text)
56
+ #web_object.rows.find_index {|row| row[0].text == row_text}
57
+ web_object.rows.find_index do |row|
58
+ row.cells.any? { |col| col.text.include? row_text }
49
59
  end
50
60
  end
51
61
 
@@ -3,7 +3,7 @@ module Symbiont
3
3
 
4
4
  class TableCell < WebObject
5
5
 
6
- def initialize(web_object, platform)
6
+ def initialize(web_object)
7
7
  @web_object = web_object
8
8
  end
9
9
 
@@ -11,11 +11,7 @@ module Symbiont
11
11
  true
12
12
  end
13
13
 
14
- def self.usable_selectors_for_watir
15
- super + [:text]
16
- end
17
-
18
- def self.usable_selectors_for_selenium
14
+ def self.usable_selectors
19
15
  super + [:text]
20
16
  end
21
17
 
@@ -4,9 +4,18 @@ module Symbiont
4
4
  class TableRow < WebObject
5
5
  include Enumerable
6
6
 
7
- def initialize(web_object, platform)
7
+ def initialize(web_object)
8
8
  @web_object = web_object
9
- include_platform_specifics_for(platform)
9
+ end
10
+
11
+ # This method is used to return a TableCell object based on the index provided. When
12
+ # the index provided is a string, the text will be matched with the text from the
13
+ # columns in the first row.
14
+ # @return [Symbiont::WebObjects::TableCell]
15
+ def [](index)
16
+ index = find_by_title(index) if index.kind_of?(String)
17
+ return nil unless index && columns >= index + 1
18
+ ::Symbiont::WebObjects::TableCell.new(web_object[index])
10
19
  end
11
20
 
12
21
  # This method is an iterator that returns a TableCell object each time through
@@ -18,24 +27,26 @@ module Symbiont
18
27
  end
19
28
  end
20
29
 
30
+ # This method returns the number of columns in a table object.
31
+ def columns
32
+ web_object.wd.find_elements(:xpath, cell_xpath).size
33
+ end
34
+
21
35
  protected
22
36
 
23
37
  def cell_xpath
24
38
  ".//child::td|th"
25
39
  end
26
40
 
27
- def include_platform_specifics_for(platform)
28
- super
29
- if platform[:platform] == :watir_webdriver
30
- require 'symbiont/platform_watir/web_objects/table_row'
31
- self.class.send :include, Symbiont::Platforms::WatirWebDriver::TableRow
32
- elsif platform[:platform] == :selenium_webdriver
33
- require 'symbiont/platform_selenium/web_objects/table_row'
34
- self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::TableRow
35
- else
36
- raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
37
- end
41
+ private
42
+
43
+ def find_by_title(column_text)
44
+ table = web_object.parent
45
+ table = table.parent if table.tag_name == 'tbody'
46
+ first_row = table[0]
47
+ first_row.cells.find_index {|column| column.text.include? column_text}
38
48
  end
49
+
39
50
  end # class: TableRow
40
51
 
41
52
  ::Symbiont::WebObjects.class_for_tag[:tr] = ::Symbiont::WebObjects::TableRow
@@ -2,39 +2,30 @@ module Symbiont
2
2
  module WebObjects
3
3
 
4
4
  class TextField < WebObject
5
- def initialize(web_object, platform)
5
+ def initialize(web_object)
6
6
  @web_object = web_object
7
- include_platform_specifics_for(platform)
8
7
  end
9
8
 
10
- def append(text)
11
- web_object.send_keys text
9
+ def value
10
+ web_object.value
12
11
  end
13
12
 
14
- def self.usable_selectors_for_watir
15
- super + [:title, :value, :text, :label]
13
+ def value=(value)
14
+ web_object.set value
16
15
  end
17
16
 
18
- def self.usable_selectors_for_selenium
19
- super + [:title, :value, :text, :label]
17
+ def append(text)
18
+ web_object.send_keys text
20
19
  end
21
20
 
22
- def include_platform_specifics_for(platform)
23
- super
24
- if platform[:platform] == :watir_webdriver
25
- require 'symbiont/platform_watir/web_objects/text_field'
26
- self.class.send :include, Symbiont::Platforms::WatirWebDriver::TextField
27
- elsif platform[:platform] == :selenium_webdriver
28
- require 'symbiont/platform_selenium/web_objects/text_field'
29
- self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::TextField
30
- else
31
- raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
32
- end
21
+ def self.usable_selectors
22
+ super + [:title, :value, :text, :label]
33
23
  end
34
24
 
35
25
  end # class: TextField
36
26
 
37
27
  ::Symbiont::WebObjects.class_for_type[:text] = ::Symbiont::WebObjects::TextField
38
28
  ::Symbiont::WebObjects.class_for_type[:password] = ::Symbiont::WebObjects::TextField
29
+
39
30
  end # module: WebObjects
40
31
  end # module: Symbiont
@@ -16,7 +16,7 @@ module Symbiont
16
16
  end
17
17
  end
18
18
 
19
- end # module: WebObjects
20
- end # module: Symbiont
19
+ end
20
+ end
21
21
 
22
22
  require 'symbiont/web_objects/_common'
data/lib/symbiont.rb CHANGED
@@ -14,9 +14,11 @@ module Symbiont
14
14
  include Evaluators
15
15
  include Locators
16
16
  include DataSetter
17
-
17
+
18
+ # Used to make a platform object accessible. Will hold object
19
+ # references like these:
20
+ # <Symbiont::Platforms::WatirWebDriver::PlatformObject:0x2cbe8a0>
18
21
  attr_reader :platform
19
- attr_reader :browser
20
22
 
21
23
  def self.version
22
24
  "Symbiont v#{Symbiont::VERSION}"
@@ -39,12 +41,20 @@ module Symbiont
39
41
  @page_wait ||= 15
40
42
  end
41
43
 
44
+ def self.page_level_wait=(value)
45
+ @page_wait = value
46
+ end
47
+
42
48
  # Returns the default wait value for elements on a page. This value is
43
49
  # the default value beyond which a timeout is assumed.
44
50
  def self.element_level_wait
45
51
  @element_wait ||= 5
46
52
  end
47
53
 
54
+ def self.element_level_wait=(value)
55
+ @element_wait = value
56
+ end
57
+
48
58
  # The initialize method will be invoked when a page definition includes
49
59
  # Symbiont. Some key things are happening here that are critical to
50
60
  # Symbiont working correctly:
@@ -69,7 +79,7 @@ module Symbiont
69
79
  #
70
80
  # @param [Object] browser a browser instance with a tool driver
71
81
  def establish_platform_object_for(browser)
72
- @platform = get_platform_for(browser, Symbiont::Platforms.list)
82
+ @platform = get_platform_for(browser)
73
83
  end
74
84
 
75
85
  end
data/spec/spec_helper.rb CHANGED
@@ -28,6 +28,7 @@ class DefinitionTest
28
28
  radio :include_tax, id: "includeTax"
29
29
  table :accounts, id: "accounts"
30
30
  cell :totalValue, id: "totalValue"
31
+ paragraph :intro, id: "intro"
31
32
  div :section, id: "section"
32
33
  span :inline, id: "inline"
33
34
 
@@ -8,6 +8,9 @@ describe Symbiont::Enclosers do
8
8
  it "should allow frames to act as a context" do
9
9
  watir_browser.should_receive(:frame).with(id: "frame").and_return(watir_browser)
10
10
  watir_browser.should_receive(:text_field).and_return(watir_browser)
11
+ watir_browser.should_receive(:wd).and_return(watir_browser)
12
+ watir_browser.should_receive(:switch_to).and_return(watir_browser)
13
+ watir_browser.should_receive(:default_content).and_return(watir_browser)
11
14
  web_object = watir_definition.framedLoginName_text_field
12
15
  web_object.should_not be_nil
13
16
  web_object.should be_instance_of Symbiont::WebObjects::TextField
@@ -65,6 +65,11 @@ describe Symbiont::Enclosers do
65
65
  watir_browser.should_receive(:execute_script).with('return jQuery.active').and_return(1)
66
66
  expect { watir_definition.wait_for_pending_requests(1) }.to raise_error
67
67
  end
68
+
69
+ it "should be able to go back to a previous page" do
70
+ watir_browser.should_receive(:back)
71
+ watir_definition.back
72
+ end
68
73
  end
69
74
  end
70
75
  end
@@ -52,7 +52,7 @@ describe Symbiont::Generators do
52
52
 
53
53
  it "should determine if a button is visible" do
54
54
  watir_browser.should_receive(:button).twice.and_return(watir_browser)
55
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
55
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
56
56
  watir_definition.submit_?.should be_true
57
57
  watir_definition.submit_visible?.should be_true
58
58
  end
@@ -37,7 +37,7 @@ describe Symbiont::Generators do
37
37
 
38
38
  it "should determine if a table cell is visible" do
39
39
  watir_browser.should_receive(:td).twice.and_return(watir_browser)
40
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
40
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
41
41
  watir_definition.totalValue_visible?.should be_true
42
42
  watir_definition.totalValue_?.should be_true
43
43
  end
@@ -41,7 +41,7 @@ describe Symbiont::Generators do
41
41
 
42
42
  it "should determine if a checkbox is visible" do
43
43
  watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
44
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
44
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
45
45
  watir_definition.apply_tax_visible?.should be_true
46
46
  watir_definition.apply_tax_?.should be_true
47
47
  end
@@ -37,12 +37,12 @@ describe Symbiont::Generators do
37
37
 
38
38
  it "should determine if a div is visible" do
39
39
  watir_browser.should_receive(:div).twice.and_return(watir_browser)
40
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
40
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
41
41
  watir_definition.section_visible?.should be_true
42
42
  watir_definition.section_?.should be_true
43
43
  end
44
44
 
45
- it "should return the text of a span" do
45
+ it "should return the text of a div" do
46
46
  watir_browser.should_receive(:div).and_return(watir_browser)
47
47
  watir_browser.should_receive(:text).and_return("testing")
48
48
  watir_definition.section.should == "testing"
@@ -49,7 +49,7 @@ describe Symbiont::Generators do
49
49
 
50
50
  it "should determine if a link is visible" do
51
51
  watir_browser.should_receive(:link).twice.and_return(watir_browser)
52
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
52
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
53
53
  watir_definition.reset_password_visible?.should be_true
54
54
  watir_definition.reset_password_?.should be_true
55
55
  end
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe Symbiont::Generators do
4
+ let(:watir_browser) { mock_browser_for_watir }
5
+ let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
+
7
+ describe "paragraph web objects" do
8
+ context "when declared in a definition" do
9
+ it "should generate methods for referencing the paragraph" do
10
+ watir_definition.should respond_to(:intro_paragraph)
11
+ watir_definition.should respond_to(:intro_object)
12
+ end
13
+
14
+ it "should generate methods for interacting with the paragraph" do
15
+ watir_definition.should respond_to(:intro_exists?)
16
+ watir_definition.should respond_to(:intro_visible?)
17
+ watir_definition.should respond_to(:intro?)
18
+ watir_definition.should respond_to(:intro_?)
19
+ watir_definition.should respond_to(:intro)
20
+ end
21
+ end
22
+
23
+ context "when used by the watir platform" do
24
+ it "should locate the paragraph" do
25
+ watir_browser.should_receive(:p).and_return(watir_browser)
26
+ web_object = watir_definition.intro_paragraph
27
+ web_object.should_not be_nil
28
+ web_object.should be_instance_of Symbiont::WebObjects::Paragraph
29
+ end
30
+
31
+ it "should determine if a paragraph exists" do
32
+ watir_browser.should_receive(:p).twice.and_return(watir_browser)
33
+ watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
34
+ watir_definition.intro_exists?.should be_true
35
+ watir_definition.intro?.should be_true
36
+ end
37
+
38
+ it "should determine if a paragraph is visible" do
39
+ watir_browser.should_receive(:p).twice.and_return(watir_browser)
40
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
41
+ watir_definition.intro_visible?.should be_true
42
+ watir_definition.intro_?.should be_true
43
+ end
44
+
45
+ it "should return the text of a paragraph" do
46
+ watir_browser.should_receive(:p).and_return(watir_browser)
47
+ watir_browser.should_receive(:text).and_return("testing")
48
+ watir_definition.intro.should == "testing"
49
+ end
50
+ end
51
+ end
52
+ end
@@ -8,7 +8,6 @@ describe Symbiont::Generators do
8
8
  context "when declared in a definition" do
9
9
  it "should generate methods for referencing the radio" do
10
10
  watir_definition.should respond_to(:include_tax_radio)
11
- watir_definition.should respond_to(:include_tax_radio_button)
12
11
  watir_definition.should respond_to(:include_tax_object)
13
12
  end
14
13
 
@@ -42,7 +41,7 @@ describe Symbiont::Generators do
42
41
 
43
42
  it "should determine if a radio is visible" do
44
43
  watir_browser.should_receive(:radio).twice.and_return(watir_browser)
45
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
44
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
46
45
  watir_definition.include_tax_visible?.should be_true
47
46
  watir_definition.include_tax_?.should be_true
48
47
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Symbiont::Generators do
4
4
  let(:watir_browser) { mock_browser_for_watir }
5
5
  let(:watir_definition) { DefinitionTest.new(watir_browser) }
6
-
6
+
7
7
  describe "select list web objects" do
8
8
  context "when declared in a definition" do
9
9
  it "should generate methods for referencing the select list" do
@@ -51,7 +51,7 @@ describe Symbiont::Generators do
51
51
  watir_browser.should_receive(:select).with("testing")
52
52
  watir_definition.concepts = "testing"
53
53
  end
54
-
54
+
55
55
  it "should determine if a select list exists" do
56
56
  watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
57
57
  watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
@@ -61,7 +61,7 @@ describe Symbiont::Generators do
61
61
 
62
62
  it "should determine if a select list is visible" do
63
63
  watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
64
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
64
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
65
65
  watir_definition.concepts_visible?.should be_true
66
66
  watir_definition.concepts_?.should be_true
67
67
  end
@@ -37,7 +37,7 @@ describe Symbiont::Generators do
37
37
 
38
38
  it "should determine if a span is visible" do
39
39
  watir_browser.should_receive(:span).twice.and_return(watir_browser)
40
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
40
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
41
41
  watir_definition.inline_visible?.should be_true
42
42
  watir_definition.inline_?.should be_true
43
43
  end
@@ -16,6 +16,7 @@ describe Symbiont::Generators do
16
16
  watir_definition.should respond_to(:accounts?)
17
17
  watir_definition.should respond_to(:accounts_visible?)
18
18
  watir_definition.should respond_to(:accounts_?)
19
+ watir_definition.should respond_to(:accounts)
19
20
  end
20
21
  end
21
22
 
@@ -36,10 +37,16 @@ describe Symbiont::Generators do
36
37
 
37
38
  it "should determine if a table is visible" do
38
39
  watir_browser.should_receive(:table).twice.and_return(watir_browser)
39
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
40
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
40
41
  watir_definition.accounts_visible?.should be_true
41
42
  watir_definition.accounts_?.should be_true
42
43
  end
44
+
45
+ it "should return the text of a table" do
46
+ watir_browser.should_receive(:table).and_return(watir_browser)
47
+ watir_browser.should_receive(:text).and_return("testing")
48
+ watir_definition.accounts.should == "testing"
49
+ end
43
50
  end
44
51
  end
45
52
  end
@@ -52,7 +52,7 @@ describe Symbiont::Generators do
52
52
 
53
53
  it "should determine if a text field is visible" do
54
54
  watir_browser.should_receive(:text_field).twice.and_return(watir_browser)
55
- watir_browser.should_receive(:visible?).twice.and_return(watir_browser)
55
+ watir_browser.should_receive(:present?).twice.and_return(watir_browser)
56
56
  watir_definition.login_name_visible?.should be_true
57
57
  watir_definition.login_name_?.should be_true
58
58
  end
@@ -14,4 +14,14 @@ describe Symbiont do
14
14
  Symbiont.instance_variable_set("@page_wait", nil)
15
15
  Symbiont.page_level_wait.should == 15
16
16
  end
17
+
18
+ it "should provide an element level wait default" do
19
+ Symbiont.instance_variable_set("@element_wait", 5)
20
+ Symbiont.element_level_wait.should == 5
21
+ end
22
+
23
+ it "should set the element level wait default to 5" do
24
+ Symbiont.instance_variable_set("@element_wait", nil)
25
+ Symbiont.element_level_wait.should == 5
26
+ end
17
27
  end