All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.onevizion.uitest.api.helper.view.ViewWait Maven / Gradle / Ivy

The newest version!
package com.onevizion.uitest.api.helper.view;

import java.util.function.Supplier;

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 ViewWait {

    @Autowired
    private View view;

    @Autowired
    private SeleniumSettings seleniumSettings;

    void waitCurrentViewName(Long gridIdx, String viewName) {
        Supplier actualValueSupplier = ()-> view.getCurrentViewName(gridIdx);

        Supplier messageSupplier = ()-> "Waiting for Current View Name gridIdx=[" + gridIdx + "] expectedVal=[" + viewName + "] actualVal=[" + actualValueSupplier.get() + "] is failed";

        new WebDriverWait(seleniumSettings.getWebDriver(), seleniumSettings.getDefaultTimeout())
            .withMessage(messageSupplier)
            .until(webdriver -> viewName.equals(actualValueSupplier.get()));
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy