I developped a Spring Boot / Angular JS app. Now I'm trying to implement some GUI interface tests.
I tryed to use the Selenium ChromeDriver, so I added the Selenium dependency :
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
And I created my first test :
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MyMainClass.class)
public class SeleniumTest {
private WebDriver driver;
@Before
public void setup() {
System.setProperty("webdriver.chrome.driver", "my/path/to/chomedriver");
driver = new ChromeDriver();
}
@Test
public void testTest() throws Exception {
driver.get("https://www.google.com/");
}
}
This works fine. But now I want to get my app pages with :
driver.get("http://localhost:8080/");
But I get an "ERR_CONNECTION_REFUSED" in the chrome browser.
I think it's because I need to set up my test to run my web app before to run the test but I don't find how to achieve this ?