Skip to content

Commit d43248d

Browse files
committed
feat(driverbuilder): add autoDriverDownload() to FirefoxDriverBuilder
1 parent 8b4ac82 commit d43248d

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

src/main/java/io/github/seleniumquery/browser/driver/builders/FirefoxDriverBuilder.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015 seleniumQuery authors
2+
* Copyright (c) 2017 seleniumQuery authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import io.github.seleniumquery.browser.driver.DriverBuilder;
2121
import org.openqa.selenium.Keys;
2222
import org.openqa.selenium.WebDriver;
23+
import org.openqa.selenium.chrome.ChromeDriver;
2324
import org.openqa.selenium.firefox.FirefoxDriver;
2425
import org.openqa.selenium.firefox.FirefoxProfile;
2526
import org.openqa.selenium.interactions.Actions;
@@ -63,6 +64,7 @@ public FirefoxDriverBuilder withProfile(FirefoxProfile firefoxProfile) {
6364

6465
@Override
6566
protected WebDriver build() {
67+
autoDownloadDriverIfAskedFor(FirefoxDriver.class);
6668
DesiredCapabilities capabilities = createConfiguredCapabilities();
6769
FirefoxDriver firefoxDriver = new FirefoxDriver(capabilities);
6870
disableJavaScriptIfWanted(firefoxDriver);
@@ -100,4 +102,4 @@ private void disableJavaScript(FirefoxDriver driver) {
100102
driver.get("about:blank");
101103
}
102104

103-
}
105+
}

src/test/java/endtoend/browser/driver/builders/FirefoxDriverBuilderTest.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015 seleniumQuery authors
2+
* Copyright (c) 2017 seleniumQuery authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,7 +35,8 @@ public class FirefoxDriverBuilderTest {
3535

3636
@Before
3737
public void setUp() {
38-
assumeTrue(SetUpAndTearDownDriver.driverToRunTestsIn.canRunFirefox());
38+
assumeTrue("To run the tests in this class, EndToEndTestConfig#whatDriversShouldTestsRun() should return Firefox.",
39+
SetUpAndTearDownDriver.driverToRunTestsIn.canRunFirefox());
3940
}
4041

4142
@After
@@ -84,4 +85,13 @@ public static void assertJavaScriptIsOff(WebDriver driver) {
8485
assertThat(driver.findElements(By.tagName("div")), hasSize(1));
8586
}
8687

87-
}
88+
@Test
89+
public void autoDriverDownload() {
90+
// given
91+
// when
92+
$.driver().useFirefox().autoDriverDownload();
93+
// then
94+
assertJavaScriptIsOn($.driver().get());
95+
}
96+
97+
}

0 commit comments

Comments
 (0)