Class AbstractViewTest
- java.lang.Object
-
- com.vaadin.testbench.TestBenchTestCase
-
- com.vaadin.collaborationengine.util.AbstractViewTest
-
- All Implemented Interfaces:
com.vaadin.testbench.HasDriver,com.vaadin.testbench.HasElementQuery,com.vaadin.testbench.HasSearchContext,com.vaadin.testbench.HasTestBenchCommandExecutor
- Direct Known Subclasses:
AbstractCollaborativeViewTest
public abstract class AbstractViewTest extends com.vaadin.testbench.TestBenchTestCaseBase class for TestBench IntegrationTests on chrome.The tests use Chrome driver (see pom.xml for integration-tests profile) to run integration tests on a headless Chrome. If a property
test.use .hubis set to true,AbstractViewTestwill assume that the TestBench test is running in a CI environment. In order to keep the this class light, it makes certain assumptions about the CI environment (such as available environment variables). It is not advisable to use this class as a base class for you own TestBench tests.To learn more about TestBench, visit Vaadin TestBench.
-
-
Field Summary
Fields Modifier and Type Field Description com.vaadin.testbench.ScreenshotOnFailureRulerule
-
Constructor Summary
Constructors Modifier Constructor Description AbstractViewTest()protectedAbstractViewTest(org.openqa.selenium.By rootSelector)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidassertThemePresentOnElement(org.openqa.selenium.WebElement element, java.lang.Class<? extends com.vaadin.flow.theme.AbstractTheme> themeClass)Asserts that the givenelementis rendered using a theme identified bythemeClass.voidclose()protected org.openqa.selenium.WebDrivercreateHeadlessChromeDriver()protected org.openqa.selenium.WebElementgetRootElement()Convenience method for getting the root element of the view based on the selector passed to the constructor.abstract java.lang.StringgetRoute()Get the route of the view to navigate to.protected java.lang.StringgetURL()Returns deployment host name concatenated with route.protected java.lang.StringgetURL(java.lang.String path)protected voidrefresh()voidsetup()static voidsetupClass()-
Methods inherited from class com.vaadin.testbench.TestBenchTestCase
concatUrl, executeScript, findElement, findElements, getCommandExecutor, getContext, getDriver, setDriver, testBench, waitUntil, waitUntil, wrap
-
-
-
-
Method Detail
-
setupClass
public static void setupClass()
-
setup
public void setup()
-
close
public void close()
-
refresh
protected void refresh()
-
createHeadlessChromeDriver
protected org.openqa.selenium.WebDriver createHeadlessChromeDriver()
-
getRootElement
protected org.openqa.selenium.WebElement getRootElement()
Convenience method for getting the root element of the view based on the selector passed to the constructor.- Returns:
- the root element
-
assertThemePresentOnElement
protected void assertThemePresentOnElement(org.openqa.selenium.WebElement element, java.lang.Class<? extends com.vaadin.flow.theme.AbstractTheme> themeClass)Asserts that the givenelementis rendered using a theme identified bythemeClass. If the the is not found, JUnit assert will fail the test case.- Parameters:
element- web element to check for the themethemeClass- theme class (such asLumo.class
-
getURL
protected java.lang.String getURL()
Returns deployment host name concatenated with route.- Returns:
- URL to route
-
getURL
protected java.lang.String getURL(java.lang.String path)
-
getRoute
public abstract java.lang.String getRoute()
Get the route of the view to navigate to. In most cases it should be the same as the value in the@Routeannotation of the view.
-
-