watir 6.13.0 → 6.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +141 -0
  3. data/.travis.yml +6 -0
  4. data/CHANGES.md +12 -0
  5. data/Gemfile +4 -10
  6. data/README.md +64 -49
  7. data/Rakefile +28 -16
  8. data/lib/watir.rb +13 -15
  9. data/lib/watir/adjacent.rb +15 -13
  10. data/lib/watir/after_hooks.rb +8 -10
  11. data/lib/watir/alert.rb +7 -8
  12. data/lib/watir/aliases.rb +2 -2
  13. data/lib/watir/attribute_helper.rb +18 -20
  14. data/lib/watir/browser.rb +42 -75
  15. data/lib/watir/capabilities.rb +19 -10
  16. data/lib/watir/cell_container.rb +0 -2
  17. data/lib/watir/container.rb +4 -4
  18. data/lib/watir/cookies.rb +7 -8
  19. data/lib/watir/element_collection.rb +37 -22
  20. data/lib/watir/elements/area.rb +0 -2
  21. data/lib/watir/elements/button.rb +1 -3
  22. data/lib/watir/elements/cell.rb +0 -1
  23. data/lib/watir/elements/checkbox.rb +5 -7
  24. data/lib/watir/elements/date_field.rb +5 -9
  25. data/lib/watir/elements/date_time_field.rb +6 -10
  26. data/lib/watir/elements/dlist.rb +2 -4
  27. data/lib/watir/elements/element.rb +201 -99
  28. data/lib/watir/elements/file_field.rb +3 -4
  29. data/lib/watir/elements/font.rb +2 -4
  30. data/lib/watir/elements/form.rb +0 -2
  31. data/lib/watir/elements/hidden.rb +3 -4
  32. data/lib/watir/elements/html_elements.rb +24 -76
  33. data/lib/watir/elements/iframe.rb +57 -71
  34. data/lib/watir/elements/image.rb +3 -4
  35. data/lib/watir/elements/input.rb +0 -2
  36. data/lib/watir/elements/link.rb +2 -5
  37. data/lib/watir/elements/list.rb +4 -4
  38. data/lib/watir/elements/option.rb +3 -6
  39. data/lib/watir/elements/radio.rb +4 -6
  40. data/lib/watir/elements/row.rb +0 -1
  41. data/lib/watir/elements/select.rb +41 -43
  42. data/lib/watir/elements/svg_elements.rb +0 -116
  43. data/lib/watir/elements/table.rb +1 -2
  44. data/lib/watir/elements/table_cell.rb +2 -3
  45. data/lib/watir/elements/text_field.rb +4 -6
  46. data/lib/watir/exception.rb +0 -1
  47. data/lib/watir/extensions/nokogiri.rb +2 -4
  48. data/lib/watir/generator.rb +3 -3
  49. data/lib/watir/generator/base.rb +10 -10
  50. data/lib/watir/generator/base/generator.rb +26 -29
  51. data/lib/watir/generator/base/idl_sorter.rb +34 -32
  52. data/lib/watir/generator/base/spec_extractor.rb +132 -114
  53. data/lib/watir/generator/base/util.rb +1 -3
  54. data/lib/watir/generator/base/visitor.rb +140 -140
  55. data/lib/watir/generator/html.rb +4 -4
  56. data/lib/watir/generator/html/generator.rb +2 -4
  57. data/lib/watir/generator/html/spec_extractor.rb +33 -33
  58. data/lib/watir/generator/html/visitor.rb +14 -14
  59. data/lib/watir/generator/svg.rb +3 -3
  60. data/lib/watir/generator/svg/generator.rb +1 -3
  61. data/lib/watir/generator/svg/spec_extractor.rb +35 -35
  62. data/lib/watir/generator/svg/visitor.rb +14 -14
  63. data/lib/watir/has_window.rb +2 -4
  64. data/lib/watir/js_execution.rb +7 -9
  65. data/lib/watir/js_snippets.rb +3 -3
  66. data/lib/watir/js_snippets/attributeValues.js +11 -0
  67. data/lib/watir/legacy_wait.rb +7 -12
  68. data/lib/watir/locators.rb +9 -11
  69. data/lib/watir/locators/button/locator.rb +2 -3
  70. data/lib/watir/locators/button/selector_builder.rb +9 -9
  71. data/lib/watir/locators/button/selector_builder/xpath.rb +1 -1
  72. data/lib/watir/locators/button/validator.rb +2 -2
  73. data/lib/watir/locators/cell/locator.rb +0 -2
  74. data/lib/watir/locators/cell/selector_builder.rb +3 -5
  75. data/lib/watir/locators/element/locator.rb +85 -64
  76. data/lib/watir/locators/element/selector_builder.rb +40 -38
  77. data/lib/watir/locators/element/selector_builder/xpath.rb +20 -18
  78. data/lib/watir/locators/element/validator.rb +1 -1
  79. data/lib/watir/locators/row/locator.rb +0 -2
  80. data/lib/watir/locators/row/selector_builder.rb +6 -9
  81. data/lib/watir/locators/text_area/selector_builder.rb +1 -1
  82. data/lib/watir/locators/text_field/locator.rb +1 -3
  83. data/lib/watir/locators/text_field/selector_builder.rb +5 -5
  84. data/lib/watir/locators/text_field/selector_builder/xpath.rb +1 -1
  85. data/lib/watir/locators/text_field/validator.rb +3 -2
  86. data/lib/watir/logger.rb +11 -21
  87. data/lib/watir/navigation.rb +49 -0
  88. data/lib/watir/radio_set.rb +17 -18
  89. data/lib/watir/row_container.rb +3 -5
  90. data/lib/watir/screenshot.rb +2 -4
  91. data/lib/watir/user_editable.rb +13 -8
  92. data/lib/watir/version.rb +3 -0
  93. data/lib/watir/wait.rb +56 -55
  94. data/lib/watir/wait/timer.rb +1 -3
  95. data/lib/watir/window.rb +36 -45
  96. data/lib/watir/xpath_support.rb +1 -3
  97. data/lib/watirspec.rb +11 -11
  98. data/lib/watirspec/guards.rb +10 -7
  99. data/lib/watirspec/implementation.rb +3 -4
  100. data/lib/watirspec/rake_tasks.rb +30 -29
  101. data/lib/watirspec/remote_server.rb +3 -3
  102. data/lib/watirspec/runner.rb +1 -2
  103. data/lib/watirspec/server.rb +3 -0
  104. data/lib/watirspec/server/app.rb +14 -6
  105. data/spec/implementation_spec.rb +9 -9
  106. data/spec/locator_spec_helper.rb +3 -4
  107. data/spec/spec_helper.rb +3 -7
  108. data/spec/unit/container_spec.rb +9 -10
  109. data/spec/unit/element_locator_spec.rb +224 -219
  110. data/spec/unit/logger_spec.rb +4 -4
  111. data/spec/unit/unit_helper.rb +0 -2
  112. data/spec/unit/wait_spec.rb +26 -28
  113. data/spec/watirspec/adjacent_spec.rb +130 -130
  114. data/spec/watirspec/after_hooks_spec.rb +63 -63
  115. data/spec/watirspec/alert_spec.rb +6 -6
  116. data/spec/watirspec/attributes_spec.rb +6 -6
  117. data/spec/watirspec/browser_spec.rb +161 -162
  118. data/spec/watirspec/click_spec.rb +9 -9
  119. data/spec/watirspec/cookies_spec.rb +15 -14
  120. data/spec/watirspec/drag_and_drop_spec.rb +15 -16
  121. data/spec/watirspec/element_hidden_spec.rb +19 -21
  122. data/spec/watirspec/elements/area_spec.rb +18 -21
  123. data/spec/watirspec/elements/areas_spec.rb +13 -15
  124. data/spec/watirspec/elements/button_spec.rb +96 -99
  125. data/spec/watirspec/elements/buttons_spec.rb +17 -19
  126. data/spec/watirspec/elements/checkbox_spec.rb +102 -100
  127. data/spec/watirspec/elements/checkboxes_spec.rb +13 -15
  128. data/spec/watirspec/elements/collections_spec.rb +35 -37
  129. data/spec/watirspec/elements/date_field_spec.rb +46 -47
  130. data/spec/watirspec/elements/date_fields_spec.rb +13 -15
  131. data/spec/watirspec/elements/date_time_field_spec.rb +62 -57
  132. data/spec/watirspec/elements/date_time_fields_spec.rb +14 -15
  133. data/spec/watirspec/elements/dd_spec.rb +46 -48
  134. data/spec/watirspec/elements/dds_spec.rb +13 -15
  135. data/spec/watirspec/elements/del_spec.rb +27 -28
  136. data/spec/watirspec/elements/dels_spec.rb +13 -15
  137. data/spec/watirspec/elements/div_spec.rb +89 -91
  138. data/spec/watirspec/elements/divs_spec.rb +17 -19
  139. data/spec/watirspec/elements/dl_spec.rb +52 -54
  140. data/spec/watirspec/elements/dls_spec.rb +13 -15
  141. data/spec/watirspec/elements/dt_spec.rb +46 -48
  142. data/spec/watirspec/elements/dts_spec.rb +13 -15
  143. data/spec/watirspec/elements/element_spec.rb +240 -189
  144. data/spec/watirspec/elements/elements_spec.rb +16 -16
  145. data/spec/watirspec/elements/em_spec.rb +38 -40
  146. data/spec/watirspec/elements/ems_spec.rb +13 -15
  147. data/spec/watirspec/elements/filefield_spec.rb +45 -46
  148. data/spec/watirspec/elements/filefields_spec.rb +13 -15
  149. data/spec/watirspec/elements/font_spec.rb +11 -13
  150. data/spec/watirspec/elements/form_spec.rb +13 -15
  151. data/spec/watirspec/elements/forms_spec.rb +13 -15
  152. data/spec/watirspec/elements/frame_spec.rb +48 -50
  153. data/spec/watirspec/elements/frames_spec.rb +13 -15
  154. data/spec/watirspec/elements/hidden_spec.rb +23 -25
  155. data/spec/watirspec/elements/hiddens_spec.rb +13 -15
  156. data/spec/watirspec/elements/hn_spec.rb +22 -24
  157. data/spec/watirspec/elements/hns_spec.rb +13 -13
  158. data/spec/watirspec/elements/iframe_spec.rb +106 -74
  159. data/spec/watirspec/elements/iframes_spec.rb +16 -18
  160. data/spec/watirspec/elements/image_spec.rb +30 -32
  161. data/spec/watirspec/elements/images_spec.rb +13 -15
  162. data/spec/watirspec/elements/input_spec.rb +4 -5
  163. data/spec/watirspec/elements/ins_spec.rb +27 -29
  164. data/spec/watirspec/elements/inses_spec.rb +13 -15
  165. data/spec/watirspec/elements/label_spec.rb +17 -19
  166. data/spec/watirspec/elements/labels_spec.rb +13 -15
  167. data/spec/watirspec/elements/li_spec.rb +23 -25
  168. data/spec/watirspec/elements/link_spec.rb +45 -48
  169. data/spec/watirspec/elements/links_spec.rb +14 -16
  170. data/spec/watirspec/elements/lis_spec.rb +13 -15
  171. data/spec/watirspec/elements/list_spec.rb +14 -15
  172. data/spec/watirspec/elements/map_spec.rb +19 -20
  173. data/spec/watirspec/elements/maps_spec.rb +13 -15
  174. data/spec/watirspec/elements/meta_spec.rb +10 -10
  175. data/spec/watirspec/elements/metas_spec.rb +13 -15
  176. data/spec/watirspec/elements/ol_spec.rb +20 -21
  177. data/spec/watirspec/elements/ols_spec.rb +13 -15
  178. data/spec/watirspec/elements/option_spec.rb +63 -63
  179. data/spec/watirspec/elements/p_spec.rb +27 -26
  180. data/spec/watirspec/elements/pre_spec.rb +24 -25
  181. data/spec/watirspec/elements/pres_spec.rb +13 -15
  182. data/spec/watirspec/elements/ps_spec.rb +13 -15
  183. data/spec/watirspec/elements/radio_spec.rb +96 -97
  184. data/spec/watirspec/elements/radios_spec.rb +13 -15
  185. data/spec/watirspec/elements/select_list_spec.rb +244 -237
  186. data/spec/watirspec/elements/select_lists_spec.rb +15 -16
  187. data/spec/watirspec/elements/span_spec.rb +32 -31
  188. data/spec/watirspec/elements/spans_spec.rb +13 -15
  189. data/spec/watirspec/elements/strong_spec.rb +23 -24
  190. data/spec/watirspec/elements/strongs_spec.rb +13 -15
  191. data/spec/watirspec/elements/table_nesting_spec.rb +15 -14
  192. data/spec/watirspec/elements/table_spec.rb +61 -62
  193. data/spec/watirspec/elements/tables_spec.rb +15 -17
  194. data/spec/watirspec/elements/tbody_spec.rb +25 -26
  195. data/spec/watirspec/elements/tbodys_spec.rb +17 -19
  196. data/spec/watirspec/elements/td_spec.rb +20 -22
  197. data/spec/watirspec/elements/tds_spec.rb +9 -11
  198. data/spec/watirspec/elements/text_field_spec.rb +55 -56
  199. data/spec/watirspec/elements/text_fields_spec.rb +15 -16
  200. data/spec/watirspec/elements/textarea_spec.rb +2 -2
  201. data/spec/watirspec/elements/textareas_spec.rb +1 -1
  202. data/spec/watirspec/elements/tfoot_spec.rb +22 -23
  203. data/spec/watirspec/elements/tfoots_spec.rb +19 -19
  204. data/spec/watirspec/elements/thead_spec.rb +21 -23
  205. data/spec/watirspec/elements/theads_spec.rb +19 -19
  206. data/spec/watirspec/elements/tr_spec.rb +20 -22
  207. data/spec/watirspec/elements/trs_spec.rb +17 -19
  208. data/spec/watirspec/elements/ul_spec.rb +17 -19
  209. data/spec/watirspec/elements/uls_spec.rb +13 -14
  210. data/spec/watirspec/html/data_attributes.html +1 -0
  211. data/spec/watirspec/radio_set_spec.rb +100 -99
  212. data/spec/watirspec/relaxed_locate_spec.rb +19 -43
  213. data/spec/watirspec/screenshot_spec.rb +4 -4
  214. data/spec/watirspec/special_chars_spec.rb +2 -4
  215. data/spec/watirspec/support/rspec_matchers.rb +85 -22
  216. data/spec/watirspec/user_editable_spec.rb +84 -85
  217. data/spec/watirspec/wait_spec.rb +74 -95
  218. data/spec/watirspec/window_switching_spec.rb +131 -132
  219. data/spec/watirspec_helper.rb +12 -9
  220. data/support/travis.sh +4 -0
  221. data/support/version_differ.rb +12 -13
  222. data/watir.gemspec +29 -22
  223. metadata +76 -50
