Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c224436f

Přidáno uživatelem Tomáš Šimandl před více než 6 roky(ů)

changed paths in frontend tests to test files

Zobrazit rozdíly:

sources/src/test/java/cz/zcu/kiv/imiger/tests/frontend/SampleTest.java
1 1
package cz.zcu.kiv.imiger.tests.frontend;
2 2

  
3
import org.junit.jupiter.api.Assertions;
4 3
import org.junit.jupiter.api.AfterAll;
5 4
import org.junit.jupiter.api.BeforeAll;
6 5
import org.junit.jupiter.api.Test;
7 6
import org.openqa.selenium.By;
8 7
import org.openqa.selenium.WebDriver;
9 8
import org.openqa.selenium.WebElement;
10
import org.openqa.selenium.firefox.FirefoxDriver;
11 9
import org.openqa.selenium.support.ui.ExpectedConditions;
12 10
import org.openqa.selenium.support.ui.WebDriverWait;
13 11

  
......
21 19
    @Test
22 20
    public void Test(){
23 21
        WebElement fileInput = browser.findElement(By.id("hidden_input"));
24
        fileInput.sendKeys(System.getProperty("user.dir") + "\\..\\data\\aswi2017falsum.json" );
22
        fileInput.sendKeys(System.getProperty("user.dir") + "\\..\\test\\data\\aswi2017falsum.json" );
25 23
        browser.findElement(By.className("load")).click();
26 24

  
27 25
        WebDriverWait wait = new WebDriverWait(browser, 20);
sources/src/test/java/cz/zcu/kiv/imiger/tests/frontend/SeleniumUtil.java
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
        }

Také k dispozici: Unified diff