watir 6.6.0 → 6.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da90c92ae28c4fd2e22b1bb60bdcbe18b060dee0
4
- data.tar.gz: 9ff7214a544eda7ac4a60cd923c504f35ba92fec
3
+ metadata.gz: 10cab1d1409ebe3bb8f7e249a6d3ee1a8b2523b1
4
+ data.tar.gz: a0c781ce798236ee4b2d9c87a37825c05b6f55d9
5
5
  SHA512:
6
- metadata.gz: b6fbd488d5d064acaeb9b4dca1f9a3d8d6246c51b3b29d36089916e4cd3c048ccf5c343c88c8e962d1b533c8402c2a21ce3bd36db3b9dd96c2ddda89b51da2af
7
- data.tar.gz: a42a2727efabda8ac3210efce1707636d61eab62f311ec8f3efe3542c065c02e8944e00ce41b785f260b94ad42b9abca5585868f49e89b0a2d824e5719c435f9
6
+ metadata.gz: d292a95a5839ccd31ae7f1696351af2e0e515faf2abcaa9cff723234b42cc9fa237b520be2ac152b09b70e31e2953f3ab61c5bee90cbccfaa1e94ced83f724d6
7
+ data.tar.gz: 46a0338d87dc84aab77d24931664a4fe9578826f9211c0a898abe1bf2ff4ebfaa9a3f52478b55acaa5b80095e4788874703c7e4612185a542cd38192f615fa17
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 6.6.1 (2017-08-07)
2
+
3
+ * Support initializing browser with Selenium Options class (#606)
4
+
1
5
  ### 6.6.0 (2017-08-02)
2
6
 
3
7
  * Implement `Select#select_all` for selecting multiple options in select list
@@ -65,9 +65,11 @@ module Watir
65
65
  browser_options[:args] << '--headless'
66
66
  browser_options[:args] << '--disable-gpu'
67
67
  end
68
- @selenium_opts[:options] = Selenium::WebDriver::Chrome::Options.new(browser_options) if browser_options
68
+ @selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Chrome::Options
69
+ @selenium_opts[:options] ||= Selenium::WebDriver::Chrome::Options.new(browser_options) if browser_options
69
70
  when :firefox
70
- @selenium_opts[:options] = Selenium::WebDriver::Firefox::Options.new(options) if browser_options
71
+ @selenium_opts[:options] = browser_options if browser_options.is_a? Selenium::WebDriver::Firefox::Options
72
+ @selenium_opts[:options] ||= Selenium::WebDriver::Firefox::Options.new(options) if browser_options
71
73
  when :safari
72
74
  @selenium_opts["safari.options"] = {'technologyPreview' => true} if @options[:technology_preview]
73
75
  when :remote
@@ -20,7 +20,7 @@ module WatirSpec
20
20
  gs.each do |guard|
21
21
  guard[:data][:file] = guard[:data][:file][/\/spec\/(.*):/, 1]
22
22
  guard_name = "#{guard[:name]}:".ljust(15)
23
- str << " \t#{guard_name} #{guard[:data].inspect}"
23
+ str << " \t#{guard_name} #{guard[:data].inspect}\n"
24
24
  end
25
25
  Watir.logger.warn str
26
26
  end
@@ -88,6 +88,20 @@ describe Watir::Browser do
88
88
  expect(ua).to eq('foo;bar')
89
89
  new_browser.close
90
90
  end
91
+
92
+ not_compliant_on :headless do
93
+ it "accepts Chrome::Options instance as :options" do
94
+ chrome_opts = Selenium::WebDriver::Chrome::Options.new(emulation: {userAgent: 'foo;bar'})
95
+ @opts.delete :args
96
+ @opts.merge!(options: chrome_opts)
97
+
98
+ new_browser = WatirSpec.new_browser
99
+
100
+ ua = new_browser.execute_script 'return window.navigator.userAgent'
101
+ expect(ua).to eq('foo;bar')
102
+ new_browser.close
103
+ end
104
+ end
91
105
  end
92
106
  end
93
107
 
@@ -149,14 +163,12 @@ describe Watir::Browser do
149
163
  end
150
164
  end
151
165
 
152
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1290814", :firefox do
153
- it "raises an error when trying to interact with a closed browser" do
154
- browser.goto WatirSpec.url_for "definition_lists.html"
155
- browser.close
166
+ it "raises an error when trying to interact with a closed browser" do
167
+ browser.goto WatirSpec.url_for "definition_lists.html"
168
+ browser.close
156
169
 
157
- expect { browser.dl(id: "experience-list").id }.to raise_error(Watir::Exception::Error, "browser was closed")
158
- $browser = WatirSpec.new_browser
159
- end
170
+ expect { browser.dl(id: "experience-list").id }.to raise_error(Watir::Exception::Error, "browser was closed")
171
+ $browser = WatirSpec.new_browser
160
172
  end
161
173
 
162
174
  describe "#wait_while" do
@@ -91,17 +91,15 @@ describe Watir::Element do
91
91
 
92
92
  end
93
93
 
94
- bug "Actions Endpoint Not Yet Implemented", :firefox do
95
- describe "#hover" do
96
- not_compliant_on :internet_explorer, :safari do
97
- it "should hover over the element" do
98
- browser.goto WatirSpec.url_for('hover.html')
99
- link = browser.a
100
-
101
- expect(link.style("font-size")).to eq "10px"
102
- link.hover
103
- expect(link.style("font-size")).to eq "20px"
104
- end
94
+ describe "#hover" do
95
+ not_compliant_on :internet_explorer, :safari, %i(remote firefox) do
96
+ it "should hover over the element" do
97
+ browser.goto WatirSpec.url_for('hover.html')
98
+ link = browser.a
99
+
100
+ expect(link.style("font-size")).to eq "10px"
101
+ link.hover
102
+ expect(link.style("font-size")).to eq "20px"
105
103
  end
106
104
  end
107
105
  end
@@ -70,15 +70,13 @@ describe "Browser::AfterHooks" do
70
70
  expect(@yield).to be true
71
71
  end
72
72
 
73
- bug "AutomatedTester: 'known bug with execute script'", :firefox do
74
- not_compliant_on :safari do
75
- it "runs after_hooks after Element#submit" do
76
- browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
77
- @page_after_hook = Proc.new { @yield = browser.div(id: 'messages').text == 'submit' }
78
- browser.after_hooks.add @page_after_hook
79
- browser.form(id: "new_user").submit
80
- expect(@yield).to be true
81
- end
73
+ not_compliant_on :safari do
74
+ it "runs after_hooks after Element#submit" do
75
+ browser.goto(WatirSpec.url_for("forms_with_input_elements.html"))
76
+ @page_after_hook = Proc.new { @yield = browser.div(id: 'messages').text == 'submit' }
77
+ browser.after_hooks.add @page_after_hook
78
+ browser.form(id: "new_user").submit
79
+ expect(@yield).to be true
82
80
  end
83
81
  end
84
82
 
@@ -92,7 +90,7 @@ describe "Browser::AfterHooks" do
92
90
  end
93
91
  end
94
92
 
95
- bug "Actions Endpoint Not Yet Implemented", :firefox do
93
+ not_compliant_on %i(remote firefox) do
96
94
  it "runs after_hooks after Element#right_click" do
97
95
  browser.goto(WatirSpec.url_for("right_click.html"))
98
96
  @page_after_hook = Proc.new { @yield = browser.title == "Right Click Test" }
@@ -96,13 +96,11 @@ not_compliant_on :headless do
96
96
 
97
97
  context 'prompt' do
98
98
  describe '#set' do
99
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255906", :firefox do
100
- it 'enters text to prompt' do
101
- browser.button(id: 'prompt').click
102
- browser.alert.set 'My Name'
103
- browser.alert.ok
104
- expect(browser.button(id: 'prompt').value).to eq 'My Name'
105
- end
99
+ it 'enters text to prompt' do
100
+ browser.button(id: 'prompt').click
101
+ browser.alert.set 'My Name'
102
+ browser.alert.ok
103
+ expect(browser.button(id: 'prompt').value).to eq 'My Name'
106
104
  end
107
105
  end
108
106
  end
@@ -27,12 +27,10 @@ describe "Browser" do
27
27
  end
28
28
  end
29
29
 
30
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1290814", :firefox do
31
- it "returns false after Browser#close" do
32
- browser.close
33
- expect(browser).to_not exist
34
- $browser = WatirSpec.new_browser
35
- end
30
+ it "returns false after Browser#close" do
31
+ browser.close
32
+ expect(browser).to_not exist
33
+ $browser = WatirSpec.new_browser
36
34
  end
37
35
  end
38
36
 
@@ -134,17 +132,15 @@ describe "Browser" do
134
132
  end
135
133
 
136
134
  describe ".start" do
137
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1290814", :firefox do
138
- it "goes to the given URL and return an instance of itself" do
139
- browser.close
140
- driver, args = WatirSpec.implementation.browser_args
141
- b = Watir::Browser.start(WatirSpec.url_for("non_control_elements.html"), driver, args.dup)
142
-
143
- expect(b).to be_instance_of(Watir::Browser)
144
- expect(b.title).to eq "Non-control elements"
145
- b.close
146
- $browser = WatirSpec.new_browser
147
- end
135
+ it "goes to the given URL and return an instance of itself" do
136
+ browser.close
137
+ driver, args = WatirSpec.implementation.browser_args
138
+ b = Watir::Browser.start(WatirSpec.url_for("non_control_elements.html"), driver, args.dup)
139
+
140
+ expect(b).to be_instance_of(Watir::Browser)
141
+ expect(b.title).to eq "Non-control elements"
142
+ b.close
143
+ $browser = WatirSpec.new_browser
148
144
  end
149
145
  end
150
146
 
@@ -113,19 +113,17 @@ describe "Browser#cookies" do
113
113
  end
114
114
 
115
115
  describe '#load' do
116
- bug "invalid expiration issue", :firefox do
117
- it 'loads cookies from file' do
118
- browser.cookies.clear
119
- browser.cookies.load file
120
- expected = browser.cookies.to_a
121
- actual = YAML.load(IO.read(file))
122
-
123
- # https://code.google.com/p/selenium/issues/detail?id=6834
124
- expected.each { |cookie| cookie.delete(:expires) }
125
- actual.each { |cookie| cookie.delete(:expires) }
126
-
127
- expect(actual).to eq(expected)
128
- end
116
+ it 'loads cookies from file' do
117
+ browser.cookies.clear
118
+ browser.cookies.load file
119
+ expected = browser.cookies.to_a
120
+ actual = YAML.load(IO.read(file))
121
+
122
+ # https://code.google.com/p/selenium/issues/detail?id=6834
123
+ expected.each { |cookie| cookie.delete(:expires) }
124
+ actual.each { |cookie| cookie.delete(:expires) }
125
+
126
+ expect(actual).to eq(expected)
129
127
  end
130
128
  end
131
129
  end
@@ -1,7 +1,7 @@
1
1
  require "watirspec_helper"
2
2
 
3
3
  describe "Element" do
4
- bug "Actions Endpoint Not Yet Implemented", :firefox do
4
+ not_compliant_on %i(remote firefox) do
5
5
  bug "Safari does not strip text", :safari do
6
6
  context "drag and drop" do
7
7
  before { browser.goto WatirSpec.url_for("drag_and_drop.html") }
@@ -15,7 +15,7 @@ describe "Element" do
15
15
  expect(droppable.text).to eq 'Dropped!'
16
16
  end
17
17
 
18
- not_compliant_on :headless do
18
+ not_compliant_on :headless, :firefox do
19
19
  it "can drag and drop an element onto another when draggable is out of viewport" do
20
20
  reposition "draggable"
21
21
  perform_drag_and_drop_on_droppable
@@ -43,7 +43,7 @@ describe "Element" do
43
43
  expect(droppable.text).to eq 'Dropped!'
44
44
  end
45
45
  end
46
-
47
46
  end
47
+
48
48
  end
49
49
  end
@@ -156,7 +156,7 @@ describe "Div" do
156
156
  end
157
157
 
158
158
  not_compliant_on :safari do
159
- bug "Actions Endpoint Not Yet Implemented", :firefox do
159
+ bug "MoveTargetOutOfBoundsError", :firefox do
160
160
  describe "#double_click" do
161
161
  it "fires the ondblclick event" do
162
162
  browser.div(id: 'html_test').double_click
@@ -165,7 +165,7 @@ describe "Div" do
165
165
  end
166
166
  end
167
167
 
168
- bug "Actions Endpoint Not Yet Implemented", :firefox do
168
+ not_compliant_on :firefox do
169
169
  describe "#right_click" do
170
170
  it "fires the oncontextmenu event" do
171
171
  browser.goto(WatirSpec.url_for("right_click.html"))
@@ -151,13 +151,11 @@ describe "Element" do
151
151
  end
152
152
 
153
153
  describe "#focus" do
154
- bug "http://code.google.com/p/selenium/issues/detail?id=157", :firefox do
155
- it "fires the onfocus event for the given element" do
156
- tf = browser.text_field(id: "new_user_occupation")
157
- expect(tf.value).to eq "Developer"
158
- tf.focus
159
- expect(browser.div(id: "onfocus_test").text).to eq "changed by onfocus event"
160
- end
154
+ it "fires the onfocus event for the given element" do
155
+ tf = browser.text_field(id: "new_user_occupation")
156
+ expect(tf.value).to eq "Developer"
157
+ tf.focus
158
+ expect(browser.div(id: "onfocus_test").text).to eq "changed by onfocus event"
161
159
  end
162
160
  end
163
161
 
@@ -173,12 +171,10 @@ describe "Element" do
173
171
  end
174
172
 
175
173
  describe "#fire_event" do
176
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1290966", :firefox do
177
- it "should fire the given event" do
178
- expect(browser.div(id: "onfocus_test").text).to be_empty
179
- browser.text_field(id: "new_user_occupation").fire_event('onfocus')
180
- expect(browser.div(id: "onfocus_test").text).to eq "changed by onfocus event"
181
- end
174
+ it "should fire the given event" do
175
+ expect(browser.div(id: "onfocus_test").text).to be_empty
176
+ browser.text_field(id: "new_user_occupation").fire_event('onfocus')
177
+ expect(browser.div(id: "onfocus_test").text).to eq "changed by onfocus event"
182
178
  end
183
179
  end
184
180
 
@@ -314,50 +310,48 @@ describe "Element" do
314
310
  end
315
311
  end
316
312
 
317
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255906", :firefox do
318
- describe '#send_keys' do
319
- before(:each) do
320
- @c = Selenium::WebDriver::Platform.mac? ? :command : :control
321
- browser.goto(WatirSpec.url_for('keylogger.html'))
322
- end
313
+ describe '#send_keys' do
314
+ before(:each) do
315
+ @c = Selenium::WebDriver::Platform.mac? ? :command : :control
316
+ browser.goto(WatirSpec.url_for('keylogger.html'))
317
+ end
323
318
 
324
- let(:receiver) { browser.text_field(id: 'receiver') }
325
- let(:events) { browser.element(id: 'output').ps.size }
319
+ let(:receiver) { browser.text_field(id: 'receiver') }
320
+ let(:events) { browser.element(id: 'output').ps.size }
326
321
 
327
- it 'sends keystrokes to the element' do
328
- receiver.send_keys 'hello world'
329
- expect(receiver.value).to eq 'hello world'
330
- expect(events).to eq 11
331
- end
322
+ it 'sends keystrokes to the element' do
323
+ receiver.send_keys 'hello world'
324
+ expect(receiver.value).to eq 'hello world'
325
+ expect(events).to eq 11
326
+ end
332
327
 
333
- it 'accepts arbitrary list of arguments' do
334
- receiver.send_keys 'hello', 'world'
335
- expect(receiver.value).to eq 'helloworld'
336
- expect(events).to eq 10
337
- end
328
+ it 'accepts arbitrary list of arguments' do
329
+ receiver.send_keys 'hello', 'world'
330
+ expect(receiver.value).to eq 'helloworld'
331
+ expect(events).to eq 10
332
+ end
333
+
334
+ bug "http://code.google.com/p/chromium/issues/detail?id=93879", :chrome do
335
+ not_compliant_on :safari, :firefox do
336
+ it 'performs key combinations' do
337
+ receiver.send_keys 'foo'
338
+ receiver.send_keys [@c, 'a']
339
+ receiver.send_keys :backspace
340
+ expect(receiver.value).to be_empty
341
+ expect(events).to eq 6
342
+ end
343
+
344
+ it 'performs arbitrary list of key combinations' do
345
+ receiver.send_keys 'foo'
346
+ receiver.send_keys [@c, 'a'], [@c, 'x']
347
+ expect(receiver.value).to be_empty
348
+ expect(events).to eq 7
349
+ end
338
350
 
339
- bug "http://code.google.com/p/chromium/issues/detail?id=93879", :chrome do
340
- not_compliant_on :safari do
341
- it 'performs key combinations' do
342
- receiver.send_keys 'foo'
343
- receiver.send_keys [@c, 'a']
344
- receiver.send_keys :backspace
345
- expect(receiver.value).to be_empty
346
- expect(events).to eq 6
347
- end
348
-
349
- it 'performs arbitrary list of key combinations' do
350
- receiver.send_keys 'foo'
351
- receiver.send_keys [@c, 'a'], [@c, 'x']
352
- expect(receiver.value).to be_empty
353
- expect(events).to eq 7
354
- end
355
-
356
- it 'supports combination of strings and arrays' do
357
- receiver.send_keys 'foo', [@c, 'a'], :backspace
358
- expect(receiver.value).to be_empty
359
- expect(events).to eq 6
360
- end
351
+ it 'supports combination of strings and arrays' do
352
+ receiver.send_keys 'foo', [@c, 'a'], :backspace
353
+ expect(receiver.value).to be_empty
354
+ expect(events).to eq 6
361
355
  end
362
356
  end
363
357
  end
@@ -109,63 +109,59 @@ describe "FileField" do
109
109
 
110
110
  describe "#set" do
111
111
  not_compliant_on :safari do
112
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1260233", :firefox do
113
- it "is able to set a file path in the field and click the upload button and fire the onchange event" do
114
- browser.goto WatirSpec.url_for("forms_with_input_elements.html")
112
+ it "is able to set a file path in the field and click the upload button and fire the onchange event" do
113
+ browser.goto WatirSpec.url_for("forms_with_input_elements.html")
115
114
 
116
- path = File.expand_path(__FILE__)
117
- element = browser.file_field(name: "new_user_portrait")
115
+ path = File.expand_path(__FILE__)
116
+ element = browser.file_field(name: "new_user_portrait")
118
117
 
119
- element.set path
118
+ element.set path
120
119
 
121
- expect(element.value).to include(File.basename(path)) # only some browser will return the full path
122
- expect(messages.first).to include(File.basename(path))
120
+ expect(element.value).to include(File.basename(path)) # only some browser will return the full path
121
+ expect(messages.first).to include(File.basename(path))
123
122
 
124
- browser.button(name: "new_user_submit").click
125
- end
123
+ browser.button(name: "new_user_submit").click
124
+ end
126
125
 
127
- it "raises an error if the file does not exist" do
128
- expect {
129
- browser.file_field.set(File.join(Dir.tmpdir, 'unlikely-to-exist'))
130
- }.to raise_error(Errno::ENOENT)
131
- end
126
+ it "raises an error if the file does not exist" do
127
+ expect {
128
+ browser.file_field.set(File.join(Dir.tmpdir, 'unlikely-to-exist'))
129
+ }.to raise_error(Errno::ENOENT)
132
130
  end
133
131
  end
134
132
  end
135
133
 
136
134
  not_compliant_on :safari do
137
135
  describe "#value=" do
138
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1260233", :firefox do
139
- it "is able to set a file path in the field and click the upload button and fire the onchange event" do
140
- browser.goto WatirSpec.url_for("forms_with_input_elements.html")
136
+ it "is able to set a file path in the field and click the upload button and fire the onchange event" do
137
+ browser.goto WatirSpec.url_for("forms_with_input_elements.html")
141
138
 
142
- path = File.expand_path(__FILE__)
143
- element = browser.file_field(name: "new_user_portrait")
139
+ path = File.expand_path(__FILE__)
140
+ element = browser.file_field(name: "new_user_portrait")
144
141
 
145
- element.value = path
146
- expect(element.value).to include(File.basename(path)) # only some browser will return the full path
147
- end
142
+ element.value = path
143
+ expect(element.value).to include(File.basename(path)) # only some browser will return the full path
144
+ end
148
145
 
149
- not_compliant_on :internet_explorer do
150
- bug "Raises File not found error - File Bug Report", :firefox do
151
- it "does not raise an error if the file does not exist" do
152
- path = File.join(Dir.tmpdir, 'unlikely-to-exist')
153
- browser.file_field.value = path
146
+ not_compliant_on :internet_explorer do
147
+ bug "Raises File not found error - File Bug Report", :firefox do
148
+ it "does not raise an error if the file does not exist" do
149
+ path = File.join(Dir.tmpdir, 'unlikely-to-exist')
150
+ browser.file_field.value = path
154
151
 
155
- expected = path
156
- expected.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows?
152
+ expected = path
153
+ expected.gsub!("/", "\\") if Selenium::WebDriver::Platform.windows?
157
154
 
158
- expect(browser.file_field.value).to include(File.basename(expected)) # only some browser will return the full path
159
- end
155
+ expect(browser.file_field.value).to include(File.basename(expected)) # only some browser will return the full path
160
156
  end
157
+ end
161
158
 
162
- not_compliant_on %i(chrome windows) do
163
- bug "Raises File not found error - File Bug Report", :firefox do
164
- it "does not alter its argument" do
165
- value = '/foo/bar'
166
- browser.file_field.value = value
167
- expect(value).to eq '/foo/bar'
168
- end
159
+ not_compliant_on %i(chrome windows) do
160
+ bug "Raises File not found error - File Bug Report", :firefox do
161
+ it "does not alter its argument" do
162
+ value = '/foo/bar'
163
+ browser.file_field.value = value
164
+ expect(value).to eq '/foo/bar'
169
165
  end
170
166
  end
171
167
  end
@@ -49,22 +49,20 @@ describe "Form" do
49
49
  end
50
50
  end
51
51
 
52
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1290985", :firefox do
53
- describe "#submit" do
54
- it "submits the form" do
55
- browser.form(id: "delete_user").submit
56
- Watir::Wait.until { !browser.url.include? 'forms_with_input_elements.html' }
57
- expect(browser.text).to include("Semantic table")
58
- end
52
+ describe "#submit" do
53
+ it "submits the form" do
54
+ browser.form(id: "delete_user").submit
55
+ Watir::Wait.until { !browser.url.include? 'forms_with_input_elements.html' }
56
+ expect(browser.text).to include("Semantic table")
57
+ end
59
58
 
60
- not_compliant_on :safari do
61
- it "triggers onsubmit event and takes its result into account" do
62
- form = browser.form(name: "user_new")
63
- form.submit
64
- expect(form).to exist
65
- expect(messages.size).to eq 1
66
- expect(messages[0]).to eq "submit"
67
- end
59
+ not_compliant_on :safari do
60
+ it "triggers onsubmit event and takes its result into account" do
61
+ form = browser.form(name: "user_new")
62
+ form.submit
63
+ expect(form).to exist
64
+ expect(messages.size).to eq 1
65
+ expect(messages[0]).to eq "submit"
68
66
  end
69
67
  end
70
68
  end
@@ -10,16 +10,14 @@ describe "IFrame" do
10
10
  browser.goto(WatirSpec.url_for("iframes.html"))
11
11
  end
12
12
 
13
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255906", :firefox do
14
- not_compliant_on :safari do
15
- it "handles crossframe javascript" do
16
- browser.goto WatirSpec.url_for("iframes.html")
17
-
18
- expect(browser.iframe(id: "iframe_1").text_field(name: 'senderElement').value).to eq 'send_this_value'
19
- expect(browser.iframe(id: "iframe_2").text_field(name: 'recieverElement').value).to eq 'old_value'
20
- browser.iframe(id: "iframe_1").button(id: 'send').click
21
- expect(browser.iframe(id: "iframe_2").text_field(name: 'recieverElement').value).to eq 'send_this_value'
22
- end
13
+ not_compliant_on :safari do
14
+ it "handles crossframe javascript" do
15
+ browser.goto WatirSpec.url_for("iframes.html")
16
+
17
+ expect(browser.iframe(id: "iframe_1").text_field(name: 'senderElement').value).to eq 'send_this_value'
18
+ expect(browser.iframe(id: "iframe_2").text_field(name: 'recieverElement').value).to eq 'old_value'
19
+ browser.iframe(id: "iframe_1").button(id: 'send').click
20
+ expect(browser.iframe(id: "iframe_2").text_field(name: 'recieverElement').value).to eq 'send_this_value'
23
21
  end
24
22
  end
25
23
 
@@ -148,11 +146,9 @@ describe "IFrame" do
148
146
  expect { browser.iframe(index: 0).foo }.to raise_error(NoMethodError)
149
147
  end
150
148
 
151
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255906", :firefox do
152
- it "is able to set a field" do
153
- browser.iframe(index: 0).text_field(name: 'senderElement').set("new value")
154
- expect(browser.iframe(index: 0).text_field(name: 'senderElement').value).to eq "new value"
155
- end
149
+ it "is able to set a field" do
150
+ browser.iframe(index: 0).text_field(name: 'senderElement').set("new value")
151
+ expect(browser.iframe(index: 0).text_field(name: 'senderElement').value).to eq "new value"
156
152
  end
157
153
 
158
154
  describe "#execute_script" do
@@ -140,24 +140,22 @@ describe "Image" do
140
140
  end
141
141
 
142
142
  # Other
143
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1297339", :firefox do
144
- describe "#loaded?" do
145
- it "returns true if the image has been loaded" do
146
- expect(browser.image(title: 'Circle')).to be_loaded
147
- expect(browser.image(alt: 'circle')).to be_loaded
148
- expect(browser.image(alt: /circle/)).to be_loaded
149
- end
150
-
151
- it "returns false if the image has not been loaded" do
152
- expect(browser.image(id: 'no_such_file')).to_not be_loaded
153
- end
154
-
155
- it "raises UnknownObjectException if the image doesn't exist" do
156
- expect { browser.image(id: 'no_such_image').loaded? }.to raise_unknown_object_exception
157
- expect { browser.image(src: 'no_such_image').loaded? }.to raise_unknown_object_exception
158
- expect { browser.image(alt: 'no_such_image').loaded? }.to raise_unknown_object_exception
159
- expect { browser.image(index: 1337).loaded? }.to raise_unknown_object_exception
160
- end
143
+ describe "#loaded?" do
144
+ it "returns true if the image has been loaded" do
145
+ expect(browser.image(title: 'Circle')).to be_loaded
146
+ expect(browser.image(alt: 'circle')).to be_loaded
147
+ expect(browser.image(alt: /circle/)).to be_loaded
148
+ end
149
+
150
+ it "returns false if the image has not been loaded" do
151
+ expect(browser.image(id: 'no_such_file')).to_not be_loaded
152
+ end
153
+
154
+ it "raises UnknownObjectException if the image doesn't exist" do
155
+ expect { browser.image(id: 'no_such_image').loaded? }.to raise_unknown_object_exception
156
+ expect { browser.image(src: 'no_such_image').loaded? }.to raise_unknown_object_exception
157
+ expect { browser.image(alt: 'no_such_image').loaded? }.to raise_unknown_object_exception
158
+ expect { browser.image(index: 1337).loaded? }.to raise_unknown_object_exception
161
159
  end
162
160
  end
163
161
 
@@ -90,13 +90,11 @@ describe "SelectList" do
90
90
  end
91
91
 
92
92
  describe "#value" do
93
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
94
- not_compliant_on :safari do
95
- it "returns the value of the selected option" do
96
- expect(browser.select_list(index: 0).value).to eq "2"
97
- browser.select_list(index: 0).select(/Sweden/)
98
- expect(browser.select_list(index: 0).value).to eq "3"
99
- end
93
+ not_compliant_on :safari do
94
+ it "returns the value of the selected option" do
95
+ expect(browser.select_list(index: 0).value).to eq "2"
96
+ browser.select_list(index: 0).select(/Sweden/)
97
+ expect(browser.select_list(index: 0).value).to eq "3"
100
98
  end
101
99
  end
102
100
 
@@ -185,12 +183,10 @@ describe "SelectList" do
185
183
  end
186
184
 
187
185
  describe "#clear" do
188
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
189
- not_compliant_on :safari do
190
- it "clears the selection when possible" do
191
- browser.select_list(name: "new_user_languages").clear
192
- expect(browser.select_list(name: "new_user_languages").selected_options).to be_empty
193
- end
186
+ not_compliant_on :safari do
187
+ it "clears the selection when possible" do
188
+ browser.select_list(name: "new_user_languages").clear
189
+ expect(browser.select_list(name: "new_user_languages").selected_options).to be_empty
194
190
  end
195
191
  end
196
192
 
@@ -207,11 +203,9 @@ describe "SelectList" do
207
203
  end
208
204
 
209
205
  not_compliant_on :safari do
210
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
211
- it "fires onchange event" do
212
- browser.select_list(name: "new_user_languages").clear
213
- expect(messages.size).to eq 2
214
- end
206
+ it "fires onchange event" do
207
+ browser.select_list(name: "new_user_languages").clear
208
+ expect(messages.size).to eq 2
215
209
  end
216
210
 
217
211
  it "doesn't fire onchange event for already cleared option" do
@@ -237,22 +231,18 @@ describe "SelectList" do
237
231
 
238
232
  not_compliant_on :safari do
239
233
  describe "#selected?" do
240
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
241
- it "returns true if the given option is selected by text" do
242
- browser.select_list(name: 'new_user_country').select('Denmark')
243
- expect(browser.select_list(name: 'new_user_country')).to be_selected('Denmark')
244
- end
234
+ it "returns true if the given option is selected by text" do
235
+ browser.select_list(name: 'new_user_country').select('Denmark')
236
+ expect(browser.select_list(name: 'new_user_country')).to be_selected('Denmark')
245
237
  end
246
238
 
247
239
  it "returns false if the given option is not selected by text" do
248
240
  expect(browser.select_list(name: 'new_user_country')).to_not be_selected('Sweden')
249
241
  end
250
242
 
251
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
252
- it "returns true if the given option is selected by label" do
253
- browser.select_list(name: 'new_user_country').select('Germany')
254
- expect(browser.select_list(name: 'new_user_country')).to be_selected('Germany')
255
- end
243
+ it "returns true if the given option is selected by label" do
244
+ browser.select_list(name: 'new_user_country').select('Germany')
245
+ expect(browser.select_list(name: 'new_user_country')).to be_selected('Germany')
256
246
  end
257
247
 
258
248
  it "returns false if the given option is not selected by label" do
@@ -267,51 +257,49 @@ describe "SelectList" do
267
257
 
268
258
  not_compliant_on :safari do
269
259
  describe "#select" do
270
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
271
- context "when interacting with options" do
272
- it "selects the given item when given a String" do
273
- browser.select_list(name: "new_user_country").select("Denmark")
274
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
275
- end
276
-
277
- it "selects options by label" do
278
- browser.select_list(name: "new_user_country").select("Germany")
279
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Germany"]
280
- end
281
-
282
- it "selects the given item when given a Regexp" do
283
- browser.select_list(name: "new_user_country").select(/Denmark/)
284
- expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
285
- end
286
-
287
- it "selects the given item when given an Xpath" do
288
- browser.select_list(xpath: "//select[@name='new_user_country']").select("Denmark")
289
- expect(browser.select_list(xpath: "//select[@name='new_user_country']").selected_options.map(&:text)).to eq ["Denmark"]
290
- end
291
-
292
- it "selects multiple items using :name and a String" do
293
- browser.select_list(name: "new_user_languages").clear
294
- browser.select_list(name: "new_user_languages").select("Danish")
295
- browser.select_list(name: "new_user_languages").select("Swedish")
296
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
297
- end
298
-
299
- it "selects multiple items using :name and a Regexp" do
300
- browser.select_list(name: "new_user_languages").clear
301
- browser.select_list(name: "new_user_languages").select_all(/ish/)
302
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "English", "Swedish"]
303
- end
304
-
305
- it "selects multiple items using :xpath" do
306
- browser.select_list(xpath: "//select[@name='new_user_languages']").clear
307
- browser.select_list(xpath: "//select[@name='new_user_languages']").select_all(/ish/)
308
- expect(browser.select_list(xpath: "//select[@name='new_user_languages']").selected_options.map(&:text)).to eq ["Danish", "English", "Swedish"]
309
- end
310
-
311
- it "selects empty options" do
312
- browser.select_list(id: "delete_user_username").select("")
313
- expect(browser.select_list(id: "delete_user_username").selected_options.map(&:text)).to eq [""]
314
- end
260
+ context "when interacting with options" do
261
+ it "selects the given item when given a String" do
262
+ browser.select_list(name: "new_user_country").select("Denmark")
263
+ expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
264
+ end
265
+
266
+ it "selects options by label" do
267
+ browser.select_list(name: "new_user_country").select("Germany")
268
+ expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Germany"]
269
+ end
270
+
271
+ it "selects the given item when given a Regexp" do
272
+ browser.select_list(name: "new_user_country").select(/Denmark/)
273
+ expect(browser.select_list(name: "new_user_country").selected_options.map(&:text)).to eq ["Denmark"]
274
+ end
275
+
276
+ it "selects the given item when given an Xpath" do
277
+ browser.select_list(xpath: "//select[@name='new_user_country']").select("Denmark")
278
+ expect(browser.select_list(xpath: "//select[@name='new_user_country']").selected_options.map(&:text)).to eq ["Denmark"]
279
+ end
280
+
281
+ it "selects multiple items using :name and a String" do
282
+ browser.select_list(name: "new_user_languages").clear
283
+ browser.select_list(name: "new_user_languages").select("Danish")
284
+ browser.select_list(name: "new_user_languages").select("Swedish")
285
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "Swedish"]
286
+ end
287
+
288
+ it "selects multiple items using :name and a Regexp" do
289
+ browser.select_list(name: "new_user_languages").clear
290
+ browser.select_list(name: "new_user_languages").select_all(/ish/)
291
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq ["Danish", "English", "Swedish"]
292
+ end
293
+
294
+ it "selects multiple items using :xpath" do
295
+ browser.select_list(xpath: "//select[@name='new_user_languages']").clear
296
+ browser.select_list(xpath: "//select[@name='new_user_languages']").select_all(/ish/)
297
+ expect(browser.select_list(xpath: "//select[@name='new_user_languages']").selected_options.map(&:text)).to eq ["Danish", "English", "Swedish"]
298
+ end
299
+
300
+ it "selects empty options" do
301
+ browser.select_list(id: "delete_user_username").select("")
302
+ expect(browser.select_list(id: "delete_user_username").selected_options.map(&:text)).to eq [""]
315
303
  end
316
304
  end
317
305
  end
@@ -330,15 +318,13 @@ describe "SelectList" do
330
318
  expect(messages).to eq ['changed language']
331
319
  end
332
320
 
333
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
334
- it "doesn't fire onchange event when selecting an already selected item" do
335
- browser.select_list(id: "new_user_languages").clear # removes the two pre-selected options
336
- browser.select_list(id: "new_user_languages").select("English")
337
- expect(messages.size).to eq 3
321
+ it "doesn't fire onchange event when selecting an already selected item" do
322
+ browser.select_list(id: "new_user_languages").clear # removes the two pre-selected options
323
+ browser.select_list(id: "new_user_languages").select("English")
324
+ expect(messages.size).to eq 3
338
325
 
339
- browser.select_list(id: "new_user_languages").select("English")
340
- expect(messages.size).to eq 3
341
- end
326
+ browser.select_list(id: "new_user_languages").select("English")
327
+ expect(messages.size).to eq 3
342
328
  end
343
329
  end
344
330
 
@@ -346,11 +332,9 @@ describe "SelectList" do
346
332
  expect(browser.select_list(id: "new_user_languages").select("English")).to eq "English"
347
333
  end
348
334
 
349
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
350
- not_compliant_on :safari do
351
- it "returns an empty string when selecting an option that disappears when selected" do
352
- expect(browser.select_list(id: 'obsolete').select('sweden')).to eq ''
353
- end
335
+ not_compliant_on :safari do
336
+ it "returns an empty string when selecting an option that disappears when selected" do
337
+ expect(browser.select_list(id: 'obsolete').select('sweden')).to eq ''
354
338
  end
355
339
  end
356
340
 
@@ -381,12 +365,10 @@ describe "SelectList" do
381
365
  expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq %w[English]
382
366
  end
383
367
 
384
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1255957", :firefox do
385
- it "selects the items by value regexp" do
386
- browser.select_list(name: "new_user_languages").clear
387
- browser.select_list(name: "new_user_languages").select_value(/1|3/)
388
- expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq %w[Danish Norwegian]
389
- end
368
+ it "selects the items by value regexp" do
369
+ browser.select_list(name: "new_user_languages").clear
370
+ browser.select_list(name: "new_user_languages").select_value(/1|3/)
371
+ expect(browser.select_list(name: "new_user_languages").selected_options.map(&:text)).to eq %w[Danish Norwegian]
390
372
  end
391
373
 
392
374
  it "raises NoValueFoundException if the option doesn't exist" do
@@ -183,11 +183,9 @@ describe "TextField" do
183
183
  end
184
184
 
185
185
  describe "#readonly?" do
186
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1200366", :firefox do
187
- it "returns true for read-only text fields" do
188
- expect(browser.text_field(name: "new_user_code")).to be_readonly
189
- expect(browser.text_field(id: "new_user_code")).to be_readonly
190
- end
186
+ it "returns true for read-only text fields" do
187
+ expect(browser.text_field(name: "new_user_code")).to be_readonly
188
+ expect(browser.text_field(id: "new_user_code")).to be_readonly
191
189
  end
