From eb1d743f20f1d2a4d49c8ed70a658cd38e160589 Mon Sep 17 00:00:00 2001 From: Alexei Barantsev Date: Fri, 28 Sep 2018 00:02:36 +0300 Subject: [PATCH] [java] Don't restart browser without strong need --- java/client/test/org/openqa/selenium/AlertsTest.java | 1 - java/client/test/org/openqa/selenium/ClickTest.java | 2 +- .../org/openqa/selenium/ExecutingJavascriptTest.java | 2 -- .../test/org/openqa/selenium/FrameSwitchingTest.java | 2 -- java/client/test/org/openqa/selenium/I18nTest.java | 4 ---- .../org/openqa/selenium/JavascriptEnabledDriverTest.java | 2 -- .../client/test/org/openqa/selenium/PageLoadingTest.java | 9 --------- .../test/org/openqa/selenium/SessionHandlingTest.java | 1 - .../openqa/selenium/interactions/DragAndDropTest.java | 2 -- 9 files changed, 1 insertion(+), 24 deletions(-) diff --git a/java/client/test/org/openqa/selenium/AlertsTest.java b/java/client/test/org/openqa/selenium/AlertsTest.java index 26296868aae3f..188126ebf3250 100644 --- a/java/client/test/org/openqa/selenium/AlertsTest.java +++ b/java/client/test/org/openqa/selenium/AlertsTest.java @@ -77,7 +77,6 @@ private String promptPage(String defaultText) { "
acceptor
")); } - @NoDriverAfterTest @Test public void testShouldBeAbleToOverrideTheWindowAlertMethod() { driver.get(alertPage("cheese")); diff --git a/java/client/test/org/openqa/selenium/ClickTest.java b/java/client/test/org/openqa/selenium/ClickTest.java index 493af397943ee..0caf9af826e8d 100644 --- a/java/client/test/org/openqa/selenium/ClickTest.java +++ b/java/client/test/org/openqa/selenium/ClickTest.java @@ -148,7 +148,7 @@ public void testShouldClickOnFirstBoundingClientRectWithNonZeroSize() { wait.until(titleIs("XHTML Test Page")); } - @NoDriverAfterTest + @NoDriverAfterTest(failedOnly = true) @Test public void testShouldOnlyFollowHrefOnce() { driver.get(pages.clicksPage); diff --git a/java/client/test/org/openqa/selenium/ExecutingJavascriptTest.java b/java/client/test/org/openqa/selenium/ExecutingJavascriptTest.java index 8d9afa13463cf..8b30281dcf689 100644 --- a/java/client/test/org/openqa/selenium/ExecutingJavascriptTest.java +++ b/java/client/test/org/openqa/selenium/ExecutingJavascriptTest.java @@ -39,7 +39,6 @@ import org.openqa.selenium.testing.InProject; import org.openqa.selenium.testing.JUnit4TestBase; import org.openqa.selenium.testing.NeedsFreshDriver; -import org.openqa.selenium.testing.NoDriverAfterTest; import org.openqa.selenium.testing.NotYetImplemented; import java.io.IOException; @@ -421,7 +420,6 @@ public void testShouldBeAbleToExecuteScriptAndReturnElementsList() { } @NeedsFreshDriver - @NoDriverAfterTest @Test @NotYetImplemented(value = HTMLUNIT, reason = "HtmlUnit: can't execute JavaScript before a page is loaded") diff --git a/java/client/test/org/openqa/selenium/FrameSwitchingTest.java b/java/client/test/org/openqa/selenium/FrameSwitchingTest.java index b650557ffd9c9..93c22b5ed1f99 100644 --- a/java/client/test/org/openqa/selenium/FrameSwitchingTest.java +++ b/java/client/test/org/openqa/selenium/FrameSwitchingTest.java @@ -35,7 +35,6 @@ import org.openqa.selenium.testing.Ignore; import org.openqa.selenium.testing.JUnit4TestBase; import org.openqa.selenium.testing.NeedsLocalEnvironment; -import org.openqa.selenium.testing.NoDriverAfterTest; import org.openqa.selenium.testing.NotYetImplemented; import java.util.Random; @@ -510,7 +509,6 @@ public void testShouldNotSwitchMagicallyToTheTopWindow() { } } - @NoDriverAfterTest // Subsequent tests sometimes fail on Firefox. @Test public void testGetShouldSwitchToDefaultContext() { driver.get(pages.iframePage); diff --git a/java/client/test/org/openqa/selenium/I18nTest.java b/java/client/test/org/openqa/selenium/I18nTest.java index 97d79dd447732..5edfc0c96d986 100644 --- a/java/client/test/org/openqa/selenium/I18nTest.java +++ b/java/client/test/org/openqa/selenium/I18nTest.java @@ -25,13 +25,11 @@ import static org.openqa.selenium.testing.Driver.HTMLUNIT; import static org.openqa.selenium.testing.Driver.IE; import static org.openqa.selenium.testing.Driver.MARIONETTE; -import static org.openqa.selenium.testing.Driver.SAFARI; import org.junit.Test; import org.openqa.selenium.environment.GlobalTestEnvironment; import org.openqa.selenium.testing.Ignore; import org.openqa.selenium.testing.JUnit4TestBase; -import org.openqa.selenium.testing.NeedsFreshDriver; import org.openqa.selenium.testing.NotYetImplemented; import org.openqa.selenium.testing.TestUtilities; @@ -103,7 +101,6 @@ public void testEnteringSupplementaryCharacters() { assertThat(el.getAttribute("value")).isEqualTo(input); } - @NeedsFreshDriver @Test public void testShouldBeAbleToReturnTheTextInAPage() { String url = GlobalTestEnvironment.get() @@ -116,7 +113,6 @@ public void testShouldBeAbleToReturnTheTextInAPage() { assertThat(text).isEqualTo(shalom); } - @NeedsFreshDriver @Test @Ignore(IE) @Ignore(CHROME) diff --git a/java/client/test/org/openqa/selenium/JavascriptEnabledDriverTest.java b/java/client/test/org/openqa/selenium/JavascriptEnabledDriverTest.java index 3d6f01928b2f1..2ffff03e862e7 100644 --- a/java/client/test/org/openqa/selenium/JavascriptEnabledDriverTest.java +++ b/java/client/test/org/openqa/selenium/JavascriptEnabledDriverTest.java @@ -30,7 +30,6 @@ import org.openqa.selenium.interactions.Locatable; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.testing.JUnit4TestBase; -import org.openqa.selenium.testing.NeedsFreshDriver; import org.openqa.selenium.testing.NoDriverAfterTest; import org.openqa.selenium.testing.NotYetImplemented; @@ -210,7 +209,6 @@ public void testShouldBeAbleToGetTheLocationOfAnElement() { * running: "ImplicitWaitTest", "TemporaryFilesystemTest", "JavascriptEnabledDriverTest". * SimonStewart 2010-10-04 */ - @NeedsFreshDriver @NoDriverAfterTest @Test @NotYetImplemented(SAFARI) diff --git a/java/client/test/org/openqa/selenium/PageLoadingTest.java b/java/client/test/org/openqa/selenium/PageLoadingTest.java index 7d540b4dd6c9c..00ba8dc06da40 100644 --- a/java/client/test/org/openqa/selenium/PageLoadingTest.java +++ b/java/client/test/org/openqa/selenium/PageLoadingTest.java @@ -202,7 +202,6 @@ public void testShouldReturnWhenGettingAUrlThatDoesNotResolve() { } @Test - @NeedsFreshDriver public void testShouldThrowIfUrlIsMalformed() { assumeFalse("Fails in Sauce Cloud", shouldUseSauce()); assertThatExceptionOfType(WebDriverException.class) @@ -211,7 +210,6 @@ public void testShouldThrowIfUrlIsMalformed() { @Test @NotYetImplemented(value = SAFARI) - @NeedsFreshDriver public void testShouldThrowIfUrlIsMalformedInPortPart() { assumeFalse("Fails in Sauce Cloud", shouldUseSauce()); assertThatExceptionOfType(WebDriverException.class) @@ -247,7 +245,6 @@ public void testShouldBeAbleToLoadAPageWithFramesetsAndWaitUntilAllFramesAreLoad } @NeedsFreshDriver - @NoDriverAfterTest @Test @NotYetImplemented(value = HTMLUNIT, reason = "HtmlUnit: can't execute JavaScript before a page is loaded") @@ -343,7 +340,6 @@ public void testShouldNotHangIfDocumentOpenCallIsNeverFollowedByDocumentCloseCal // Note: If this test ever fixed/enabled on Firefox, check if it also needs @NoDriverAfterTest OR // if @NoDriverAfterTest can be removed from some other tests in this class. - @NoDriverAfterTest @Test @Ignore(FIREFOX) @NotYetImplemented(SAFARI) @@ -353,7 +349,6 @@ public void testPageLoadTimeoutCanBeChanged() { testPageLoadTimeoutIsEnforced(3); } - @NoDriverAfterTest @Test @Ignore(FIREFOX) @NotYetImplemented(SAFARI) @@ -366,7 +361,6 @@ public void testCanHandleSequentialPageLoadTimeouts() { assertPageLoadTimeoutIsEnforced(pageLoadTimeout, pageLoadTimeBuffer); } - @NoDriverAfterTest // Subsequent tests sometimes fail on Firefox. @Test @NeedsLocalEnvironment public void testShouldTimeoutIfAPageTakesTooLongToLoad() { @@ -381,7 +375,6 @@ public void testShouldTimeoutIfAPageTakesTooLongToLoad() { wait.until(titleIs("XHTML Test Page")); } - @NoDriverAfterTest // Subsequent tests sometimes fail on Firefox. @Test @NotYetImplemented(value = SAFARI) @Ignore(value = FIREFOX, travis = true) @@ -414,7 +407,6 @@ public void testShouldTimeoutIfAPageTakesTooLongToLoadAfterClick() { wait.until(titleIs("XHTML Test Page")); } - @NoDriverAfterTest // Subsequent tests sometimes fail on Firefox. @Test @NeedsLocalEnvironment public void testShouldTimeoutIfAPageTakesTooLongToRefresh() { @@ -446,7 +438,6 @@ public void testShouldTimeoutIfAPageTakesTooLongToRefresh() { wait.until(titleIs("XHTML Test Page")); } - @NoDriverAfterTest // Subsequent tests sometimes fail on Firefox. @Test @Ignore(CHROME) @NotYetImplemented(value = SAFARI) diff --git a/java/client/test/org/openqa/selenium/SessionHandlingTest.java b/java/client/test/org/openqa/selenium/SessionHandlingTest.java index a6f6f6ac6da71..5942f3c0d70dc 100644 --- a/java/client/test/org/openqa/selenium/SessionHandlingTest.java +++ b/java/client/test/org/openqa/selenium/SessionHandlingTest.java @@ -66,7 +66,6 @@ public void callingAnyOperationAfterQuitShouldThrowAnException() { assertThatExceptionOfType(NoSuchSessionException.class).isThrownBy(driver::getCurrentUrl); } - @NoDriverAfterTest @Test public void shouldContinueAfterSleep() { sleepTight(10000); diff --git a/java/client/test/org/openqa/selenium/interactions/DragAndDropTest.java b/java/client/test/org/openqa/selenium/interactions/DragAndDropTest.java index 553d24ba4497f..ea647126b82d4 100644 --- a/java/client/test/org/openqa/selenium/interactions/DragAndDropTest.java +++ b/java/client/test/org/openqa/selenium/interactions/DragAndDropTest.java @@ -37,7 +37,6 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.testing.Ignore; import org.openqa.selenium.testing.JUnit4TestBase; -import org.openqa.selenium.testing.NeedsFreshDriver; import org.openqa.selenium.testing.NoDriverAfterTest; import org.openqa.selenium.testing.NotYetImplemented; import org.openqa.selenium.testing.SwitchToTopAfterTest; @@ -108,7 +107,6 @@ public void testDragAndDropElementWithOffsetInIframeAtBottom() { assertThat(img1.getLocation()).isEqualTo(initial.moveBy(20, 20)); } - @NeedsFreshDriver // fails in Sauce if run in a dirty state; to be investigated @Test @Ignore(value = IE, reason = "IE fails this test if requireWindowFocus=true") @Ignore(MARIONETTE)