@@ -1,14 +1,13 @@
1
- require "watirspec_helper"
2
-
3
- describe "TableCells" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'TableCells' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("tables.html"))
5
+ browser.goto(WatirSpec.url_for('tables.html'))
7
6
  end
8
7
 
9
- describe "with selectors" do
10
- it "returns the matching elements" do
11
- expect(browser.tds(headers: "before_tax").to_a).to eq [browser.td(headers: "before_tax")]
8
+ describe 'with selectors' do
9
+ it 'returns the matching elements' do
10
+ expect(browser.tds(headers: 'before_tax').to_a).to eq [browser.td(headers: 'before_tax')]
12
11
  end
13
12
  end
14
13
 
@@ -27,8 +26,8 @@ describe "TableCells" do
27
26
  # end
28
27
  # end
29
28
 
30
- describe "#each" do
31
- it "iterates through all cells on the page correctly" do
29
+ describe '#each' do
30
+ it 'iterates through all cells on the page correctly' do
32
31
  count = 0
33
32
 
34
33
  browser.tds.each_with_index do |c, index|
@@ -39,7 +38,7 @@ describe "TableCells" do
39
38
  expect(count).to be > 0
40
39
  end
41
40
 
42
- it "iterates through cells inside a table" do
41
+ it 'iterates through cells inside a table' do
43
42
  count = 0
44
43
 
45
44
  inner_table = browser.table(id: 'inner')
@@ -48,6 +47,5 @@ describe "TableCells" do
48
47
  count += 1
49
48
  end
50
49
  end
51
-
52
50
  end
53
51
  end
@@ -1,14 +1,13 @@
1
- require "watirspec_helper"
2
-
3
- describe "TextField" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'TextField' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
5
+ browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
7
6
  end
8
7
 
9
8
  # Exists method
10
- describe "#exists?" do
11
- it "returns true if the element exists" do
9
+ describe '#exists?' do
10
+ it 'returns true if the element exists' do
12
11
  expect(browser.text_field(id: 'new_user_email')).to exist
13
12
  expect(browser.text_field(id: /new_user_email/)).to exist
14
13
  expect(browser.text_field(name: 'new_user_email')).to exist
@@ -21,7 +20,7 @@ describe "TextField" do
21
20
  expect(browser.text_field(class: /name/)).to exist
22
21
  expect(browser.text_field(index: 0)).to exist
23
22
  expect(browser.text_field(xpath: "//input[@id='new_user_email']")).to exist
24
- expect(browser.text_field(label: "First name")).to exist
23
+ expect(browser.text_field(label: 'First name')).to exist
25
24
  expect(browser.text_field(label: /(Last|First) name/)).to exist
26
25
  expect(browser.text_field(label: 'Without for')).to exist
27
26
  expect(browser.text_field(label: /Without for/)).to exist
@@ -38,31 +37,31 @@ describe "TextField" do
38
37
  expect(browser.text_field(visible_label: /With hidden text/)).not_to exist
39
38
  end
40
39
 
41
- it "returns the first text field if given no args" do
40
+ it 'returns the first text field if given no args' do
42
41
  expect(browser.text_field).to exist
43
42
  end
44
43
 
45
- it "respects text fields types" do
44
+ it 'respects text fields types' do
46
45
  expect(browser.text_field.type).to eq('text')
47
46
  end
48
47
 
49
- it "returns true if the element exists (no type attribute)" do
48
+ it 'returns true if the element exists (no type attribute)' do
50
49
  expect(browser.text_field(id: 'new_user_first_name')).to exist
51
50
  end
52
51
 
53
- it "returns true if the element exists (invalid type attribute)" do
52
+ it 'returns true if the element exists (invalid type attribute)' do
54
53
  expect(browser.text_field(id: 'new_user_last_name')).to exist
55
54
  end
56
55
 
57
- it "returns true for element with upper case type" do
58
- expect(browser.text_field(id: "new_user_email_confirm")).to exist
56
+ it 'returns true for element with upper case type' do
57
+ expect(browser.text_field(id: 'new_user_email_confirm')).to exist
59
58
  end
60
59
 
61
- it "returns true for element with unknown type attribute" do
62
- expect(browser.text_field(id: "unknown_text_field")).to exist
60
+ it 'returns true for element with unknown type attribute' do
61
+ expect(browser.text_field(id: 'unknown_text_field')).to exist
63
62
  end
64
63
 
65
- it "returns false if the element does not exist" do
64
+ it 'returns false if the element does not exist' do
66
65
  expect(browser.text_field(id: 'no_such_id')).to_not exist
67
66
  expect(browser.text_field(id: /no_such_id/)).to_not exist
68
67
  expect(browser.text_field(name: 'no_such_name')).to_not exist
@@ -75,11 +74,11 @@ describe "TextField" do
75
74
  expect(browser.text_field(class: /no_such_class/)).to_not exist
76
75
  expect(browser.text_field(index: 1337)).to_not exist
77
76
  expect(browser.text_field(xpath: "//input[@id='no_such_id']")).to_not exist
78
- expect(browser.text_field(label: "bad label")).to_not exist
77
+ expect(browser.text_field(label: 'bad label')).to_not exist
79
78
  expect(browser.text_field(label: /bad label/)).to_not exist
80
79
 
81
80
  # input type='hidden' should not be found by #text_field
82
- expect(browser.text_field(id: "new_user_interests_dolls")).to_not exist
81
+ expect(browser.text_field(id: 'new_user_interests_dolls')).to_not exist
83
82
  end
84
83
 
85
84
  it "raises TypeError when 'what' argument is invalid" do
@@ -88,9 +87,9 @@ describe "TextField" do
88
87
  end
89
88
 
90
89
  # Attribute methods
91
- describe "#id" do
92
- it "returns the id attribute if the text field exists" do
93
- expect(browser.text_field(index: 4).id).to eq "new_user_occupation"
90
+ describe '#id' do
91
+ it 'returns the id attribute if the text field exists' do
92
+ expect(browser.text_field(index: 4).id).to eq 'new_user_occupation'
94
93
  end
95
94
 
96
95
  it "raises UnknownObjectException if the text field doesn't exist" do
@@ -98,9 +97,9 @@ describe "TextField" do
98
97
  end
99
98
  end
100
99
 
101
- describe "#name" do
102
- it "returns the name attribute if the text field exists" do
103
- expect(browser.text_field(index: 3).name).to eq "new_user_email_confirm"
100
+ describe '#name' do
101
+ it 'returns the name attribute if the text field exists' do
102
+ expect(browser.text_field(index: 3).name).to eq 'new_user_email_confirm'
104
103
  end
105
104
 
106
105
  it "raises UnknownObjectException if the text field doesn't exist" do
@@ -108,9 +107,9 @@ describe "TextField" do
108
107
  end
109
108
  end
110
109
 
111
- describe "#title" do
112
- it "returns the title attribute if the text field exists" do
113
- expect(browser.text_field(id: "new_user_code").title).to eq "Your personal code"
110
+ describe '#title' do
111
+ it 'returns the title attribute if the text field exists' do
112
+ expect(browser.text_field(id: 'new_user_code').title).to eq 'Your personal code'
114
113
  end
115
114
 
116
115
  it "raises UnknownObjectException if the text field doesn't exist" do
@@ -118,17 +117,17 @@ describe "TextField" do
118
117
  end
119
118
  end
120
119
 
121
- describe "#type" do
122
- it "returns the type attribute if the text field exists" do
123
- expect(browser.text_field(index: 3).type).to eq "text"
120
+ describe '#type' do
121
+ it 'returns the type attribute if the text field exists' do
122
+ expect(browser.text_field(index: 3).type).to eq 'text'
124
123
  end
125
124
 
126
125
  it "returns 'text' if the type attribute is invalid" do
127
- expect(browser.text_field(id: 'new_user_last_name').type).to eq "text"
126
+ expect(browser.text_field(id: 'new_user_last_name').type).to eq 'text'
128
127
  end
129
128
 
130
129
  it "returns 'text' if the type attribute does not exist" do
131
- expect(browser.text_field(id: 'new_user_first_name').type).to eq "text"
130
+ expect(browser.text_field(id: 'new_user_first_name').type).to eq 'text'
132
131
  end
133
132
 
134
133
  it "raises UnknownObjectException if the text field doesn't exist" do
@@ -136,11 +135,11 @@ describe "TextField" do
136
135
  end
137
136
  end
138
137
 
139
- describe "#value" do
140
- it "returns the value attribute if the text field exists" do
141
- expect(browser.text_field(name: "new_user_occupation").value).to eq "Developer"
142
- expect(browser.text_field(index: 4).value).to eq "Developer"
143
- expect(browser.text_field(name: /new_user_occupation/i).value).to eq "Developer"
138
+ describe '#value' do
139
+ it 'returns the value attribute if the text field exists' do
140
+ expect(browser.text_field(name: 'new_user_occupation').value).to eq 'Developer'
141
+ expect(browser.text_field(index: 4).value).to eq 'Developer'
142
+ expect(browser.text_field(name: /new_user_occupation/i).value).to eq 'Developer'
144
143
  end
145
144
 
146
145
  it "raises UnknownObjectException if the text field doesn't exist" do
@@ -148,8 +147,8 @@ describe "TextField" do
148
147
  end
149
148
  end
150
149
 
151
- describe "#respond_to?" do
152
- it "returns true for all attribute methods" do
150
+ describe '#respond_to?' do
151
+ it 'returns true for all attribute methods' do
153
152
  expect(browser.text_field(index: 0)).to respond_to(:class_name)
154
153
  expect(browser.text_field(index: 0)).to respond_to(:id)
155
154
  expect(browser.text_field(index: 0)).to respond_to(:name)
@@ -160,27 +159,27 @@ describe "TextField" do
160
159
  end
161
160
 
162
161
  # Access methods
163
- describe "#enabled?" do
164
- it "returns true for enabled text fields" do
165
- expect(browser.text_field(name: "new_user_occupation")).to be_enabled
166
- expect(browser.text_field(id: "new_user_email")).to be_enabled
162
+ describe '#enabled?' do
163
+ it 'returns true for enabled text fields' do
164
+ expect(browser.text_field(name: 'new_user_occupation')).to be_enabled
165
+ expect(browser.text_field(id: 'new_user_email')).to be_enabled
167
166
  end
168
167
 
169
- it "returns false for disabled text fields" do
170
- expect(browser.text_field(name: "new_user_species")).to_not be_enabled
168
+ it 'returns false for disabled text fields' do
169
+ expect(browser.text_field(name: 'new_user_species')).to_not be_enabled
171
170
  end
172
171
 
173
172
  it "raises UnknownObjectException if the text field doesn't exist" do
174
- expect { browser.text_field(id: "no_such_id").enabled? }.to raise_unknown_object_exception
173
+ expect { browser.text_field(id: 'no_such_id').enabled? }.to raise_unknown_object_exception
175
174
  end
176
175
  end
177
176
 
178
- describe "#disabled?" do
179
- it "returns true if the text field is disabled" do
177
+ describe '#disabled?' do
178
+ it 'returns true if the text field is disabled' do
180
179
  expect(browser.text_field(id: 'new_user_species')).to be_disabled
181
180
  end
182
181
 
183
- it "returns false if the text field is enabled" do
182
+ it 'returns false if the text field is enabled' do
184
183
  expect(browser.text_field(index: 0)).to_not be_disabled
185
184
  end
186
185
 
@@ -189,21 +188,21 @@ describe "TextField" do
189
188
  end
190
189
  end
191
190
 
192
- describe "#readonly?" do
193
- it "returns true for read-only text fields" do
194
- expect(browser.text_field(name: "new_user_code")).to be_readonly
195
- expect(browser.text_field(id: "new_user_code")).to be_readonly
191
+ describe '#readonly?' do
192
+ it 'returns true for read-only text fields' do
193
+ expect(browser.text_field(name: 'new_user_code')).to be_readonly
194
+ expect(browser.text_field(id: 'new_user_code')).to be_readonly
196
195
  end
197
196
 
198
- it "returns false for writable text fields" do
199
- expect(browser.text_field(name: "new_user_email")).to_not be_readonly
197
+ it 'returns false for writable text fields' do
198
+ expect(browser.text_field(name: 'new_user_email')).to_not be_readonly
200
199
  end
201
200
 
202
201
  it "raises UnknownObjectException if the text field doesn't exist" do
203
202
  expect { browser.text_field(id: 'no_such_id').readonly? }.to raise_unknown_object_exception
204
203
  end
205
204
 
206
- it "raises UnknownReadOnlyException if sending keys to readonly element" do
205
+ it 'raises UnknownReadOnlyException if sending keys to readonly element' do
207
206
  expect { browser.text_field(id: 'new_user_code').set 'foo' }.to raise_object_read_only_exception
208
207
  end
209
208
  end
@@ -1,33 +1,32 @@
1
- require "watirspec_helper"
2
-
3
- describe "TextFields" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'TextFields' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
5
+ browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
7
6
  end
8
7
 
9
- describe "with selectors" do
10
- it "returns the matching elements" do
11
- expect(browser.text_fields(name: "new_user_email").to_a).to eq [browser.text_field(name: "new_user_email")]
8
+ describe 'with selectors' do
9
+ it 'returns the matching elements' do
10
+ expect(browser.text_fields(name: 'new_user_email').to_a).to eq [browser.text_field(name: 'new_user_email')]
12
11
  end
13
12
  end
14
13
 
15
- describe "#length" do
16
- it "returns the number of text fields" do
14
+ describe '#length' do
15
+ it 'returns the number of text fields' do
17
16
  expect(browser.text_fields.length).to eq 18
18
17
  end
19
18
  end
20
19
 
21
- describe "#[]" do
22
- it "returns the text field at the given index" do
23
- expect(browser.text_fields[0].id).to eq "new_user_first_name"
24
- expect(browser.text_fields[1].id).to eq "new_user_last_name"
25
- expect(browser.text_fields[2].id).to eq "new_user_email"
20
+ describe '#[]' do
21
+ it 'returns the text field at the given index' do
22
+ expect(browser.text_fields[0].id).to eq 'new_user_first_name'
23
+ expect(browser.text_fields[1].id).to eq 'new_user_last_name'
24
+ expect(browser.text_fields[2].id).to eq 'new_user_email'
26
25
  end
27
26
  end
28
27
 
29
- describe "#each" do
30
- it "iterates through text fields correctly" do
28
+ describe '#each' do
29
+ it 'iterates through text fields correctly' do
31
30
  count = 0
32
31
 
33
32
  browser.text_fields.each_with_index do |r, index|
@@ -1,6 +1,6 @@
1
- require "watirspec_helper"
1
+ require 'watirspec_helper'
2
2
 
3
- describe "TextArea" do
3
+ describe 'TextArea' do
4
4
  before :each do
5
5
  browser.goto WatirSpec.url_for('forms_with_input_elements.html')
6
6
  end
@@ -1,4 +1,4 @@
1
- require "watirspec_helper"
1
+ require 'watirspec_helper'
2
2
 
3
3
  describe 'TextArea' do
4
4
  before :each do
@@ -1,26 +1,26 @@
1
- require "watirspec_helper"
1
+ require 'watirspec_helper'
2
2
 
3
- describe "TableFooter" do
3
+ describe 'TableFooter' do
4
4
  before :each do
5
- browser.goto(WatirSpec.url_for("tables.html"))
5
+ browser.goto(WatirSpec.url_for('tables.html'))
6
6
  end
7
7
 
8
- describe "#exists?" do
9
- it "returns true if the table tfoot exists (page context)" do
8
+ describe '#exists?' do
9
+ it 'returns true if the table tfoot exists (page context)' do
10
10
  expect(browser.tfoot(id: 'tax_totals')).to exist
11
11
  expect(browser.tfoot(id: /tax_totals/)).to exist
12
12
  expect(browser.tfoot(index: 0)).to exist
13
13
  expect(browser.tfoot(xpath: "//tfoot[@id='tax_totals']")).to exist
14
14
  end
15
15
 
16
- it "returns true if the table tfoot exists (table context)" do
16
+ it 'returns true if the table tfoot exists (table context)' do
17
17
  expect(browser.table(index: 0).tfoot(id: 'tax_totals')).to exist
18
18
  expect(browser.table(index: 0).tfoot(id: /tax_totals/)).to exist
19
19
  expect(browser.table(index: 0).tfoot(index: 0)).to exist
20
20
  expect(browser.table(index: 0).tfoot(xpath: "//tfoot[@id='tax_totals']")).to exist
21
21
  end
22
22
 
23
- it "returns the first tfoot if given no args" do
23
+ it 'returns the first tfoot if given no args' do
24
24
  expect(browser.tfoot).to exist
25
25
  end
26
26
 
@@ -44,43 +44,42 @@ describe "TableFooter" do
44
44
  end
45
45
  end
46
46
 
47
- describe "#[]" do
48
- it "returns the row at the given index (page context)" do
47
+ describe '#[]' do
48
+ it 'returns the row at the given index (page context)' do
49
49
  expect(browser.tfoot(id: 'tax_totals')[0].id).to eq 'tfoot_row_1'
50
50
  expect(browser.tfoot(id: 'tax_totals')[0][1].text).to eq '24 349'
51
51
  expect(browser.tfoot(id: 'tax_totals')[0][2].text).to eq '5 577'
52
52
  end
53
53
 
54
- it "returns the row at the given index (table context)" do
55
- expect(browser.table(index: 0).tfoot(id: 'tax_totals')[0].id).to eq "tfoot_row_1"
54
+ it 'returns the row at the given index (table context)' do
55
+ expect(browser.table(index: 0).tfoot(id: 'tax_totals')[0].id).to eq 'tfoot_row_1'
56
56
  expect(browser.table(index: 0).tfoot(id: 'tax_totals')[0][1].text).to eq '24 349'
57
57
  expect(browser.table(index: 0).tfoot(id: 'tax_totals')[0][2].text).to eq '5 577'