192
190
 
193
191
  it "returns false for writable text fields" do
@@ -242,10 +240,8 @@ describe "TextField" do
242
240
  expect { browser.text_field(id: "no_such_id").clear }.to raise_unknown_object_exception
243
241
  end
244
242
 
245
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1200366", :firefox do
246
- it "raises ObjectReadOnlyException if the object is read only" do
247
- expect { browser.text_field(id: "new_user_code").clear }.to raise_object_read_only_exception
248
- end
243
+ it "raises ObjectReadOnlyException if the object is read only" do
244
+ expect { browser.text_field(id: "new_user_code").clear }.to raise_object_read_only_exception
249
245
  end
250
246
  end
251
247
 
@@ -36,11 +36,9 @@ describe "TableRow" do
36
36
 
37
37
  describe "#click" do
38
38
  bug "http://github.com/watir/watir/issues/issue/32", :internet_explorer, :chrome do
39
- not_compliant_on :firefox do
40
- it "fires the row's onclick event" do
41
- browser.tr(id: 'inner_first').click
42
- expect(messages).to include('tr')
43
- end
39
+ it "fires the row's onclick event" do
40
+ browser.tr(id: 'inner_first').click
41
+ expect(messages).to include('tr')
44
42
  end
45
43
  end
46
44
  end
