2828
2929import org .junit .Test ;
3030import org .junit .runner .RunWith ;
31+ import org .openqa .selenium .support .ui .WebDriverWait ;
3132import org .openqa .selenium .testing .Ignore ;
3233import org .openqa .selenium .testing .SeleniumTestRunner ;
3334import org .openqa .selenium .testing .drivers .WebDriverBuilder ;
@@ -41,37 +42,52 @@ public void callingQuitMoreThanOnceOnASessionIsANoOp() {
4142 WebDriver driver = new WebDriverBuilder ().get ();
4243
4344 driver .quit ();
45+ sleepTight (3000 );
4446 driver .quit ();
4547 }
4648
4749 @ Test
50+ @ Ignore (value = FIREFOX , issue = "https://github.com/SeleniumHQ/selenium/issues/3792" )
4851 @ Ignore (PHANTOMJS )
4952 public void callingQuitAfterClosingTheLastWindowIsANoOp () {
5053 WebDriver driver = new WebDriverBuilder ().get ();
5154
5255 driver .close ();
56+ sleepTight (3000 );
5357 driver .quit ();
5458 }
5559
5660 @ Test
57- @ Ignore (value = SAFARI , reason = "Safari: throws UnreachableBrowserException" )
58- public void callingAnyOperationAfterQuitShouldThrowAnException () {
61+ @ Ignore (value = FIREFOX , issue = "3792" )
62+ @ Ignore (value = PHANTOMJS , reason = "throws NoSuchWindowException" )
63+ @ Ignore (value = SAFARI , reason = "throws NullPointerException" )
64+ @ Ignore (MARIONETTE )
65+ public void callingAnyOperationAfterClosingTheLastWindowShouldThrowAnException () {
5966 WebDriver driver = new WebDriverBuilder ().get ();
60- driver .quit ();
67+
68+ driver .close ();
69+ sleepTight (3000 );
6170 Throwable t = catchThrowable (driver ::getCurrentUrl );
6271 assertThat (t , instanceOf (NoSuchSessionException .class ));
6372 }
6473
6574 @ Test
66- @ Ignore (value = FIREFOX , reason = "can perform an operation after closing the last window" )
67- @ Ignore (value = PHANTOMJS , reason = "throws NoSuchWindowException" )
68- @ Ignore (value = SAFARI , reason = "throws NullPointerException" )
69- @ Ignore (MARIONETTE )
70- public void callingAnyOperationAfterClosingTheLastWindowShouldThrowAnException () {
75+ @ Ignore (value = SAFARI , reason = "Safari: throws UnreachableBrowserException" )
76+ public void callingAnyOperationAfterQuitShouldThrowAnException () {
7177 WebDriver driver = new WebDriverBuilder ().get ();
72- driver .close ();
78+
79+ driver .quit ();
80+ sleepTight (3000 );
7381 Throwable t = catchThrowable (driver ::getCurrentUrl );
7482 assertThat (t , instanceOf (NoSuchSessionException .class ));
7583 }
7684
85+ private void sleepTight (long duration ) {
86+ try {
87+ Thread .sleep (duration );
88+ } catch (InterruptedException e ) {
89+ e .printStackTrace ();
90+ }
91+ }
92+
7793}
0 commit comments