Skip to content

Commit b73ca5d

Browse files
committed
rb - spec updates for latest Microsoft Edge support
1 parent 26feb45 commit b73ca5d

5 files changed

Lines changed: 40 additions & 55 deletions

File tree

rb/lib/selenium/webdriver/edge/legacy_support.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ module Edge
2424
module LegacySupport
2525

2626
# These are commands Edge is still using from JSON Wire Protocol
27-
[:executeScript, :executeAsyncScript, :submitElement, :doubleClick, :mouseDown, :mouseUp, :mouseMoveTo,
28-
:click, :sendKeysToActiveElement, :getWindowHandles, :getCurrentWindowHandle, :getWindowSize,
29-
:setWindowSize, :getWindowPosition, :setWindowPosition, :maximizeWindow].each do |cmd|
27+
[:executeScript, :executeAsyncScript, :submitElement, :doubleClick, :mouseDown, :mouseUp, :mouseMoveTo, :click,
28+
:sendKeysToActiveElement, :getWindowHandles, :getCurrentWindowHandle, :getWindowSize, :setWindowSize,
29+
:getWindowPosition, :setWindowPosition, :maximizeWindow, :getAlertText, :dismissAlert].each do |cmd|
3030
jwp = Remote::Bridge::COMMANDS[cmd]
3131
Remote::W3CBridge.command(cmd, jwp.first, jwp.last)
3232
end

rb/spec/integration/selenium/client/api/screenshot_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
expect(page.get_html_source).to match(/<head>/)
2626
end
2727

28-
# Raising Java Error on Windows
29-
xit "captures PNG screenshot OS viewport as a file on Selenium RC local filesystem" do
28+
it "captures PNG screenshot OS viewport as a file on Selenium RC local filesystem" do
3029
tempfile = File.join(Dir.tmpdir, "selenium_screenshot.png")
3130

3231
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
@@ -39,8 +38,7 @@
3938
end
4039
end
4140

42-
# Raising Java Error on Windows
43-
xit "captures PNG screenshot OS viewport as a Base64 encoded PNG image" do
41+
it "captures PNG screenshot OS viewport as a Base64 encoded PNG image" do
4442
page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html"
4543
encodedImage = page.capture_screenshot_to_string
4644
pngImage = Base64.decode64(encodedImage)

rb/spec/integration/selenium/webdriver/target_locator_spec.rb

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@
2121

2222
describe "Selenium::WebDriver::TargetLocator" do
2323
after do
24-
compliant_on :browser => :edge do #https://connect.microsoft.com/IE/Feedback/Details/1853708
25-
driver.switch_to.default_content
26-
end
27-
not_compliant_on :browser => :edge do #https://connect.microsoft.com/IE/Feedback/Details/1850028
28-
ensure_single_window
29-
end
24+
ensure_single_window
3025
end
3126

3227
let(:new_window) { driver.window_handles.find { |handle| handle != driver.window_handle } }
@@ -117,33 +112,25 @@
117112
expect(driver.title).to eq("We Arrive Here")
118113
end
119114

120-
# Edge BUG - https://connect.microsoft.com/IE/feedback/details/1850028
121-
not_compliant_on :browser => :edge do
122-
it "should use the original window if the block closes the popup" do
123-
driver.navigate.to url_for("xhtmlTest.html")
124-
125-
driver.find_element(:link, "Open new window").click
126-
wait.until { driver.window_handles.size == 2 }
127-
expect(driver.title).to eq("XHTML Test Page")
115+
it "should use the original window if the block closes the popup" do
116+
driver.navigate.to url_for("xhtmlTest.html")
128117

129-
driver.switch_to.window(new_window) do
130-
wait.until { driver.title == "We Arrive Here" }
131-
driver.close
132-
end
118+
driver.find_element(:link, "Open new window").click
119+
wait.until { driver.window_handles.size == 2 }
120+
expect(driver.title).to eq("XHTML Test Page")
133121

134-
expect(driver.current_url).to include("xhtmlTest.html")
135-
expect(driver.title).to eq("XHTML Test Page")
122+
driver.switch_to.window(new_window) do
123+
wait.until { driver.title == "We Arrive Here" }
124+
driver.close
136125
end
126+
127+
expect(driver.current_url).to include("xhtmlTest.html")
128+
expect(driver.title).to eq("XHTML Test Page")
137129
end
138130

139131
# Marionette BUG: Automatically switches browsing context to new window when it opens.
140132
not_compliant_on :browser => [:marionette, :ie] do
141133
context "with more than two windows" do
142-
before do
143-
compliant_on :browser => [:chrome, :edge] do
144-
reset_driver!(1)
145-
end
146-
end
147134

148135
it "should close current window when more than two windows exist" do
149136
driver.navigate.to url_for("xhtmlTest.html")
@@ -207,24 +194,21 @@
207194
end
208195
end
209196

210-
# Edge BUG - https://connect.microsoft.com/IE/feedback/details/1850028
211-
not_compliant_on :browser => :edge do
212-
it "should switch to a window and execute a block when current window is closed" do
213-
driver.navigate.to url_for("xhtmlTest.html")
214-
driver.find_element(:link, "Open new window").click
215-
wait.until { driver.window_handles.size == 2 }
216-
217-
driver.switch_to.window(new_window)
218-
wait.until { driver.title == "We Arrive Here" }
197+
it "should switch to a window and execute a block when current window is closed" do
198+
driver.navigate.to url_for("xhtmlTest.html")
199+
driver.find_element(:link, "Open new window").click
200+
wait.until { driver.window_handles.size == 2 }
219201

220-
driver.close
202+
driver.switch_to.window(new_window)
203+
wait.until { driver.title == "We Arrive Here" }
221204

222-
driver.switch_to.window(driver.window_handles.first) do
223-
wait.until { driver.title == "XHTML Test Page" }
224-
end
205+
driver.close
225206

226-
expect(driver.title).to eq("XHTML Test Page")
207+
driver.switch_to.window(driver.window_handles.first) do
208+
wait.until { driver.title == "XHTML Test Page" }
227209
end
210+
211+
expect(driver.title).to eq("XHTML Test Page")
228212
end
229213
end
230214

@@ -240,7 +224,7 @@
240224
end
241225

242226
# Edge BUG - https://connect.microsoft.com/IE/feedback/details/1850030
243-
not_compliant_on :browser => [:iphone, :safari, :phantomjs, :edge] do
227+
not_compliant_on :browser => [:iphone, :safari, :phantomjs] do
244228
describe "alerts" do
245229

246230
it "allows the user to accept an alert" do
@@ -249,6 +233,7 @@
249233

250234
alert = wait_for_alert
251235
alert.accept
236+
wait_for_no_alert
252237

253238
expect(driver.title).to eq("Testing Alerts")
254239
end
@@ -260,7 +245,6 @@
260245

261246
alert = wait_for_alert
262247
alert.dismiss
263-
264248
wait_for_no_alert
265249

266250
expect(driver.title).to eq("Testing Alerts")
@@ -271,7 +255,8 @@
271255
# Says message should be an array (I think), but we're getting
272256
# InvalidArgumentError: 'message' not a string
273257
# When trying a string, error: keysToSend.join is not a function
274-
not_compliant_on :browser => :marionette do
258+
# Edge Under Consideration - https://dev.windows.com/en-us/microsoft-edge/platform/status/webdriver/details/
259+
not_compliant_on :browser => [:marionette, :edge] do
275260
it "allows the user to set the value of a prompt" do
276261
driver.navigate.to url_for("alerts.html")
277262
driver.find_element(:id => "prompt").click
@@ -298,11 +283,14 @@
298283

299284
it "raises when calling #text on a closed alert" do
300285
driver.navigate.to url_for("alerts.html")
286+
wait_for_element(:id => "alert")
287+
301288
driver.find_element(:id => "alert").click
302289

303290
alert = wait_for_alert
304291
alert.accept
305292

293+
wait_for_no_alert
306294
expect { alert.text }.to raise_error(Selenium::WebDriver::Error::NoSuchAlertError)
307295
end
308296

rb/spec/integration/selenium/webdriver/timeout_spec.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,11 @@
7676
end
7777
end
7878

79-
not_compliant_on :browser => :edge do
80-
context "page loads" do
81-
after { driver.manage.timeouts.page_load = -1 }
79+
context "page loads" do
80+
after { driver.manage.timeouts.page_load = 0 }
8281

83-
it "should be able to set the page load timeout" do
84-
expect { driver.manage.timeouts.page_load = 2 }.to_not raise_exception
85-
end
82+
it "should be able to set the page load timeout" do
83+
expect { driver.manage.timeouts.page_load = 2 }.to_not raise_exception
8684
end
8785
end
8886
end

rb/spec/integration/selenium/webdriver/window_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ module WebDriver
9191
end
9292

9393
compliant_on :browser => [:marionette, :edge] do
94+
# Edge: Not Yet - https://dev.windows.com/en-us/microsoft-edge/platform/status/webdriver/details/
9495
not_compliant_on :browser => [:marionette, :edge] do
9596
it "can make window full screen" do
9697
window.maximize

0 commit comments

Comments
 (0)