Skip to content

Commit 2a1df51

Browse files
committed
Fixing some tests
1 parent 3922e7e commit 2a1df51

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

src/main/java/uk/co/evoco/webdriver/configuration/ConfigurationLoader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package uk.co.evoco.webdriver.configuration;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
35
import uk.co.evoco.webdriver.configuration.utils.FileLoaderUtils;
46
import uk.co.evoco.webdriver.utils.JsonUtils;
57

src/main/java/uk/co/evoco/webdriver/configuration/utils/FileLoaderUtils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package uk.co.evoco.webdriver.configuration.utils;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import java.io.File;
47
import java.io.IOException;
58

69
public final class FileLoaderUtils {
710

11+
private final static Logger logger = LoggerFactory.getLogger(FileLoaderUtils.class);
812
private FileLoaderUtils() {
913
throw new IllegalStateException("Utility class");
1014
}
@@ -18,10 +22,13 @@ private FileLoaderUtils() {
1822
public static File loadFromClasspathOrFileSystem(String path) throws IOException {
1923
File file = new File(path);
2024
if (file.isFile()) {
25+
logger.info("Using configuration file {}", file.getAbsolutePath());
2126
return file;
2227
} else {
2328
try {
24-
return new File(ClassLoader.getSystemResource(path).getPath());
29+
File fromFile = new File(ClassLoader.getSystemResource(path).getPath());
30+
logger.info("Using configuration file {}", fromFile.getAbsolutePath());
31+
return fromFile;
2532
} catch(NullPointerException e) {
2633
throw new IOException("File could not be found: " + path);
2734
}

src/test/java/uk/co/evoco/webdriver/utils/ChromeDriverPreferenceTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public void testChromeBrowserPreferencesApplied() throws Exception {
3232
String expectedFile = new File("run-generated-files/chrome/downloads").getCanonicalPath() + "/sampleFile.pdf";
3333
webDriver.findElement(By.xpath("//a[text()='clickHereToDownLoadAFile']")).click();
3434
Thread.sleep(5000);//need to wait until file download
35-
assertThat(new File(expectedFile).exists(), is(true));
35+
assertThat("Expected downloaded file to exist in run-generated-files/chrome/downloads",
36+
new File(expectedFile).exists(), is(true));
3637
}
3738

3839
@AfterEach

src/test/java/uk/co/evoco/webdriver/utils/WebDriverUtilsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void setUpWebApp() {
3737

3838
@Test
3939
public void testServerIsAvailable() {
40-
assertThat(webDriver.getCurrentUrl(), is(baseUrl));
40+
assertThat(webDriver.getCurrentUrl(), is(baseUrl + "/index.html"));
4141
}
4242

4343
@Test

0 commit comments

Comments
 (0)