Skip to content

Commit ebd250e

Browse files
committed
Don't use the default FirefoxBinary() constructor in tests.
The default constructor causes the test to fail if run on a system where Firefox is not on the PATH, which is annoying.
1 parent e9a906a commit ebd250e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

java/client/test/org/openqa/selenium/firefox/FirefoxOptionsTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import org.openqa.selenium.remote.DesiredCapabilities;
4141
import org.openqa.selenium.testing.JreSystemProperty;
4242

43+
import java.io.File;
4344
import java.io.IOException;
4445
import java.io.OutputStream;
4546
import java.nio.file.Files;
@@ -69,8 +70,10 @@ public void canSetBinaryThroughOptions() throws IOException {
6970
}
7071

7172
@Test
72-
public void shouldKeepAFirefoxBinaryAsABinaryIfSetAsOne() {
73-
FirefoxBinary binary = new FirefoxBinary();
73+
public void shouldKeepAFirefoxBinaryAsABinaryIfSetAsOne() throws IOException {
74+
File fakeExecutable = Files.createTempFile("firefox", ".exe").toFile();
75+
fakeExecutable.deleteOnExit();
76+
FirefoxBinary binary = new FirefoxBinary(fakeExecutable);
7477
FirefoxOptions options = new FirefoxOptions().setBinary(binary);
7578

7679
Capabilities caps = options.addTo(new DesiredCapabilities());

0 commit comments

Comments
 (0)