Skip to content

Commit 08b3864

Browse files
committed
[java] update and fix tests
1 parent d62a05a commit 08b3864

10 files changed

Lines changed: 101 additions & 364 deletions

java/test/org/openqa/selenium/AlertsTest.java

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.openqa.selenium.testing.Ignore;
3838
import org.openqa.selenium.testing.JUnit4TestBase;
3939
import org.openqa.selenium.testing.NoDriverAfterTest;
40-
import org.openqa.selenium.testing.NotYetImplemented;
4140
import org.openqa.selenium.testing.SwitchToTopAfterTest;
4241

4342
import java.util.Set;
@@ -130,21 +129,6 @@ public void testShouldAllowUsersToAcceptAnAlertWithNoTextManually() {
130129
assertThat(driver.getTitle()).isEqualTo("Testing Alerts");
131130
}
132131

133-
@Test
134-
public void testShouldGetTextOfAlertOpenedInSetTimeout() {
135-
driver.get(appServer.create(new Page()
136-
.withTitle("Testing Alerts")
137-
.withScripts(
138-
"function slowAlert() { window.setTimeout(function(){ alert('Slow'); }, 200); }")
139-
.withBody(
140-
"<a href='#' id='slow-alert' onclick='slowAlert();'>click me</a>")));
141-
142-
driver.findElement(By.id("slow-alert")).click();
143-
Alert alert = wait.until(alertIsPresent());
144-
145-
assertThat(alert.getText()).isEqualTo("Slow");
146-
}
147-
148132
@Test
149133
public void testShouldAllowUsersToDismissAnAlertManually() {
150134
driver.get(alertPage("cheese"));
@@ -182,7 +166,6 @@ public void testShouldAllowAUserToDismissAPrompt() {
182166
}
183167

184168
@Test
185-
@Ignore(value = FIREFOX, reason = "Hangs")
186169
public void testShouldAllowAUserToSetTheValueOfAPrompt() {
187170
driver.get(promptPage(null));
188171

@@ -195,7 +178,6 @@ public void testShouldAllowAUserToSetTheValueOfAPrompt() {
195178
}
196179

197180
@Test
198-
@Ignore(value = FIREFOX, reason = "Firefox is incorrectly returning an UnsupportedOperationException")
199181
public void testSettingTheValueOfAnAlertThrows() {
200182
driver.get(alertPage("cheese"));
201183

@@ -362,7 +344,6 @@ public void testHandlesTwoAlertsFromOneInteraction() {
362344
}
363345

364346
@Test
365-
@Ignore(value = FIREFOX, reason = "Hangs")
366347
public void testShouldHandleAlertOnPageLoad() {
367348
String pageWithOnLoad = appServer.create(new Page()
368349
.withOnLoad("javascript:alert(\"onload\")")
@@ -396,7 +377,6 @@ public void testShouldHandleAlertOnPageLoadUsingGet() {
396377
@Test
397378
@Ignore(value = CHROME, reason = "Hangs")
398379
@Ignore(value = EDGE, reason = "Hangs")
399-
@Ignore(value = IE, reason = "Fails in versions 6 and 7")
400380
@Ignore(SAFARI)
401381
@NoDriverAfterTest
402382
public void testShouldNotHandleAlertInAnotherWindow() {
@@ -415,27 +395,9 @@ public void testShouldNotHandleAlertInAnotherWindow() {
415395
.isThrownBy(() -> wait.until(alertIsPresent()));
416396
}
417397

418-
@Test
419-
@Ignore(value = HTMLUNIT, reason = "Non W3C conformant")
420-
@Ignore(value = CHROME, reason = "Non W3C conformant")
421-
@Ignore(value = EDGE, reason = "Non W3C conformant")
422-
public void testShouldImplicitlyHandleAlertOnPageBeforeUnload() {
423-
String blank = appServer.create(new Page().withTitle("Success"));
424-
driver.get(appServer.create(new Page()
425-
.withTitle("Page with onbeforeunload handler")
426-
.withBody(String.format(
427-
"<a id='link' href='%s'>Click here to navigate to another page.</a>", blank))));
428-
429-
setSimpleOnBeforeUnload("onbeforeunload message");
430-
431-
driver.findElement(By.id("link")).click();
432-
wait.until(titleIs("Success"));
433-
}
434-
435398
@Test
436399
@Ignore(value = HTMLUNIT, reason = "https://github.com/SeleniumHQ/htmlunit-driver/issues/57")
437-
@NotYetImplemented(value = FIREFOX,
438-
reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1279211")
400+
@Ignore(value = FIREFOX, reason = "Per spec, an error data dictionary with text value is optional")
439401
public void testIncludesAlertTextInUnhandledAlertException() {
440402
driver.get(alertPage("cheese"));
441403

@@ -474,11 +436,4 @@ public void shouldHandleAlertOnFormSubmit() {
474436
assertThat(value).isEqualTo("Tasty cheese");
475437
assertThat(driver.getTitle()).isEqualTo("Testing Alerts");
476438
}
477-
478-
private void setSimpleOnBeforeUnload(Object returnText) {
479-
((JavascriptExecutor) driver).executeScript(
480-
"var returnText = arguments[0]; window.onbeforeunload = function() { return returnText; }",
481-
returnText);
482-
}
483-
484439
}

java/test/org/openqa/selenium/ClickScrollingTest.java

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,14 @@ public void testShouldBeAbleToClickOnAnElementHiddenByOverflow() {
9393
}
9494

9595
@Test
96-
@Ignore(value = FIREFOX, issue = "https://github.com/mozilla/geckodriver/issues/2013")
96+
@Ignore(value = FIREFOX,
97+
reason = "horizontal scroll bar gets in the way",
98+
issue = "https://github.com/mozilla/geckodriver/issues/2013")
9799
public void testShouldBeAbleToClickOnAnElementHiddenByDoubleOverflow() {
98100
driver.get(appServer.whereIs("scrolling_tests/page_with_double_overflow_auto.html"));
99101

100102
driver.findElement(By.id("link")).click();
101-
onlyPassIfNotOnMac(662, () -> wait.until(titleIs("Clicked Successfully!")));
103+
wait.until(titleIs("Clicked Successfully!"));
102104
}
103105

104106
@Test
@@ -111,7 +113,9 @@ public void testShouldBeAbleToClickOnAnElementHiddenByYOverflow() {
111113

112114
@Test
113115
@Ignore(value = IE, issue = "716")
114-
@Ignore(value = FIREFOX, issue = "https://github.com/mozilla/geckodriver/issues/2013")
116+
@Ignore(value = FIREFOX,
117+
reason = "horizontal scroll bar gets in the way",
118+
issue = "https://github.com/mozilla/geckodriver/issues/2013")
115119
public void testShouldBeAbleToClickOnAnElementPartiallyHiddenByOverflow() {
116120
driver.get(appServer.whereIs("scrolling_tests/page_with_partially_hidden_element.html"));
117121

@@ -131,7 +135,9 @@ public void testShouldNotScrollOverflowElementsWhichAreVisible() {
131135
}
132136

133137
@Test
134-
@Ignore(value = FIREFOX, issue = "https://github.com/mozilla/geckodriver/issues/2013")
138+
@Ignore(value = FIREFOX,
139+
reason = "horizontal scroll bar gets in the way",
140+
issue = "https://github.com/mozilla/geckodriver/issues/2013")
135141
@NotYetImplemented(IE)
136142
public void testShouldNotScrollIfAlreadyScrolledAndElementIsInView() {
137143
driver.get(appServer.whereIs("scroll3.html"));
@@ -160,7 +166,9 @@ public void testShouldScrollOverflowElementsIfClickPointIsOutOfViewButElementIsI
160166
@SwitchToTopAfterTest
161167
@Test
162168
@NotYetImplemented(SAFARI)
163-
@NotYetImplemented(value = FIREFOX, reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1314462")
169+
@Ignore(value = FIREFOX,
170+
reason ="frame not scrolled into view",
171+
issue = "https://bugzilla.mozilla.org/show_bug.cgi?id=1314462")
164172
public void testShouldBeAbleToClickElementInAFrameThatIsOutOfView() {
165173
driver.get(appServer.whereIs("scrolling_tests/page_with_frame_out_of_view.html"));
166174
driver.switchTo().frame("frame");
@@ -179,16 +187,6 @@ public void testShouldBeAbleToClickElementThatIsOutOfViewInAFrame() {
179187
assertThat(element.isSelected()).isTrue();
180188
}
181189

182-
@SwitchToTopAfterTest
183-
@Test
184-
@Ignore(value = ALL, reason = "All tested browsers scroll non-scrollable frames")
185-
public void testShouldNotBeAbleToClickElementThatIsOutOfViewInANonScrollableFrame() {
186-
driver.get(appServer.whereIs("scrolling_tests/page_with_non_scrolling_frame.html"));
187-
driver.switchTo().frame("scrolling_frame");
188-
WebElement element = driver.findElement(By.name("scroll_checkbox"));
189-
assertThatExceptionOfType(MoveTargetOutOfBoundsException.class).isThrownBy(element::click);
190-
}
191-
192190
@SwitchToTopAfterTest
193191
@Test
194192
@NotYetImplemented(SAFARI)
@@ -202,19 +200,23 @@ public void testShouldBeAbleToClickElementThatIsOutOfViewInAFrameThatIsOutOfView
202200

203201
@SwitchToTopAfterTest
204202
@Test
205-
@Ignore(value = FIREFOX, issue = "https://github.com/mozilla/geckodriver/issues/2013")
203+
@Ignore(value = FIREFOX,
204+
reason = "horizontal scroll bar gets in the way",
205+
issue = "https://github.com/mozilla/geckodriver/issues/2013")
206206
public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrame() {
207207
driver.get(appServer.whereIs("scrolling_tests/page_with_nested_scrolling_frames.html"));
208208
driver.switchTo().frame("scrolling_frame");
209209
driver.switchTo().frame("nested_scrolling_frame");
210210
WebElement element = driver.findElement(By.name("scroll_checkbox"));
211211
element.click();
212-
onlyPassIfNotOnMac(651, () -> assertThat(element.isSelected()).isTrue());
212+
assertThat(element.isSelected()).isTrue();
213213
}
214214

215215
@SwitchToTopAfterTest
216216
@Test
217-
@Ignore(value = FIREFOX, issue = "https://github.com/mozilla/geckodriver/issues/2013")
217+
@Ignore(value = FIREFOX,
218+
reason = "horizontal scroll bar gets in the way",
219+
issue = "https://github.com/mozilla/geckodriver/issues/2013")
218220
@NotYetImplemented(SAFARI)
219221
public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrameThatIsOutOfView() {
220222
driver.get(appServer.whereIs("scrolling_tests/page_with_nested_scrolling_frames_out_of_view.html"));
@@ -223,21 +225,7 @@ public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrameThatIsOut
223225
WebElement element = driver.findElement(By.name("scroll_checkbox"));
224226
element.click();
225227

226-
onlyPassIfNotOnMac(651, () -> assertThat(element.isSelected()).isTrue());
227-
}
228-
229-
private void onlyPassIfNotOnMac(int mozIssue, Runnable toCheck) {
230-
try {
231-
toCheck.run();
232-
assumeFalse(
233-
"It appears https://github.com/mozilla/geckodriver/issues/" + mozIssue + " is fixed",
234-
Platform.getCurrent() == Platform.MAC && Browser.detect() == FIREFOX);
235-
} catch (Throwable e) {
236-
// Swallow the exception, as this is expected for Firefox on OS X
237-
if (!(Platform.getCurrent() == Platform.MAC && Browser.detect() == FIREFOX)) {
238-
throw e;
239-
}
240-
}
228+
assertThat(element.isSelected()).isTrue();
241229
}
242230

243231
@Test
@@ -256,7 +244,9 @@ private long getScrollTop() {
256244
@SwitchToTopAfterTest
257245
@Test
258246
@NotYetImplemented(SAFARI)
259-
@NotYetImplemented(value = FIREFOX, reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1314462")
247+
@Ignore(value = FIREFOX,
248+
reason ="frame not scrolled into view",
249+
issue = "https://bugzilla.mozilla.org/show_bug.cgi?id=1314462")
260250
public void testShouldBeAbleToClickElementInATallFrame() {
261251
driver.get(appServer.whereIs("scrolling_tests/page_with_tall_frame.html"));
262252
driver.switchTo().frame("tall_frame");

java/test/org/openqa/selenium/ClickTest.java

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,6 @@ public void testShouldOnlyFollowHrefOnce() {
163163
}
164164
}
165165

166-
@Test
167-
@Ignore(ALL)
168-
public void testShouldSetRelatedTargetForMouseOut() {
169-
fail("Must. Write. Meaningful. Test (but we don't fire mouse outs synthetically");
170-
}
171-
172166
@Test
173167
@NotYetImplemented(SAFARI)
174168
public void testClickingLabelShouldSetCheckbox() {
@@ -203,7 +197,9 @@ public void testCanClickOnALinkThatContainsTextWrappedInASpan() {
203197
}
204198

205199
@Test
206-
@NotYetImplemented(value = FIREFOX, reason = "https://github.com/mozilla/geckodriver/issues/653")
200+
@Ignore(value = FIREFOX,
201+
reason = "block can't be scrolled into view",
202+
issue = "https://github.com/mozilla/geckodriver/issues/653")
207203
@NotYetImplemented(SAFARI)
208204
public void testCanClickOnALinkThatContainsEmbeddedBlockElements() {
209205
driver.findElement(By.id("embeddedBlock")).click();
@@ -217,7 +213,6 @@ public void testCanClickOnAnElementEnclosedInALink() {
217213
wait.until(titleIs("XHTML Test Page"));
218214
}
219215

220-
// See https://github.com/SeleniumHQ/selenium-google-code-issue-archive/issues/2700
221216
@Test
222217
public void testShouldBeAbleToClickOnAnElementInTheViewport() {
223218
String url = appServer.whereIs("click_out_of_bounds.html");
@@ -237,7 +232,9 @@ public void testClicksASurroundingStrongTag() {
237232

238233
@Test
239234
@Ignore(IE)
240-
@NotYetImplemented(value = FIREFOX, reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1502636")
235+
@Ignore(value = FIREFOX,
236+
reason = "imagemap can't be scrolled into view",
237+
issue = "https://bugzilla.mozilla.org/show_bug.cgi?id=1502636")
241238
@NotYetImplemented(SAFARI)
242239
public void testCanClickAnImageMapArea() {
243240
driver.get(appServer.whereIs("click_tests/google_map.html"));
@@ -254,7 +251,9 @@ public void testCanClickAnImageMapArea() {
254251
}
255252

256253
@Test
257-
@NotYetImplemented(value = FIREFOX, reason = "https://bugzilla.mozilla.org/show_bug.cgi?id=1422272")
254+
@Ignore(value = FIREFOX,
255+
reason = "Large element can't be scrolled into view",
256+
issue = "https://bugzilla.mozilla.org/show_bug.cgi?id=1422272")
258257
@NotYetImplemented(SAFARI)
259258
public void testShouldBeAbleToClickOnAnElementGreaterThanTwoViewports() {
260259
String url = appServer.whereIs("click_too_big.html");
@@ -344,20 +343,6 @@ public void testShouldBeAbleToClickOnASpanThatWrapsToTheNextLine() {
344343
wait.until(titleIs("Submitted Successfully!"));
345344
}
346345

347-
@Test
348-
@Ignore(CHROME)
349-
@Ignore(EDGE)
350-
@Ignore(IE)
351-
@Ignore(FIREFOX)
352-
@NotYetImplemented(SAFARI)
353-
public void testShouldBeAbleToClickOnAPartiallyOverlappedLinkThatWrapsToTheNextLine() {
354-
driver.get(appServer.whereIs("click_tests/wrapped_overlapping_elements.html"));
355-
356-
driver.findElement(By.id("link")).click();
357-
358-
wait.until(titleIs("Submitted Successfully!"));
359-
}
360-
361346
@Test
362347
public void clickingOnADisabledElementIsANoOp() {
363348
driver.get(appServer.whereIs("click_tests/disabled_element.html"));

java/test/org/openqa/selenium/CorrectEventFiringTest.java

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -517,50 +517,6 @@ public void testClickOverlappingElements() {
517517
.isThrownBy(element::click);
518518
}
519519

520-
@Test
521-
@Ignore(CHROME)
522-
@Ignore(EDGE)
523-
@Ignore(IE)
524-
@Ignore(FIREFOX)
525-
@NotYetImplemented(SAFARI)
526-
@Ignore(HTMLUNIT)
527-
public void testClickPartiallyOverlappingElements() {
528-
for (int i = 1; i < 6; i++) {
529-
driver.get(appServer.whereIs("click_tests/partially_overlapping_elements.html"));
530-
WebElement over = driver.findElement(By.id("over" + i));
531-
((JavascriptExecutor) driver).executeScript("arguments[0].style.display = 'none'", over);
532-
driver.findElement(By.id("under")).click();
533-
assertThat(driver.findElement(By.id("log")).getText())
534-
.isEqualTo("Log:\n"
535-
+ "mousedown in under (handled by under)\n"
536-
+ "mousedown in under (handled by body)\n"
537-
+ "mouseup in under (handled by under)\n"
538-
+ "mouseup in under (handled by body)\n"
539-
+ "click in under (handled by under)\n"
540-
+ "click in under (handled by body)");
541-
}
542-
}
543-
544-
@Test
545-
@Ignore(CHROME)
546-
@Ignore(EDGE)
547-
@Ignore(SAFARI)
548-
@Ignore(HTMLUNIT)
549-
@Ignore(value = FIREFOX, reason = "Checks overlapping by default")
550-
@Ignore(value = IE, reason = "Checks overlapping by default")
551-
public void testNativelyClickOverlappingElements() {
552-
driver.get(appServer.whereIs("click_tests/overlapping_elements.html"));
553-
driver.findElement(By.id("under")).click();
554-
assertThat(driver.findElement(By.id("log")).getText())
555-
.isEqualTo("Log:\n"
556-
+ "mousedown in over (handled by over)\n"
557-
+ "mousedown in over (handled by body)\n"
558-
+ "mouseup in over (handled by over)\n"
559-
+ "mouseup in over (handled by body)\n"
560-
+ "click in over (handled by over)\n"
561-
+ "click in over (handled by body)");
562-
}
563-
564520
@Test
565521
@Ignore(HTMLUNIT)
566522
@NotYetImplemented(SAFARI)

0 commit comments

Comments
 (0)