@@ -108,27 +108,25 @@ describe "Window" do
108
108
  browser.windows[1..-1].each(&:close)
109
109
  end
110
110
 
111
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1280517", :firefox do
112
- not_compliant_on :safari do
113
- describe "#close" do
114
- it "closes a window" do
115
- browser.a(id: "open").click
116
- Watir::Wait.until { browser.windows.size == 3 }
117
-
118
- browser.window(title: "closeable window").close
119
- expect(browser.windows.size).to eq 2
120
- end
121
- end
122
-
123
- it "closes the current window" do
111
+ not_compliant_on :safari, %i(firefox linux) do
112
+ describe "#close" do
113
+ it "closes a window" do
124
114
  browser.a(id: "open").click
125
115
  Watir::Wait.until { browser.windows.size == 3 }
126
116
 
127
- window = browser.window(title: "closeable window").use
128
- window.close
117
+ browser.window(title: "closeable window").close
129
118
  expect(browser.windows.size).to eq 2
130
119
  end
131
120
  end
121
+
122
+ it "closes the current window" do
123
+ browser.a(id: "open").click
124
+ Watir::Wait.until { browser.windows.size == 3 }
125
+
126
+ window = browser.window(title: "closeable window").use
127
+ window.close
128
+ expect(browser.windows.size).to eq 2
129
+ end
132
130
  end
133
131
 
134
132
  describe "#use" do
@@ -256,21 +254,19 @@ describe "Window" do
256
254
 
257
255
  not_compliant_on :headless do
258
256
  describe "#use" do
259
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1223277", :firefox do
260
- it "raises NoMatchingWindowFoundException error when attempting to use a referenced window that is closed" do
261
- original_window = browser.window
262
- browser.window(index: 1).use
263
- original_window.close
264
- expect { original_window.use }.to raise_no_matching_window_exception
265
- end
257
+ it "raises NoMatchingWindowFoundException error when attempting to use a referenced window that is closed" do
258
+ original_window = browser.window
259
+ browser.window(index: 1).use
260
+ original_window.close
261
+ expect { original_window.use }.to raise_no_matching_window_exception
262
+ end
266
263
 
267
- bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1223277", :firefox do
268
- it "raises NoMatchingWindowFoundException error when attempting to use the current window if it is closed" do
269
- browser.window(title: "closeable window").use
270
- browser.a(id: "close").click
271
- Watir::Wait.until { browser.windows.size == 1 }
272
- expect { browser.window.use }.to raise_no_matching_window_exception
273
- end
264
+ bug "https://bugzilla.mozilla.org/show_bug.cgi?id=1223277", :firefox do
265
+ it "raises NoMatchingWindowFoundException error when attempting to use the current window if it is closed" do
266
+ browser.window(title: "closeable window").use
267
+ browser.a(id: "close").click
268
+ Watir::Wait.until { browser.windows.size == 1 }
269
+ expect { browser.window.use }.to raise_no_matching_window_exception
274
270
  end
