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

com.sdl.selenium.extjs3.conditions.ExtjsConditionManager 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)

There is a newer version: 20.08.432.0_b2d2a09
Show newest version
package com.sdl.selenium.extjs3.conditions;

import com.sdl.selenium.conditions.Condition;
import com.sdl.selenium.conditions.ConditionManager;
import com.sdl.selenium.conditions.MessageBoxCondition;
import com.sdl.selenium.extjs3.window.MessageBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Example how to add conditions to ConditionManager:
 * 
ConditionManager manager = new ConditionManager().add(new SuccessCondition() {
    public boolean execute() {
        return logoutButton.isElementPresent();
    }
});
 * 
* OR more specific cases: *
 ConditionManager manager = new ConditionManager();
 manager.add(
     new MessageBoxFailCondition("Wrong email or password.")).add(
     new RenderSuccessCondition(logoutButton)
 );
 Condition condition = manager.execute();
 logged = condition.isSuccess();
 
*/ public class ExtjsConditionManager extends ConditionManager { private static final Logger LOGGER = LoggerFactory.getLogger(ExtjsConditionManager.class); /** * default timeout in milliseconds is 10000. */ public ExtjsConditionManager() { } /** * @param timeout milliseconds */ public ExtjsConditionManager(long timeout) { this(); setTimeout(timeout); } @Override protected Condition findCondition(){ String boxMessage = null; for (Condition condition : getConditionList()) { if(condition instanceof MessageBoxCondition){ if(boxMessage == null){ boxMessage = MessageBox.getMessage(); } if (((MessageBoxCondition)condition).execute(boxMessage)) { return condition; } } else { if (condition.execute()) { return condition; } } //logger.debug(condition + " is false"); } return null; } /** * add each message to MessageBoxFailCondition * @param messages messages * @return this */ public ExtjsConditionManager addFailConditions(String... messages){ for (String message : messages){ if(message != null && message.length() > 0){ this.add(new MessageBoxFailCondition(message)); } } return this; } /** * add each message to MessageBoxSuccessCondition * @param messages messages * @return this */ public ExtjsConditionManager addSuccessConditions(String... messages){ for (String message : messages){ if(message != null && message.length() > 0){ this.add(new MessageBoxSuccessCondition(message)); } } return this; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy