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.TestBenchTestCase
Base 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
.hub is set to true, AbstractViewTest will 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
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected final booleanprotected final booleanprotected final booleancom.vaadin.testbench.ScreenshotOnFailureRuleFields inherited from class com.vaadin.testbench.TestBenchTestCase
driver, maxAttempts -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertThemePresentOnElement(org.openqa.selenium.WebElement element, Class<? extends com.vaadin.flow.theme.AbstractTheme> themeClass) Asserts that the givenelementis rendered using a theme identified bythemeClass.voidclose()protected org.openqa.selenium.WebDriverprotected org.openqa.selenium.WebElementConvenience method for getting the root element of the view based on the selector passed to the constructor.abstract StringgetRoute()Get the route of the view to navigate to.protected StringgetURL()Returns deployment host name concatenated with route.protected StringReturns deployment host name concatenated with route.protected voidrefresh()voidsetup()Methods inherited from class com.vaadin.testbench.TestBenchTestCase
concatUrl, executeScript, findElement, findElements, getCommandExecutor, getContext, getDriver, setDriver, testBench, waitUntil, waitUntil, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.testbench.HasElementQuery
$, $
-
Field Details
-
isSauce
protected final boolean isSauce -
isHub
protected final boolean isHub -
isLocal
protected final boolean isLocal -
isHeadless
protected final boolean isHeadless -
rule
public com.vaadin.testbench.ScreenshotOnFailureRule rule
-
-
Constructor Details
-
AbstractViewTest
public AbstractViewTest() -
AbstractViewTest
protected AbstractViewTest(org.openqa.selenium.By rootSelector)
-
-
Method Details
-
setup
- Throws:
Exception
-
close
public void close() -
refresh
protected void refresh() -
createDriver
- Throws:
Exception
-
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, 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
Returns deployment host name concatenated with route.- Returns:
- URL to route
-
getURL
Returns deployment host name concatenated with route.- Parameters:
path- route path- Returns:
- URL to route
-
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.
-