275
271
  end
276
272
  end
@@ -351,22 +347,20 @@ describe "Window" do
351
347
  browser.goto WatirSpec.url_for("window_switching.html")
352
348
  end
353
349
 
354
- compliant_on :chrome do
355
- not_compliant_on :headless do
356
- it "should get the size of the current window" do
357
- size = browser.window.size
350
+ not_compliant_on :headless do
351
+ it "should get the size of the current window" do
352
+ size = browser.window.size
358
353
 
359
- expect(size.width).to be > 0
360
- expect(size.height).to be > 0
361
- end
354
+ expect(size.width).to be > 0
355
+ expect(size.height).to be > 0
362
356
  end
357
+ end
363
358
 
364
- it "should get the position of the current window" do
365
- pos = browser.window.position
359
+ it "should get the position of the current window" do
360
+ pos = browser.window.position
366
361
 
367
- expect(pos.x).to be >= 0
368
- expect(pos.y).to be >= 0
369
- end
362
+ expect(pos.x).to be >= 0
363
+ expect(pos.y).to be >= 0
370
364
  end
371
365
 
372
366
  not_compliant_on :headless do
@@ -386,7 +380,7 @@ describe "Window" do
386
380
  end
387
381
  end
388
382
 
389
- not_compliant_on :firefox, :headless do
383
+ not_compliant_on :headless, %i(remote firefox) do
390
384
  it "should move the window" do
391
385
  initial_pos = browser.window.position
392
386
 
@@ -403,7 +397,7 @@ describe "Window" do
403
397
 
404
398
  not_compliant_on :headless do
405
399
  compliant_on :window_manager do
406
- bug "https://github.com/SeleniumHQ/selenium/issues/2856", %i(remote firefox) do
400
+ bug "https://github.com/SeleniumHQ/selenium/issues/2856", :firefox do
407
401
  it "should maximize the window" do
408
402
  initial_size = browser.window.size
409
403
  browser.window.resize_to(
@@ -20,6 +20,7 @@ YARD::Doctest.configure do |doctest|
20
20
  doctest.skip 'Watir::Screenshot'
21
21
  doctest.skip 'Watir::Window#size'
22
22
  doctest.skip 'Watir::Window#position'
23
+ doctest.skip 'Watir::Window#maximize'
23
24
 
24
25
  doctest.before do
25
26
  WatirSpec.run!
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'watir'
5
- s.version = '6.6.0'
5
+ s.version = '6.6.1'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.authors = ['Alex Rodionov', 'Titus Fortner']
8
8
  s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.6.0
4
+ version: 6.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-02 00:00:00.000000000 Z
12
+ date: 2017-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: selenium-webdriver