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

com.sdl.selenium.extjs6.notification.Notification Maven / Gradle / Ivy

Go to download

Automated Acceptance Testing. Selenium and Selenium WebDriver test framework for web applications. (optimized for dynamic html, ExtJS, Bootstrap, complex UI, simple web applications/sites)

The newest version!
package com.sdl.selenium.extjs6.notification;

import com.sdl.selenium.web.SearchType;
import com.sdl.selenium.web.WebLocator;
import com.sdl.selenium.web.utils.RetryUtils;
import com.sdl.selenium.web.utils.Utils;

import java.time.Duration;

import static org.hamcrest.MatcherAssert.assertThat;

public class Notification extends WebLocator {

    public Notification() {
        setClasses("msg", "x-border-box");
        setVisibility(true);
        WebLocator c = new WebLocator().setClasses("msg-container");
        setContainer(c);
        getPathBuilder().defaultSearchTextType.add(SearchType.DEEP_CHILD_NODE_OR_SELF);
    }

    public Notification(String msg) {
        this(msg, SearchType.CONTAINS);
    }

    public Notification(String msg, SearchType... searchTypes) {
        this();
        setText(msg, searchTypes);
    }

    public void close() {
        boolean close = doClose();
        assertThat("Could not click " + toString(), close);
    }

    public boolean doClose() {
        WebLocator close = new WebLocator(this).setClasses("x-tool-close");
        Utils.sleep(350);
        return RetryUtils.retry(3, () -> {
            this.waitToRender(Duration.ofMillis(300), false);
            return close.doClick() || !this.waitToRender(Duration.ofMillis(100), false);
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy