File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed
main/java/uk/co/evoco/webdriver/configuration
test/java/uk/co/evoco/webdriver/utils Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 11package uk .co .evoco .webdriver .configuration ;
22
3+ import org .slf4j .Logger ;
4+ import org .slf4j .LoggerFactory ;
35import uk .co .evoco .webdriver .configuration .utils .FileLoaderUtils ;
46import uk .co .evoco .webdriver .utils .JsonUtils ;
57
Original file line number Diff line number Diff line change 11package uk .co .evoco .webdriver .configuration .utils ;
22
3+ import org .slf4j .Logger ;
4+ import org .slf4j .LoggerFactory ;
5+
36import java .io .File ;
47import java .io .IOException ;
58
69public 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 }
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments