com.onevizion.uitest.api.helper.mainmenu.MainMenuWait Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ui-test-api Show documentation
Show all versions of ui-test-api Show documentation
An API for easily write tests for OneVizion platform
The newest version!
package com.onevizion.uitest.api.helper.mainmenu;
import java.util.function.IntSupplier;
import java.util.function.Supplier;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.onevizion.uitest.api.SeleniumSettings;
@Component
class MainMenuWait {
@Autowired
private SeleniumSettings seleniumSettings;
@Autowired
private MainMenu mainMenu;
void waitPageTitle(String title) {
Supplier actualValueSupplier = ()-> seleniumSettings.getWebDriver().findElement(By.id("ttlPage")).getAttribute("textContent");
Supplier messageSupplier = ()-> "Waiting for Page Title expectedVal=[" + title + "] actualVal=[" + actualValueSupplier.get() + "] is failed";
new WebDriverWait(seleniumSettings.getWebDriver(), seleniumSettings.getDefaultTimeout())
.withMessage(messageSupplier)
.until(webdriver -> title.equals(actualValueSupplier.get()));
}
void waitTabTitle(String title) {
Supplier actualValueSupplier = ()-> seleniumSettings.getWebDriver().findElement(By.id("ttlTab")).getAttribute("textContent");
Supplier messageSupplier = ()-> "Waiting for Tab Title expectedVal=[" + title + "] actualVal=[" + actualValueSupplier.get() + "] is failed";
new WebDriverWait(seleniumSettings.getWebDriver(), seleniumSettings.getDefaultTimeout())
.withMessage(messageSupplier)
.until(webdriver -> title.equals(actualValueSupplier.get()));
}
void waitDinamicMenusCount(int dinamicMenusCount) {
IntSupplier actualValueSupplier = ()-> mainMenu.getDinamicMenusCount();
Supplier messageSupplier = ()-> "Waiting dinamic menus count expectedVal=[" + dinamicMenusCount + "] actualVal=[" + actualValueSupplier.getAsInt() + "] is failed";
new WebDriverWait(seleniumSettings.getWebDriver(), seleniumSettings.getDefaultTimeout())
.withMessage(messageSupplier)
.until(webdriver -> dinamicMenusCount == actualValueSupplier.getAsInt());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy