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,38 +1,36 @@
1
- require "watirspec_helper"
2
-
3
- describe "IFrames" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'IFrames' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("iframes.html"))
5
+ browser.goto(WatirSpec.url_for('iframes.html'))
7
6
  end
8
7
 
9
- describe "with selectors" do
10
- it "returns the matching elements" do
11
- expect(browser.iframes(id: "iframe_2").to_a).to eq [browser.iframe(id: "iframe_2")]
8
+ describe 'with selectors' do
9
+ it 'returns the matching elements' do
10
+ expect(browser.iframes(id: 'iframe_2').to_a).to eq [browser.iframe(id: 'iframe_2')]
12
11
  end
13
12
  end
14
13
 
15
- describe "eql?" do
16
- it "matches equality of iframe with that from a collection" do
17
- expect(browser.iframes.last).to eq browser.iframe(id: "iframe_2")
14
+ describe 'eql?' do
15
+ it 'matches equality of iframe with that from a collection' do
16
+ expect(browser.iframes.last).to eq browser.iframe(id: 'iframe_2')
18
17
  end
19
-
20
18
  end
21
19
 
22
- describe "#length" do
23
- it "returns the correct number of iframes" do
20
+ describe '#length' do
21
+ it 'returns the correct number of iframes' do
24
22
  expect(browser.iframes.length).to eq 2
25
23
  end
26
24
  end
27
25
 
28
- describe "#[]" do
29
- it "returns the iframe at the given index" do
30
- expect(browser.iframes[0].id).to eq "iframe_1"
26
+ describe '#[]' do
27
+ it 'returns the iframe at the given index' do
28
+ expect(browser.iframes[0].id).to eq 'iframe_1'
31
29
  end
32
30
  end
33
31
 
34
- describe "#each" do
35
- it "iterates through frames correctly" do
32
+ describe '#each' do
33
+ it 'iterates through frames correctly' do
36
34
  count = 0
37
35
 
38
36
  browser.iframes.each_with_index do |f, index|
@@ -1,14 +1,13 @@
1
- require "watirspec_helper"
2
-
3
- describe "Image" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'Image' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("images.html"))
5
+ browser.goto(WatirSpec.url_for('images.html'))
7
6
  end
8
7
 
9
8
  # Exists method
10
- describe "#exists?" do
11
- it "returns true when the image exists" do
9
+ describe '#exists?' do
10
+ it 'returns true when the image exists' do
12
11
  expect(browser.image(id: 'square')).to exist
13
12
  expect(browser.image(id: /square/)).to exist
14
13
  expect(browser.image(src: 'images/circle.png')).to exist
@@ -18,7 +17,7 @@ describe "Image" do
18
17
  expect(browser.image(title: 'Circle')).to exist
19
18
  end
20
19
 
21
- it "returns the first image if given no args" do
20
+ it 'returns the first image if given no args' do
22
21
  expect(browser.image).to exist
23
22
  end
24
23
 
@@ -39,14 +38,14 @@ describe "Image" do
39
38
  end
40
39
 
41
40
  # Attribute methods
42
- describe "#alt" do
43
- it "returns the alt attribute of the image if the image exists" do
44
- expect(browser.image(id: 'square').alt).to eq "square"
41
+ describe '#alt' do
42
+ it 'returns the alt attribute of the image if the image exists' do
43
+ expect(browser.image(id: 'square').alt).to eq 'square'
45
44
  expect(browser.image(title: 'Circle').alt).to eq 'circle'
46
45
  end
47
46
 
48
47
  it "returns an empty string if the image exists and the attribute doesn't" do
49
- expect(browser.image(index: 0).alt).to eq ""
48
+ expect(browser.image(index: 0).alt).to eq ''
50
49
  end
51
50
 
52
51
  it "raises UnknownObjectException if the image doesn't exist" do
@@ -54,13 +53,13 @@ describe "Image" do
54
53
  end
55
54
  end
56
55
 
57
- describe "#id" do
58
- it "returns the id attribute of the image if the image exists" do
56
+ describe '#id' do
57
+ it 'returns the id attribute of the image if the image exists' do
59
58
  expect(browser.image(title: 'Square').id).to eq 'square'
60
59
  end
61
60
 
62
61
  it "returns an empty string if the image exists and the attribute doesn't" do
63
- expect(browser.image(index: 0).id).to eq ""
62
+ expect(browser.image(index: 0).id).to eq ''
64
63
  end
65
64
 
66
65
  it "raises UnknownObjectException if the image doesn't exist" do
@@ -68,13 +67,13 @@ describe "Image" do
68
67
  end
69
68
  end
70
69
 
71
- describe "#src" do
72
- it "returns the src attribute of the image if the image exists" do
73
- expect(browser.image(id: 'square').src).to include("square.png")
70
+ describe '#src' do
71
+ it 'returns the src attribute of the image if the image exists' do
72
+ expect(browser.image(id: 'square').src).to include('square.png')
74
73
  end
75
74
 
76
75
  it "returns an empty string if the image exists and the attribute doesn't" do
77
- expect(browser.image(index: 0).src).to eq ""
76
+ expect(browser.image(index: 0).src).to eq ''
78
77
  end
79
78
 
80
79
  it "raises UnknownObjectException if the image doesn't exist" do
@@ -82,13 +81,13 @@ describe "Image" do
82
81
  end
83
82
  end
84
83
 
85
- describe "#title" do
86
- it "returns the title attribute of the image if the image exists" do
84
+ describe '#title' do
85
+ it 'returns the title attribute of the image if the image exists' do
87
86
  expect(browser.image(id: 'square').title).to eq 'Square'
88
87
  end
89
88
 
90
89
  it "returns an empty string if the image exists and the attribute doesn't" do
91
- expect(browser.image(index: 0).title).to eq ""
90
+ expect(browser.image(index: 0).title).to eq ''
92
91
  end
93
92
 
94
93
  it "raises UnknownObjectException if the image doesn't exist" do
@@ -96,8 +95,8 @@ describe "Image" do
96
95
  end
97
96
  end
98
97
 
99
- describe "#respond_to?" do
100
- it "returns true for all attribute methods" do
98
+ describe '#respond_to?' do
99
+ it 'returns true for all attribute methods' do
101
100
  expect(browser.image(index: 0)).to respond_to(:class_name)
102
101
  expect(browser.image(index: 0)).to respond_to(:id)
103
102
  expect(browser.image(index: 0)).to respond_to(:style)
@@ -106,7 +105,7 @@ describe "Image" do
106
105
  end
107
106
 
108
107
  # Manipulation methods
109
- describe "#click" do
108
+ describe '#click' do
110
109
  it "raises UnknownObjectException when the image doesn't exist" do
111
110
  expect { browser.image(id: 'missing_attribute').click }.to raise_unknown_object_exception
112
111
  expect { browser.image(class: 'missing_attribute').click }.to raise_unknown_object_exception
@@ -115,8 +114,8 @@ describe "Image" do
115
114
  end
116
115
  end
117
116
 
118
- describe "#height" do
119
- it "returns the height of the image if the image exists" do
117
+ describe '#height' do
118
+ it 'returns the height of the image if the image exists' do
120
119
  expect(browser.image(id: 'square').height).to eq 88
121
120
  end
122
121
 
@@ -125,8 +124,8 @@ describe "Image" do
125
124
  end
126
125
  end
127
126
 
128
- describe "#width" do
129
- it "returns the width of the image if the image exists" do
127
+ describe '#width' do
128
+ it 'returns the width of the image if the image exists' do
130
129
  expect(browser.image(id: 'square').width).to eq 88
131
130
  end
132
131
 
@@ -136,14 +135,14 @@ describe "Image" do
136
135
  end
137
136
 
138
137
  # Other
139
- describe "#loaded?" do
140
- it "returns true if the image has been loaded" do
138
+ describe '#loaded?' do
139
+ it 'returns true if the image has been loaded' do
141
140
  expect(browser.image(title: 'Circle')).to be_loaded
142
141
  expect(browser.image(alt: 'circle')).to be_loaded
143
142
  expect(browser.image(alt: /circle/)).to be_loaded
144
143
  end
145
144
 
146
- it "returns false if the image has not been loaded" do
145
+ it 'returns false if the image has not been loaded' do
147
146
  expect(browser.image(id: 'no_such_file')).to_not be_loaded
148
147
  end
149
148
 
@@ -154,5 +153,4 @@ describe "Image" do
154
153
  expect { browser.image(index: 1337).loaded? }.to raise_unknown_object_exception
155
154
  end
156
155
  end
157
-
158
156
  end
@@ -1,31 +1,30 @@
1
- require "watirspec_helper"
2
-
3
- describe "Images" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'Images' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("images.html"))
5
+ browser.goto(WatirSpec.url_for('images.html'))
7
6
  end
8
7
 
9
- describe "with selectors" do
10
- it "returns the matching elements" do
11
- expect(browser.images(alt: "circle").to_a).to eq [browser.image(alt: "circle")]
8
+ describe 'with selectors' do
9
+ it 'returns the matching elements' do
10
+ expect(browser.images(alt: 'circle').to_a).to eq [browser.image(alt: 'circle')]
12
11
  end
13
12
  end
14
13
 
15
- describe "#length" do
16
- it "returns the number of images" do
14
+ describe '#length' do
15
+ it 'returns the number of images' do
17
16
  expect(browser.images.length).to eq 10
18
17
  end
19
18
  end
20
19
 
21
- describe "#[]" do
22
- it "returns the image at the given index" do
23
- expect(browser.images[5].id).to eq "square"
20
+ describe '#[]' do
21
+ it 'returns the image at the given index' do
22
+ expect(browser.images[5].id).to eq 'square'
24
23
  end
25
24
  end
26
25
 
27
- describe "#each" do
28
- it "iterates through images correctly" do
26
+ describe '#each' do
27
+ it 'iterates through images correctly' do
29
28
  count = 0
30
29
 
31
30
  browser.images.each_with_index do |c, index|
@@ -36,5 +35,4 @@ describe "Images" do
36
35
  expect(count).to be > 0
37
36
  end
38
37
  end
39
-
40
38
  end
@@ -1,14 +1,13 @@
1
1
  require 'watirspec_helper'
2
2
 
3
3
  describe Watir::Input do
4
-
5
4
  before 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 "#type" do
10
- it "returns an email type" do
11
- expect(browser.input(name: "html5_email").type).to eq 'email'
8
+ describe '#type' do
9
+ it 'returns an email type' do
10
+ expect(browser.input(name: 'html5_email').type).to eq 'email'
12
11
  end
13
12
  end
14
13
  end
@@ -1,34 +1,33 @@
1
- require "watirspec_helper"
2
-
3
- describe "Ins" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'Ins' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("non_control_elements.html"))
5
+ browser.goto(WatirSpec.url_for('non_control_elements.html'))
7
6
  end
8
7
 
9
8
  # Exists method
10
- describe "#exist?" do
9
+ describe '#exist?' do
11
10
  it "returns true if the 'ins' exists" do
12
- expect(browser.ins(id: "lead")).to exist
11
+ expect(browser.ins(id: 'lead')).to exist
13
12
  expect(browser.ins(id: /lead/)).to exist
14
- expect(browser.ins(text: "This is an inserted text tag 1")).to exist
13
+ expect(browser.ins(text: 'This is an inserted text tag 1')).to exist
15
14
  expect(browser.ins(text: /This is an inserted text tag 1/)).to exist
16
- expect(browser.ins(class: "lead")).to exist
15
+ expect(browser.ins(class: 'lead')).to exist
17
16
  expect(browser.ins(class: /lead/)).to exist
18
17
  expect(browser.ins(index: 0)).to exist
19
18
  expect(browser.ins(xpath: "//ins[@id='lead']")).to exist
20
19
  end
21
20
 
22
- it "returns the first ins if given no args" do
21
+ it 'returns the first ins if given no args' do
23
22
  expect(browser.ins).to exist
24
23
  end
25
24
 
26
25
  it "returns false if the element doesn't exist" do
27
- expect(browser.ins(id: "no_such_id")).to_not exist
26
+ expect(browser.ins(id: 'no_such_id')).to_not exist
28
27
  expect(browser.ins(id: /no_such_id/)).to_not exist
29
- expect(browser.ins(text: "no_such_text")).to_not exist
28
+ expect(browser.ins(text: 'no_such_text')).to_not exist
30
29
  expect(browser.ins(text: /no_such_text/)).to_not exist
31
- expect(browser.ins(class: "no_such_class")).to_not exist
30
+ expect(browser.ins(class: 'no_such_class')).to_not exist
32
31
  expect(browser.ins(class: /no_such_class/)).to_not exist
33
32
  expect(browser.ins(index: 1337)).to_not exist
34
33
  expect(browser.ins(xpath: "//ins[@id='no_such_id']")).to_not exist
@@ -40,8 +39,8 @@ describe "Ins" do
40
39
  end
41
40
 
42
41
  # Attribute methods
43
- describe "#class_name" do
44
- it "returns the class attribute" do
42
+ describe '#class_name' do
43
+ it 'returns the class attribute' do
45
44
  expect(browser.ins(index: 0).class_name).to eq 'lead'
46
45
  end
47
46
 
@@ -54,9 +53,9 @@ describe "Ins" do
54
53
  end
55
54
  end
56
55
 
57
- describe "#id" do
58
- it "returns the id attribute" do
59
- expect(browser.ins(index: 0).id).to eq "lead"
56
+ describe '#id' do
57
+ it 'returns the id attribute' do
58
+ expect(browser.ins(index: 0).id).to eq 'lead'
60
59
  end
61
60
 
62
61
  it "returns an empty string if the element exists and the attribute doesn't" do
@@ -64,13 +63,13 @@ describe "Ins" do
64
63
  end
65
64
 
66
65
  it "raises UnknownObjectException if the ins doesn't exist" do
67
- expect { browser.ins(id: "no_such_id").id }.to raise_unknown_object_exception
66
+ expect { browser.ins(id: 'no_such_id').id }.to raise_unknown_object_exception
68
67
  expect { browser.ins(index: 1337).id }.to raise_unknown_object_exception
69
68
  end
70
69
  end
71
70
 
72
- describe "#title" do
73
- it "returns the title attribute" do
71
+ describe '#title' do
72
+ it 'returns the title attribute' do
74
73
  expect(browser.ins(index: 0).title).to eq 'Lorem ipsum'
75
74
  end
76
75
 
@@ -84,8 +83,8 @@ describe "Ins" do
84
83
  end
85
84
  end
86
85
 
87
- describe "#text" do
88
- it "returns the text of the ins" do
86
+ describe '#text' do
87
+ it 'returns the text of the ins' do
89
88
  expect(browser.ins(index: 1).text).to eq 'This is an inserted text tag 2'
90
89
  end
91
90
 
@@ -99,8 +98,8 @@ describe "Ins" do
99
98
  end
100
99
  end
101
100
 
102
- describe "#respond_to?" do
103
- it "returns true for all attribute methods" do
101
+ describe '#respond_to?' do
102
+ it 'returns true for all attribute methods' do
104
103
  expect(browser.ins(index: 0)).to respond_to(:class_name)
105
104
  expect(browser.ins(index: 0)).to respond_to(:id)
106
105
  expect(browser.ins(index: 0)).to respond_to(:title)
@@ -110,18 +109,17 @@ describe "Ins" do
110
109
 
111
110
  # Other
112
111
  not_compliant_on :headless do
113
- describe "#click" do
114
- it "fires events" do
112
+ describe '#click' do
113
+ it 'fires events' do
115
114
  expect(browser.ins(class: 'footer').text).to_not include('Javascript')
116
115
  browser.ins(class: 'footer').click
117
116
  expect(browser.ins(class: 'footer').text).to include('Javascript')
118
117
  end
119
118
 
120
119
  it "raises UnknownObjectException if the ins doesn't exist" do
121
- expect { browser.ins(id: "no_such_id").click }.to raise_unknown_object_exception
122
- expect { browser.ins(title: "no_such_title").click }.to raise_unknown_object_exception
120
+ expect { browser.ins(id: 'no_such_id').click }.to raise_unknown_object_exception
121
+ expect { browser.ins(title: 'no_such_title').click }.to raise_unknown_object_exception
123
122
  end
124
123
  end
125
124
  end
126
-
127
125
  end
@@ -1,31 +1,30 @@
1
- require "watirspec_helper"
2
-
3
- describe "Inses" do
1
+ require 'watirspec_helper'
4
2
 
3
+ describe 'Inses' do
5
4
  before :each do
6
- browser.goto(WatirSpec.url_for("non_control_elements.html"))
5
+ browser.goto(WatirSpec.url_for('non_control_elements.html'))
7
6
  end
8
7
 
9
- describe "with selectors" do
10
- it "returns the matching elements" do
11
- expect(browser.inses(class: "lead").to_a).to eq [browser.ins(class: "lead")]
8
+ describe 'with selectors' do
9
+ it 'returns the matching elements' do
10
+ expect(browser.inses(class: 'lead').to_a).to eq [browser.ins(class: 'lead')]
12
11
  end
13
12
  end
14
13
 
15
- describe "#length" do
16
- it "returns the number of inses" do
14
+ describe '#length' do
15
+ it 'returns the number of inses' do
17
16
  expect(browser.inses.length).to eq 5
18
17
  end
19
18
  end
20
19
 
21
- describe "#[]" do
22
- it "returns the ins at the given index" do
23
- expect(browser.inses[0].id).to eq "lead"
20
+ describe '#[]' do
21
+ it 'returns the ins at the given index' do
22
+ expect(browser.inses[0].id).to eq 'lead'
24
23
  end
25
24
  end
26
25
 
27
- describe "#each" do
28
- it "iterates through inses correctly" do
26
+ describe '#each' do
27
+ it 'iterates through inses correctly' do
29
28
  count = 0
30
29
 
31
30
  browser.inses.each_with_index do |s, index|
@@ -36,5 +35,4 @@ describe "Inses" do
36
35
  expect(count).to be > 0
37
36
  end
38
37
  end
39
-
40
38
  end