public class UITester extends UIFinder
LspsRemote.unloadAllModules()
in @Before and @After methodUIDefaultAppTester.login(String, String)
) in the @Before method
public static class MyTest {
// initializes the helper class
protected UITester app = new UITester(new FirefoxDriver());
// this will make a screenshot of the page on test failure
@Rule
public ScreenshotOnFailureRule screenshotOnFailureRule = new ScreenshotOnFailureRule(app, true);
@Before
public void prepare() {
LspsRemote.unloadAllModules();
app.login();
}
@After
public void cleanup() {
LspsRemote.unloadAllModules();
}
@Test
public void myTest() {
LspsRemote.uploadModule("mymodule", "1.0");
app.runModel("mymodule");
app.openTodo("mytodo");
final LspsTextBox name = app.find("NAME").as().textBox();
...
}
}
Note that the tester framework uses Vaadin TestBench. To use this framework, you need to obtain the TestBench license first.Modifier and Type | Field and Description |
---|---|
String |
contextRoot
Context root where the Vaadin Default app is deployed.
|
Constructor and Description |
---|
UITester(WebDriver driver)
Deprecated.
|
UITester(WebDriver driver,
String contextRoot) |
Modifier and Type | Method and Description |
---|---|
void |
assertDocumentTitles(String... titles)
Asserts that there are the following documents available to the current user.
|
void |
assertUserSeesDocument(String documentName)
Checks that the currently logged-in user is able to open given document.
|
protected static void |
closeMenu(MenuBarElement menu) |
List<DocumentInfo> |
getDocuments()
Returns a list of documents displayed for the currently logged-in user.
|
List<String> |
getDocumentTitles()
Returns the titles of a list of document displayed for the currently logged-in user.
|
protected TestPerson |
getLoggedInPerson() |
List<Todo> |
getTodoList()
Obtains a complete list of TODOs for the currently logged-in user.
|
void |
login()
Deprecated.
call
UIDefaultAppTester.loginAdminAdminAndWait() instead. |
static By |
menuItemById(String titleKey)
Returns a locator for given menu item.
|
protected void |
mockLogIn(TestPerson login,
String password)
When your app differs greatly from the default app and
UIDefaultAppTester.login(String, String) wouldn't work,
you can log in via your custom TestBench/Selenium code. |
protected void |
mockLogout()
When your app differs greatly from the default app and
UIDefaultAppTester.logout() wouldn't work,
you can log in via your custom TestBench/Selenium code. |
void |
openTodo(String todoTitle)
Deprecated.
call
UIDefaultAppTester.openTodo(String) instead. |
ModelInstance |
runModel(String modelName)
Deprecated.
call
UIDefaultAppTester.runModel(String) instead. |
void |
waitForElementPresent(By by)
Wait till element described by descriptor by appears
|
$, clickButton, contains, find, findAll, getDriver, toString, waitForVaadin
public final String contextRoot
@Deprecated public UITester(WebDriver driver)
UIDefaultAppTester.UIDefaultAppTester(WebDriver)
.driver
- the web driver topublic UITester(WebDriver driver, String contextRoot)
public void waitForElementPresent(By by)
by
- public static By menuItemById(String titleKey)
titleKey
- the title key as given to the NavigationMenu classprotected static void closeMenu(MenuBarElement menu)
protected void mockLogIn(TestPerson login, String password)
UIDefaultAppTester.login(String, String)
wouldn't work,
you can log in via your custom TestBench/Selenium code. Then, just call this function in order for other functions
(such as getTodoList()
) to work properly.login
- password
- protected void mockLogout()
UIDefaultAppTester.logout()
wouldn't work,
you can log in via your custom TestBench/Selenium code. Then, just call this function in order for other functions
(such as getTodoList()
) to work properly.protected TestPerson getLoggedInPerson()
public List<Todo> getTodoList()
IllegalStateException
- if no user is currently logged in via mockLogIn(TestPerson, String)
.public List<DocumentInfo> getDocuments()
public List<String> getDocumentTitles()
public void assertUserSeesDocument(String documentName)
documentName
- the document name, not null.AssertionError
- if getDocuments()
does not contain given document.@Deprecated public void login()
UIDefaultAppTester.loginAdminAdminAndWait()
instead.UIDefaultAppTester.loginAdminAdminAndWait()
instead.@Deprecated public void openTodo(String todoTitle)
UIDefaultAppTester.openTodo(String)
instead.UIDefaultAppTester.openTodo(String)
instead.todoTitle
- @Deprecated public ModelInstance runModel(String modelName)
UIDefaultAppTester.runModel(String)
instead.UIDefaultAppTester.runModel(String)
instead.modelName
- public void assertDocumentTitles(String... titles)
titles
- the expected document titles, not null.Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.