Как запустить Selenium-Test с помощью Spring-Boot-Vaadin-Flow - PullRequest
0 голосов
/ 06 февраля 2019

Я клонировал https://github.com/vaadin/skeleton-starter-flow-spring и хочу запустить тест на основе селена с @SpringBootTest.Как настроить такой тест?Я также попробовал это с Chrome и withorg.springframework.test.web.reactive.server.WebTestClient без успеха.

MainViewIt.java

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
public class MainViewIT {

    @LocalServerPort
    private int port;
    private WebDriver webDriver;

    @BeforeClass
    public static void setupClass() {
        WebDriverManager.firefoxdriver().setup();
    }

    @Before
    public void setUp() throws Exception {
        webDriver = new FirefoxDriver();
    }

    @After
    public void teardown() {
        if (webDriver != null)
            webDriver.quit();
    }

    @Test
    public void clickMeMustShowNotification() {
        webDriver.get(String.format("http://localhost:%s", port));
        WebElement clickmeButton = webDriver.findElement(By.tagName("vaadin-button"));
        clickmeButton.click();
        WebDriverWait wait = new WebDriverWait(webDriver, 10);
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("vaadin-notification-card")));
    }

pom.xml

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <scope>test</scope>
        </dependency>        
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.2.0</version>
            <scope>test</scope>
        </dependency>

Кнопка ClickeMe не активируется из-за отсутствия ресурсов bower_components

...