Example 14
We have used the UiSteps
class many times, mainly for loading pages. However, UiSteps
also contains a variety of auxiliary general-purpose steps. The example below shows a basic list of available methods:
@Test
@DisplayName("UiSteps showcase")
public void uiSteps() {
UiSteps.openBrowser(carouselPageUrl);
UiSteps.loadPage(homePageUrl);
UiSteps.loadPageAndWaitCompleteState(formPageUrl);
UiSteps.assertUrlContains("/src/test");
UiSteps.assertUrlPath("/src/test/resources/html/form.html");
UiSteps.goBack();
UiSteps.refreshCurrentPage();
UiSteps.waiting(3, "few seconds until the page refreshed");
UiSteps.goForward();
UiSteps.pressEnter();
UiSteps.pressEsc();
UiSteps.scrollBottom();
UiSteps.scrollTop();
UiSteps.goBack();
UiSteps.openNewBlankTab();
UiSteps.switchToTab(0);
UiSteps.switchToTab(1);
UiSteps.openNewTabWithUrl("https://www.google.com/");
UiSteps.pressArrowUp();
UiSteps.pressArrowDown();
UiSteps.pressArrowLeft();
UiSteps.pressArrowRight();
UiSteps.pressTab();
UiSteps.assertUrl("https://www.google.com/");
UiSteps.assertPageTitle("Google");
UiSteps.assertPageTitleContains("Goog");
UiSteps.switchToTab("The Topic");
UiSteps.switchToTab("Google");
UiSteps.setWindowSize(500, 500);
UiSteps.maximize();
}
After running this scenario, the report will display the following log:
Overall, these methods/actions should be intuitive and self-explanatory, as all their names correspond to the actions they perform.