Skip to content

Commit 80beef7

Browse files
committed
[java] Ignoring devtools tests in Firefox versions less than 83
1 parent f6d2cb3 commit 80beef7

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

java/client/test/org/openqa/selenium/devtools/DevToolsTestBase.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@
1818
package org.openqa.selenium.devtools;
1919

2020
import static org.assertj.core.api.Assumptions.assumeThat;
21+
import static org.openqa.selenium.testing.TestUtilities.isFirefoxVersionNotLessThan;
2122

2223
import org.junit.Before;
2324
import org.openqa.selenium.testing.JUnit4TestBase;
2425

25-
2626
public abstract class DevToolsTestBase extends JUnit4TestBase {
2727

2828
protected DevTools devTools;
2929

3030
@Before
3131
public void setUp() {
3232
assumeThat(driver).isInstanceOf(HasDevTools.class);
33+
assumeThat(isFirefoxVersionNotLessThan(83, driver)).isTrue();
3334

3435
devTools = ((HasDevTools) driver).getDevTools();
3536
devTools.createSessionIfThereIsNotOne();

java/client/test/org/openqa/selenium/html5/Html5CapabilitiesTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public class Html5CapabilitiesTest extends JUnit4TestBase {
5353
public void avoidRemote() {
5454
// TODO: Resolve why these tests don't work on the remote server
5555
assumeTrue(TestUtilities.isLocal());
56-
assumeTrue(TestUtilities.getFirefoxVersion(driver) >= 12);
5756
}
5857

5958
@Test

java/client/test/org/openqa/selenium/support/devtools/NetworkInterceptorTest.java

+8-6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import static org.assertj.core.api.Assumptions.assumeThat;
3939
import static org.openqa.selenium.remote.http.Contents.utf8String;
4040
import static org.openqa.selenium.testing.Safely.safelyCall;
41+
import static org.openqa.selenium.testing.TestUtilities.isFirefoxVersionNotLessThan;
4142

4243
public class NetworkInterceptorTest {
4344

@@ -52,15 +53,16 @@ public static void shouldTestBeRunAtAll() {
5253

5354
@Before
5455
public void setup() {
55-
appServer = new NettyAppServer(req -> new HttpResponse()
56-
.setStatus(200)
57-
.addHeader("Content-Type", MediaType.XHTML_UTF_8.toString())
58-
.setContent(utf8String("<html><head><title>Hello, World!</title></head><body/></html>")));
59-
appServer.start();
60-
6156
driver = new WebDriverBuilder().get();
6257

6358
assumeThat(driver).isInstanceOf(HasDevTools.class);
59+
assumeThat(isFirefoxVersionNotLessThan(83, driver)).isTrue();
60+
61+
appServer = new NettyAppServer(req -> new HttpResponse()
62+
.setStatus(200)
63+
.addHeader("Content-Type", MediaType.XHTML_UTF_8.toString())
64+
.setContent(utf8String("<html><head><title>Hello, World!</title></head><body/></html>")));
65+
appServer.start();
6466
}
6567

6668
@After

java/client/test/org/openqa/selenium/testing/TestUtilities.java

+4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public static boolean isFirefox(WebDriver driver) {
6060
return getUserAgent(driver).contains("Firefox");
6161
}
6262

63+
public static boolean isFirefoxVersionNotLessThan(int version, WebDriver driver) {
64+
return isFirefox(driver) && getFirefoxVersion(driver) >= version;
65+
}
66+
6367
public static boolean isInternetExplorer(WebDriver driver) {
6468
String userAgent = getUserAgent(driver);
6569
return userAgent != null && (userAgent.contains("MSIE") || userAgent.contains("Trident"));

0 commit comments

Comments
 (0)