10 |
10 |
|
11 |
11 |
import java.io.IOException;
|
12 |
12 |
import java.nio.file.Files;
|
13 |
|
import java.nio.file.Path;
|
14 |
13 |
import java.nio.file.Paths;
|
15 |
14 |
|
16 |
15 |
public class SeleniumUtil {
|
|
16 |
|
|
17 |
private static final String TEST_DIRECTORY = System.getProperty("user.dir") + "\\..\\test";
|
|
18 |
|
17 |
19 |
/**
|
18 |
|
* Path to the gecko driver.
|
|
20 |
* Path to the config location folder
|
|
21 |
* Path should be the same as in web.xml file
|
19 |
22 |
* Please change to your location
|
20 |
23 |
*/
|
21 |
|
private static final String GECKO_PATH = "C:\\aswi-git\\geckodriver.exe";
|
|
24 |
private static final String APP_CONFIG_LOCATION = "C:\\Users\\Tomas\\Sources\\swi\\IMiGEr\\config";
|
|
25 |
|
|
26 |
private static final String GECKO_PATH = TEST_DIRECTORY + "\\geckodriver.exe";
|
22 |
27 |
|
23 |
|
private static final String URL = "http://localhost:8080/VisualizationTool";
|
|
28 |
private static final String URL = "http://localhost:8080";
|
24 |
29 |
|
25 |
30 |
private static final int DATA_LOAD_TIMEOUT = 20;
|
26 |
31 |
|
... | ... | |
35 |
40 |
|
36 |
41 |
public static void loadGraphData(String filename) {
|
37 |
42 |
WebElement fileInput = browser.findElement(By.id("hidden_input"));
|
38 |
|
fileInput.sendKeys(System.getProperty("user.dir") + "\\..\\test\\data\\" + filename );
|
|
43 |
fileInput.sendKeys(TEST_DIRECTORY + "\\data\\" + filename );
|
39 |
44 |
browser.findElement(By.className("load")).click();
|
40 |
45 |
|
41 |
46 |
WebDriverWait wait = new WebDriverWait(browser, DATA_LOAD_TIMEOUT);
|
... | ... | |
50 |
55 |
|
51 |
56 |
public static void prepareConfigFile(String configFile) {
|
52 |
57 |
try {
|
53 |
|
Files.deleteIfExists(Paths.get(System.getProperty("user.home") + "\\Documents\\aswi\\test\\config\\config.json"));
|
54 |
|
Files.createLink(Paths.get(System.getProperty("user.home") + "\\Documents\\aswi\\test\\config\\config.json"),
|
55 |
|
Paths.get(System.getProperty("user.dir") + "\\..\\test\\config\\" + configFile));
|
|
58 |
Files.deleteIfExists(Paths.get(APP_CONFIG_LOCATION + "\\config.json"));
|
|
59 |
Files.createLink(Paths.get(APP_CONFIG_LOCATION + "\\config.json"),
|
|
60 |
Paths.get(TEST_DIRECTORY + "\\config\\" + configFile));
|
56 |
61 |
} catch (IOException e) {
|
57 |
62 |
e.printStackTrace();
|
58 |
63 |
}
|
changed paths in frontend tests to test files