|
21 | 21 |
|
22 | 22 | describe "Selenium::WebDriver::TargetLocator" do |
23 | 23 | 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 |
30 | 25 | end |
31 | 26 |
|
32 | 27 | let(:new_window) { driver.window_handles.find { |handle| handle != driver.window_handle } } |
|
117 | 112 | expect(driver.title).to eq("We Arrive Here") |
118 | 113 | end |
119 | 114 |
|
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") |
128 | 117 |
|
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") |
133 | 121 |
|
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 |
136 | 125 | end |
| 126 | + |
| 127 | + expect(driver.current_url).to include("xhtmlTest.html") |
| 128 | + expect(driver.title).to eq("XHTML Test Page") |
137 | 129 | end |
138 | 130 |
|
139 | 131 | # Marionette BUG: Automatically switches browsing context to new window when it opens. |
140 | 132 | not_compliant_on :browser => [:marionette, :ie] do |
141 | 133 | 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 |
147 | 134 |
|
148 | 135 | it "should close current window when more than two windows exist" do |
149 | 136 | driver.navigate.to url_for("xhtmlTest.html") |
|
207 | 194 | end |
208 | 195 | end |
209 | 196 |
|
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 } |
219 | 201 |
|
220 | | - driver.close |
| 202 | + driver.switch_to.window(new_window) |
| 203 | + wait.until { driver.title == "We Arrive Here" } |
221 | 204 |
|
222 | | - driver.switch_to.window(driver.window_handles.first) do |
223 | | - wait.until { driver.title == "XHTML Test Page" } |
224 | | - end |
| 205 | + driver.close |
225 | 206 |
|
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" } |
227 | 209 | end |
| 210 | + |
| 211 | + expect(driver.title).to eq("XHTML Test Page") |
228 | 212 | end |
229 | 213 | end |
230 | 214 |
|
|
240 | 224 | end |
241 | 225 |
|
242 | 226 | # 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 |
244 | 228 | describe "alerts" do |
245 | 229 |
|
246 | 230 | it "allows the user to accept an alert" do |
|
249 | 233 |
|
250 | 234 | alert = wait_for_alert |
251 | 235 | alert.accept |
| 236 | + wait_for_no_alert |
252 | 237 |
|
253 | 238 | expect(driver.title).to eq("Testing Alerts") |
254 | 239 | end |
|
260 | 245 |
|
261 | 246 | alert = wait_for_alert |
262 | 247 | alert.dismiss |
263 | | - |
264 | 248 | wait_for_no_alert |
265 | 249 |
|
266 | 250 | expect(driver.title).to eq("Testing Alerts") |
|
271 | 255 | # Says message should be an array (I think), but we're getting |
272 | 256 | # InvalidArgumentError: 'message' not a string |
273 | 257 | # 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 |
275 | 260 | it "allows the user to set the value of a prompt" do |
276 | 261 | driver.navigate.to url_for("alerts.html") |
277 | 262 | driver.find_element(:id => "prompt").click |
|
298 | 283 |
|
299 | 284 | it "raises when calling #text on a closed alert" do |
300 | 285 | driver.navigate.to url_for("alerts.html") |
| 286 | + wait_for_element(:id => "alert") |
| 287 | + |
301 | 288 | driver.find_element(:id => "alert").click |
302 | 289 |
|
303 | 290 | alert = wait_for_alert |
304 | 291 | alert.accept |
305 | 292 |
|
| 293 | + wait_for_no_alert |
306 | 294 | expect { alert.text }.to raise_error(Selenium::WebDriver::Error::NoSuchAlertError) |
307 | 295 | end |
308 | 296 |
|
|
0 commit comments