58
58
  end
59
59
  end
60
60
 
61
- describe "#row" do
62
- it "finds the first row matching the selector" do
63
- row = browser.tfoot(id: 'tax_totals').row(id: "tfoot_row_1")
61
+ describe '#row' do
62
+ it 'finds the first row matching the selector' do
63
+ row = browser.tfoot(id: 'tax_totals').row(id: 'tfoot_row_1')
64
64
 
65
- expect(row.id).to eq "tfoot_row_1"
65
+ expect(row.id).to eq 'tfoot_row_1'
66
66
  end
67
67
  end
68
68
 
69
- describe "#rows" do
70
- it "finds rows matching the selector" do
71
- rows = browser.tfoot(id: 'tax_totals').rows(id: "tfoot_row_1")
69
+ describe '#rows' do
70
+ it 'finds rows matching the selector' do
71
+ rows = browser.tfoot(id: 'tax_totals').rows(id: 'tfoot_row_1')
72
72
 
73
73
  expect(rows.size).to eq 1
74
- expect(rows.first.id).to eq "tfoot_row_1"
74
+ expect(rows.first.id).to eq 'tfoot_row_1'
75
75
  end
76
76
  end
77
77
 
78
- describe "#strings" do
79
- it "returns the text of child cells" do
78
+ describe '#strings' do
79
+ it 'returns the text of child cells' do
80
80
  expect(browser.tfoot(id: 'tax_totals').strings).to eq [
81
- ["Sum", "24 349", "5 577", "18 722"]
81
+ ['Sum', '24 349', '5 577', '18 722']
82
82
  ]
83
83
  end
84
84
  end
85
-
86
85
  end
@@ -1,45 +1,45 @@
1
- require "watirspec_helper"
1
+ require 'watirspec_helper'
2
2
 
3
- describe "TableFooters" do
3
+ describe 'TableFooters' do
4
4
  before :each do
5
- browser.goto(WatirSpec.url_for("tables.html"))
5
+ browser.goto(WatirSpec.url_for('tables.html'))
6
6
  end
7
7
 
8
- describe "with selectors" do
9
- it "returns the matching elements" do
10
- expect(browser.tfoots(id: "tax_totals").to_a).to eq [browser.tfoot(id: "tax_totals")]
8
+ describe 'with selectors' do
9
+ it 'returns the matching elements' do
10
+ expect(browser.tfoots(id: 'tax_totals').to_a).to eq [browser.tfoot(id: 'tax_totals')]
11
11
  end
12
12
  end
13
13
 
14
- describe "#length" do
15
- it "returns the correct number of table tfoots (page context)" do
14
+ describe '#length' do
15
+ it 'returns the correct number of table tfoots (page context)' do
16
16
  expect(browser.tfoots.length).to eq 1
17
17
  end
18
18
 
19
- it "returns the correct number of table tfoots (table context)" do
19
+ it 'returns the correct number of table tfoots (table context)' do
20
20
  expect(browser.table(index: 0).tfoots.length).to eq 1
21
21
  end
22
22
  end
23
23
 
24
- describe "#[]" do
25
- it "returns the row at the given index (page context)" do
26
- expect(browser.tfoots[0].id).to eq "tax_totals"
24
+ describe '#[]' do
25
+ it 'returns the row at the given index (page context)' do
26
+ expect(browser.tfoots[0].id).to eq 'tax_totals'
27
27
  end
28
28
 
29
- it "returns the row at the given index (table context)" do
30
- expect(browser.table(index: 0).tfoots[0].id).to eq "tax_totals"
29
+ it 'returns the row at the given index (table context)' do
30
+ expect(browser.table(index: 0).tfoots[0].id).to eq 'tax_totals'
31
31
  end
32
32
  end
33
33
 
34
- describe "#each" do
35
- it "iterates through table tfoots correctly (page context)" do
34
+ describe '#each' do
35
+ it 'iterates through table tfoots correctly (page context)' do
36
36
  browser.tfoots.each_with_index do |tfoot, index|
37
37
  expect(tfoot.id).to eq browser.tfoot(index: index).id
38
38
  end
39
39
  end
40
40
 
41
- describe "#each" do
42
- it "iterates through table tfoots correctly (page context)" do
41
+ describe '#each' do
42
+ it 'iterates through table tfoots correctly (page context)' do
43
43
  count = 0
44
44
 
45
45
  browser.tfoots.each_with_index do |tfoot, index|
@@ -51,7 +51,7 @@ describe "TableFooters" do
51
51
  expect(count).to be > 0
52
52
  end
53
53
 
54
- it "iterates through table tfoots correctly (table context)" do
54
+ it 'iterates through table tfoots correctly (table context)' do
55
55
  table = browser.table(index: 0)
56
56
  count = 0
57
57