Example usage for org.openqa.selenium WebElement sendKeys

List of usage examples for org.openqa.selenium WebElement sendKeys

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement sendKeys.

Prototype

void sendKeys(CharSequence... keysToSend);

Source Link

Document

Use this method to simulate typing into an element, which may set its value.

Usage

From source file:com.opera.core.systems.HTML5FormTest.java

License:Apache License

@Test
public void setInputColorValue() {
    WebElement colorField = driver.findElement(By.id("color"));
    colorField.sendKeys("#cccccc");
    assertThat(colorField.getAttribute("value"), is("#cccccc"));
}

From source file:com.opera.core.systems.HTML5FormTest.java

License:Apache License

@Test
public void setInputRangeValue() {
    WebElement rangeField = driver.findElement(By.id("range"));
    rangeField.sendKeys("20");
    assertThat(rangeField.getAttribute("value"), is("20"));
}

From source file:com.opera.core.systems.HTML5FormTest.java

License:Apache License

@Test
public void setInputPlaceholderValue() {
    WebElement placeholderField = driver.findElement(By.id("placeholder"));
    placeholderField.sendKeys("bar");
    assertThat(placeholderField.getAttribute("value"), is("bar"));
}

From source file:com.oracle.amc.sqe.util.webui.WebUIPage.java

License:Open Source License

public void login(String emailStr, String passStr) {
    webDriver.get(loginPage);/*from   w w  w  .  j a v  a2 s . c o  m*/
    wait(By.id(EMAIL_INPUT_ID));
    WebElement email = findElement(By.id(EMAIL_INPUT_ID));
    email.sendKeys(emailStr);
    WebElement passwd = findElement(By.id(PASSWD_INPUT_ID));
    passwd.sendKeys(passStr);
    click(By.id(LOGIN_BUTTON_ID));
    //wait for page refresh
    sleep(1000);
}

From source file:com.partnet.automation.HtmlView.java

License:Apache License

/**
 * Replaces the text in a WebElement with the provided text.
 *
 * <p>/*  w  w w.jav a  2  s.c om*/
 * This method uses the {@link HtmlView#clickElem(WebElement)} method.
 *
 * @param webElement
 *          - target for update
 * @param value
 *          - new value for the text of the WebElement
 * @return The {@link HtmlView} instance that invoked this method; enables
 *         fluent calls
 */
protected HtmlView setValue(WebElement webElement, String value) {

    final String previousValue = getValue(webElement);
    LOG.debug("Replacing '{}' with '{}' on WebElement {}", previousValue, value, webElement);

    // htmlunit may not actually be replacing/putting in an empty value
    if (value == null) {
        value = "";
    }

    for (int i = 0; i < 3; i++) {
        // click on elm, as suggested in
        // http://stackoverflow.com/questions/20936403/sendkeys-are-not-working-in-selenium-webdriver
        clickElem(webElement);
        webElement.clear();
        webElement.sendKeys(value);

        String elmContent = webElement.getAttribute("value");
        LOG.debug("New content of WebElement: '{}'", elmContent);

        if (!(elmContent.equalsIgnoreCase(value))) {
            LOG.warn("Setting WebElm {}\n" + "was not set to '{}'\n" + "  but actually '{}'", webElement, value,
                    elmContent);
        }

        // if the target field is not filled, retry. Do not retry with the equals
        // ignore case, because sometimes it
        // is actually testing if the field can be filled with x amount of chars.
        if (StringUtils.isBlank(elmContent) && StringUtils.isNotBlank(value)) {
            LOG.debug("Retry set web elm: {}", i);
            continue;
        }
        // field was correctly set
        break;
    }

    return this;
}

From source file:com.pentaho.ctools.cde.reference.FilterAddinAccordion.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name:/*from  w  ww.  ja v a 2  s. c  o m*/
 *    Sniff test to Filter Component AddIn Reference
 *
 * Description:
 *    This test is to assert simple functionality of sample 
 *
 * Steps:
 *    1. Assert opening one filter closes one that was previously opened
 *    2. Open first single filter, search, assert results, select and assert string
 *    3. Open second single filter, search, assert results, select and assert string
 *    4. Click Multiple Selection select a value and click cancel. Assert no change to text 
 *    5. Click again, select multiple values, click apply and assert text changed
 *        
 */
@Test
public void tc01_FilterComponent_AddInReference() {
    this.log.info("tc01_FilterComponent_AddInReference");

    /*
     * ## Step 1
     */
    //Click Single Selector and assert filter is opened
    WebElement singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    WebElement optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Click Multi Group Selector, assert it is opened and that previous filter is closed
    WebElement multiGroupSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(multiGroupSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    WebElement optionMultiGroupContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body"));
    assertNotNull(optionMultiGroupContainer);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body")));

    //Click Single Group Selector, assert it is opened and that previous filter is closed
    WebElement singleGroupSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleGroupSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    WebElement optionSingleGroupContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body"));
    assertNotNull(optionSingleGroupContainer);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body")));

    //Click Multi Selector, assert it is opened and that previous filter is closed
    WebElement multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    WebElement optionGroupContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body"));
    assertNotNull(optionGroupContainer);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body")));

    /*
     * ## Step 2
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body"));
    assertNotNull(optionSingleContainer);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body")));

    //Search to filter shown options
    WebElement filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//input[@class='filter-filter-input']"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("ze");
    WebElement filterOption = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@title='Zero']"));
    assertNotNull(filterOption);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@title='One']")));

    //Select Zero, assert filter closed and strings correct
    WebElement zeroSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@title='Zero']/../div"));
    assertNotNull(zeroSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_simple']//div[@title='Zero']/../div"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body")));
    String selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//span[@class='filter-root-info-selected-item']"));
    assertEquals("Zero", selectedString);

    /*
     * ## Step 3
     */
    //Click Multi Selector and assert filter is opened
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    WebElement optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select All, click Apply and assert filter closed and strings correct
    WebElement allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='multiFilterObj_simple']//div[@class='filter-root-selection-icon none-selected']"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='multiFilterObj_simple']//div[@class='filter-root-selection-icon none-selected']"));
    WebElement applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//button[contains(text(),'Apply')]"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    /*
     * ## Step 4
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Search to filter shown options, cancel filter and assert One is shown again
    filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//input[@class='filter-filter-input']"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("fif");
    filterOption = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='Fifteen']"));
    assertNotNull(filterOption);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']")));
    WebElement filterClear = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-filter-clear']"));
    assertNotNull(filterClear);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-filter-clear']"));
    WebElement oneOption = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']"));
    assertNotNull(oneOption);

    //Select One, assert filter closed and strings correct
    WebElement oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']/../div"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_group']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    /*
     * ## Step 5
     */
    //Click Multi Selector and assert filter is opened
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select 4 options, click Apply and assert filter closed and strings correct
    this.elemHelper.ClearAndSendKeys(driver,
            By.xpath("//div[@id='multiFilterObj_group']//input[@class='filter-filter-input']"), "twelve");
    WebElement twelveSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twelve']/../div"));
    assertNotNull(twelveSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twelve']/../div"));
    this.elemHelper.ClearAndSendKeys(driver,
            By.xpath("//div[@id='multiFilterObj_group']//input[@class='filter-filter-input']"), "twenty");
    WebElement twentyFiveSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twenty-two']/../div"));
    assertNotNull(twentyFiveSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twenty-two']/../div"));
    this.elemHelper.ClearAndSendKeys(driver,
            By.xpath("//div[@id='multiFilterObj_group']//input[@class='filter-filter-input']"), "six");
    WebElement sixSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Six']/../div"));
    assertNotNull(sixSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_group']//div[@title='Six']/../div"));
    this.elemHelper.ClearAndSendKeys(driver,
            By.xpath("//div[@id='multiFilterObj_group']//input[@class='filter-filter-input']"), "eighteen");
    WebElement eighteenSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Eighteen']/../div"));
    assertNotNull(eighteenSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Eighteen']/../div"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_group']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//button[contains(text(),'Apply')]"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    assertEquals("4 / 29", selectedString);
}

From source file:com.pentaho.ctools.cde.reference.FilterReference.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name://from  w w w.ja  v a  2s  .  co  m
 *    Sniff test to Filter Component Reference
 *
 * Description:
 *    This test is to assert simple functionality of sample 
 *
 * Steps:
 *    1. Click Single Selection, search for eighteen and assert it has one result
 *    2. Select it. Assert text changed and selector closed
 *    3. Click Multiple Selection select a value and click cancel. Assert no change to text 
 *    4. Click again, select multiple values, click apply and assert text changed
 *        
 */
@Test
public void tc01_FilterComponent_FilterReference() {
    this.log.info("tc01_FilterComponent_FilterReference");

    /*
     * ## Step 1
     */
    //Click Single Selector
    WebElement singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//span[@class='filter-root-info-selected-item']"));
    assertNotNull(singleSelector);
    singleSelector.click();

    //search for eighteen and assert only option
    WebElement filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("input.filter-filter-input"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("eighteen");
    WebElement filterOption = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='singleFilterObj_group']//div[@class='filter-root-items']//div[@title='Eighteen']"));
    assertNotNull(filterOption);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-root-items']/div")));

    /*
     * ## Step 2
     */
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='singleFilterObj_group']//div[@class='filter-root-items']//div[@title='Eighteen']/../div"));
    assertTrue(
            this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@class='filter-root-items']")));
    String selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_group']//span[@class='filter-root-info-selected-item']"));
    assertEquals("Eighteen", selectedString);
    String selectedItem = this.elemHelper.WaitForElementPresentGetText(driver,
            By.id("txt_singleSelectionObj_group"));
    assertEquals("Result: [\"[Ones].[Eighteen]\"]", selectedItem);

    /*
     * ## Step 3
     */
    WebElement multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    WebElement selectThree = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Three']/../div"));
    assertNotNull(selectThree);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_group']//div[@title='Three']/../div"));
    WebElement cancelButton = this.elemHelper.FindElement(driver,
            By.xpath("//button[contains(text(),'Cancel')]"));
    assertNotNull(cancelButton);
    this.elemHelper.ClickJS(driver, By.xpath("//button[contains(text(),'Cancel')]"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.xpath("//button[contains(text(),'Cancel')]")));
    String selectedMultiString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    assertEquals("None", selectedMultiString);
    String selectedMultiItem = this.elemHelper.WaitForElementPresentGetText(driver,
            By.id("txt_multiSelectionObj_group"));
    assertEquals("Result: [] Selected items:", selectedMultiItem);

    /*
     * ## Step 4
     */
    //Open multi selector
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    //Search for th, assert shown results and select shown options
    this.elemHelper.SendKeys(driver, By.cssSelector("div#multiFilterObj_group input.filter-filter-input"),
            "th");
    WebElement groupZeroes = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("  //div[@id='multiFilterObj_group']//div[contains(text(),'Zeroes')]"));
    assertNotNull(groupZeroes);
    selectThree = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Three']/../div"));
    assertNotNull(selectThree);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_group']//div[@title='Three']/../div"));
    WebElement groupOnes = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("  //div[@id='multiFilterObj_group']//div[contains(text(),'Ones')]"));
    assertNotNull(groupOnes);
    WebElement selectThirteen = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Thirteen']/../div"));
    assertNotNull(selectThirteen);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Thirteen']/../div"));
    WebElement selectTwentyThree = this.elemHelper.FindElementInvisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twenty-three']"));
    assertNotNull(selectTwentyThree);
    WebElement applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver, By.xpath("//button[contains(text(),'Apply')]"));
    assertTrue(
            this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//button[contains(text(),'Apply')]")));

    //Assert correct values selected
    selectedMultiString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    assertEquals("2 / 29", selectedMultiString);
    selectedMultiItem = this.elemHelper.WaitForElementPresentGetText(driver,
            By.id("txt_multiSelectionObj_group"));
    assertEquals(selectedMultiItem,
            "Result: [\"[Zeroes].[Three]\",\"[Ones].[Thirteen]\"] Selected items: [Zeroes].[Three][Ones].[Thirteen]");
}

From source file:com.pentaho.ctools.cde.reference.FilterVisualGuide.java

License:Apache License

/**
* ############################### Test Case 1 ###############################
*
* Test Case Name:/*  w w  w.  ja v a 2 s  . c  o  m*/
*    Sniff test to Filter Component Visual Guide Reference
*
* Description:
*    This test is to assert simple functionality of sample 
*
* Steps:
*    1. Open first set of filters, make selections and assert string
*    2. Open third filter and assert limited to five selections
*    3. Open second set of filters, make selections and assert string
*    4. Assert third set of filters expanded, make selections, assert string and filter still expanded
*    5. Open first set of filters, make selections and assert string
*    6. Open add in filter and assert colors, make selection and assert string. Assert message on two next filters
*    7. Assert two last filters are expanded, make selections, assert string and filter still expanded
*        
*/
@Test
public void tc01_FilterComponent_VisualGuide() {
    this.log.info("tc01_FilterComponent_VisualGuide");

    /*
     * ## Step 1
     */
    //Click Single Selector and assert filter is opened
    WebElement singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    WebElement optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Select Zero, assert filter closed and strings correct
    WebElement oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_simple']//div[@title='One']/../div"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body")));
    String selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Click Multi Selector and assert filter is opened
    WebElement multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//div[@class='filter-collapse-icon collapsed']"));
    WebElement optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select All, click Apply and assert filter closed and strings correct
    WebElement allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='multiFilterObj_simple']//div[@class='filter-root-selection-icon none-selected']"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='multiFilterObj_simple']//div[@class='filter-root-selection-icon none-selected']"));
    WebElement applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//button[contains(text(),'Apply')]"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    /*
     * ## Step 2
     */
    //Click Limited Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@class='filter-collapse-icon collapsed']"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_limited div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Select 5 options, assert limit message shown
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='One']/../div"));
    WebElement twoSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Two']/../div"));
    assertNotNull(twoSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Two']/../div"));
    WebElement threeSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Three']/../div"));
    assertNotNull(threeSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Three']/../div"));
    WebElement fourSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Four']/../div"));
    assertNotNull(fourSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Four']/../div"));
    WebElement fiveSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Five']/../div"));
    assertNotNull(fiveSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Five']/../div"));
    String limitMessage = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@class='filter-root-notification']"));
    assertEquals(limitMessage, "The selection limit (5) for specific items has been reached.");

    //Click one more element and assert not selected
    WebElement sixSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Six']/../div"));
    assertNotNull(sixSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Six']/../div"));
    WebElement sixNotSelected = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='multiFilterObj_limited']//div[@title='Six']/../../../div[@class='filter-item-container none-selected']"));
    assertNotNull(sixNotSelected);
    //Apply and assert string
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//button[contains(text(),'Apply')]"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_limited div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//span[@class='filter-root-info-selected-items']"));
    assertEquals("5 / 19", selectedString);

    /*
     * ## Step 3
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Select One, assert filter closed and strings correct
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']/../div"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_group']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Click Multi Selector and assert filter is opened
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@class='filter-collapse-icon collapsed']"));
    optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select All, click Apply and assert filter closed and strings correct
    allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='multiFilterObj_group']//div[@class='filter-root-selection-icon none-selected']"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='multiFilterObj_group']//div[@class='filter-root-selection-icon none-selected']"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_group']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//button[contains(text(),'Apply')]"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    /*
     * ## Step 4
     */
    //Assert filters are opened
    WebElement expandedSingleSelector = null;
    WebElement expandedMultiSelector = null;
    expandedSingleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_expanded div.filter-root-body"));
    assertNotNull(expandedSingleSelector);
    expandedMultiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_expanded div.filter-root-body"));
    assertNotNull(expandedMultiSelector);

    //Select One, assert filter closed and strings correct
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_expanded']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_expanded']//div[@title='One']/../div"));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_expanded']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Select All, click Apply and assert filter closed and strings correct
    allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='multiFilterObj_expanded']//div[@class='filter-root-selection-icon none-selected']"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='multiFilterObj_expanded']//div[@class='filter-root-selection-icon none-selected']"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_expanded']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_expanded']//button[contains(text(),'Apply')]"));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_expanded']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    //Assert filters are opened
    expandedSingleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_expanded div.filter-root-body"));
    assertNotNull(expandedSingleSelector);
    expandedMultiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_expanded div.filter-root-body"));
    assertNotNull(expandedMultiSelector);

    /*
     * ## Step 5
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='singleFilterObj_simple_paginated']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='singleFilterObj_simple_paginated']//div[@class='filter-collapse-icon collapsed']"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple_paginated div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Select One, assert filter closed and strings correct
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple_paginated']//div[@title='Entry 1']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_simple_paginated']//div[@title='Entry 1']/../div"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_simple_paginated div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='singleFilterObj_simple_paginated']//span[@class='filter-root-info-selected-item']"));
    assertEquals("Entry 1", selectedString);

    //Click Multi Selector and assert filter is opened
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='multiFilterObj_simple_paginated']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='multiFilterObj_simple_paginated']//div[@class='filter-collapse-icon collapsed']"));
    optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple_paginated div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select All, click Apply and assert filter closed and strings correct
    allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='multiFilterObj_simple_paginated']//div[@class='filter-root-selection-icon none-selected']"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='multiFilterObj_simple_paginated']//div[@class='filter-root-selection-icon none-selected']"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_simple_paginated']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple_paginated']//button[contains(text(),'Apply')]"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_simple_paginated div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='multiFilterObj_simple_paginated']//span[@class='filter-root-info-selected-items']"));
    assertEquals("50 / 1000", selectedString);

    /*
     * ## Step 6
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_addIn']//div[@class='filter-collapse-icon collapsed']"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_addIn']//div[@class='filter-collapse-icon collapsed']"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_addIn div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Assert different colors
    String oneColor = this.elemHelper
            .WaitForElementPresenceAndVisible(driver,
                    By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='One']/../../div"))
            .getAttribute("style");
    assertFalse(oneColor.isEmpty());
    String twoColor = this.elemHelper
            .WaitForElementPresenceAndVisible(driver,
                    By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='Two']/../../div"))
            .getAttribute("style");
    assertNotNull(twoColor);
    String threeColor = this.elemHelper
            .WaitForElementPresenceAndVisible(driver,
                    By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='Three']/../../div"))
            .getAttribute("style");
    assertNotNull(threeColor);
    String fourColor = this.elemHelper
            .WaitForElementPresenceAndVisible(driver,
                    By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='Four']/../../div"))
            .getAttribute("style");
    assertNotNull(fourColor);

    //Select One, assert filter closed and strings correct
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='One']/../div"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_addIn div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_addIn']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Assert messages on next 2 filters
    String firstMessage = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_noData']//div[@class='filter-root-header-label']"));
    assertEquals("Unavailable", firstMessage);
    String secondMessage = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_noData_custom']//div[@class='filter-root-header-label']"));
    assertEquals("No available data", secondMessage);

    /*
     * ## Step 7
     */
    //Assert filters are opened
    WebElement valuesSingleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_values div.filter-root-body"));
    assertNotNull(valuesSingleSelector);
    WebElement valuesMultiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_values div.filter-root-body"));
    assertNotNull(valuesMultiSelector);

    //Select One, assert filter closed and strings correct
    WebElement filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_values']//input[@class='filter-filter-input']"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("one");
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_values']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    WebElement oneValue = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='singleFilterObj_values']//div[@title='One']/../div[@class='filter-item-value']"));
    assertNotNull(oneValue);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='singleFilterObj_values']//div[@title='One']/../div[@class='filter-item-value']"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_values']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Select All, click Apply and assert filter closed and strings correct
    filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_values']//input[@class='filter-filter-input']"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("one");
    oneValue = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='singleFilterObj_values']//div[@title='One']/../div[@class='filter-item-value']"));
    assertNotNull(oneValue);
    allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='multiFilterObj_values']//div[@class='filter-root-selection-icon none-selected']"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='multiFilterObj_values']//div[@class='filter-root-selection-icon none-selected']"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_values']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_values']//button[contains(text(),'Apply')]"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_values']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    //Assert filters are opened
    valuesSingleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_values div.filter-root-body"));
    assertNotNull(valuesSingleSelector);
    valuesMultiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_values div.filter-root-body"));
    assertNotNull(valuesMultiSelector);
}

From source file:com.pentaho.ctools.cde.require.FilterAddinAccordion.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name://from  w  w  w .  j a v a 2  s.c o m
 *    Sniff test to Filter Component AddIn Reference
 *
 * Description:
 *    This test is to assert simple functionality of sample 
 *
 * Steps:
 *    1. Assert opening one filter closes one that was previously opened
 *    2. Open first single filter, search, assert results, select and assert string
 *    3. Open second single filter, search, assert results, select and assert string
 *    4. Click Multiple Selection select a value and click cancel. Assert no change to text 
 *    5. Click again, select multiple values, click apply and assert text changed
 *        
 */
@Test
public void tc01_FilterComponent_AddInReference() {
    this.log.info("tc01_FilterComponent_AddInReference");

    /*
     * ## Step 1
     */
    //Click Single Selector and assert filter is opened
    WebElement singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-collapse-icon.collapsed"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#singleFilterObj_simple  div.filter-collapse-icon.collapsed"));
    WebElement optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Click Multi Group Selector, assert it is opened and that previous filter is closed
    WebElement multiGroupSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-collapse-icon.collapsed"));
    assertNotNull(multiGroupSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-collapse-icon.collapsed"));
    WebElement optionMultiGroupContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body"));
    assertNotNull(optionMultiGroupContainer);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body")));

    //Click Single Group Selector, assert it is opened and that previous filter is closed
    WebElement singleGroupSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-collapse-icon.collapsed"));
    assertNotNull(singleGroupSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-collapse-icon.collapsed"));
    WebElement optionSingleGroupContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body"));
    assertNotNull(optionSingleGroupContainer);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body")));

    //Click Multi Selector, assert it is opened and that previous filter is closed
    WebElement multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-collapse-icon.collapsed"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-collapse-icon.collapsed"));
    WebElement optionGroupContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body"));
    assertNotNull(optionGroupContainer);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body")));

    /*
     * ## Step 2
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-collapse-icon.collapsed"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-collapse-icon.collapsed"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body"));
    assertNotNull(optionSingleContainer);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body")));

    //Search to filter shown options
    WebElement filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//input[@class='filter-filter-input']"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("ze");
    WebElement filterOption = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@title='Zero']"));
    assertNotNull(filterOption);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@title='One']")));

    //Select Zero, assert filter closed and strings correct
    WebElement zeroSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@title='Zero']/../div"));
    assertNotNull(zeroSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_simple']//div[@title='Zero']/../div"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body")));
    String selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//span[@class='filter-root-info-selected-item']"));
    assertEquals("Zero", selectedString);

    /*
     * ## Step 3
     */
    //Click Multi Selector and assert filter is opened
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-collapse-icon.collapsed"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-collapse-icon.collapsed"));
    WebElement optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select All, click Apply and assert filter closed and strings correct
    WebElement allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-selection-icon.none-selected"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-selection-icon.none-selected"));
    WebElement applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//button[contains(text(),'Apply')]"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    /*
     * ## Step 4
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-collapse-icon.collapsed"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-collapse-icon.collapsed"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Search to filter shown options, cancel filter and assert One is shown again
    filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//input[@class='filter-filter-input']"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("fif");
    filterOption = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='Fifteen']"));
    assertNotNull(filterOption);
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']")));
    WebElement filterClear = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-filter-clear']"));
    assertNotNull(filterClear);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@class='filter-filter-clear']"));
    WebElement oneOption = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']"));
    assertNotNull(oneOption);

    //Select One, assert filter closed and strings correct
    WebElement oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']/../div"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_group']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    /*
     * ## Step 5
     */
    //Click Multi Selector and assert filter is opened
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-collapse-icon.collapsed"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-collapse-icon.collapsed"));
    optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select 4 options, click Apply and assert filter closed and strings correct
    this.elemHelper.ClearAndSendKeys(driver,
            By.xpath("//div[@id='multiFilterObj_group']//input[@class='filter-filter-input']"), "twelve");
    WebElement twelveSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twelve']/../div"));
    assertNotNull(twelveSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twelve']/../div"));
    this.elemHelper.ClearAndSendKeys(driver,
            By.xpath("//div[@id='multiFilterObj_group']//input[@class='filter-filter-input']"), "twenty");
    WebElement twentyFiveSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twenty-two']/../div"));
    assertNotNull(twentyFiveSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Twenty-two']/../div"));
    this.elemHelper.ClearAndSendKeys(driver,
            By.xpath("//div[@id='multiFilterObj_group']//input[@class='filter-filter-input']"), "six");
    WebElement sixSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Six']/../div"));
    assertNotNull(sixSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_group']//div[@title='Six']/../div"));
    this.elemHelper.ClearAndSendKeys(driver,
            By.xpath("//div[@id='multiFilterObj_group']//input[@class='filter-filter-input']"), "eighteen");
    WebElement eighteenSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Eighteen']/../div"));
    assertNotNull(eighteenSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//div[@title='Eighteen']/../div"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_group']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//button[contains(text(),'Apply')]"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    assertEquals("4 / 29", selectedString);
}

From source file:com.pentaho.ctools.cde.require.FilterVisualGuide.java

License:Apache License

/**
* ############################### Test Case 1 ###############################
*
* Test Case Name://from   w w w.j av  a 2 s  . c  om
*    Sniff test to Filter Component Visual Guide Reference
*
* Description:
*    This test is to assert simple functionality of sample 
*
* Steps:
*    1. Open first set of filters, make selections and assert string
*    2. Open third filter and assert limited to five selections
*    3. Open second set of filters, make selections and assert string
*    4. Assert third set of filters expanded, make selections, assert string and filter still expanded
*    5. Open first set of filters, make selections and assert string
*    6. Open add in filter and assert colors, make selection and assert string. Assert message on two next filters
*    7. Assert two last filters are expanded, make selections, assert string and filter still expanded
*        
*/
@Test
public void tc01_FilterComponent_VisualGuide() {
    this.log.info("tc01_FilterComponent_VisualGuide");

    /*
     * ## Step 1
     */
    //Click Single Selector and assert filter is opened
    WebElement singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-collapse-icon.collapsed"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-collapse-icon.collapsed"));
    WebElement optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Select Zero, assert filter closed and strings correct
    WebElement oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_simple']//div[@title='One']/../div"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_simple div.filter-root-body")));
    String selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_simple']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Click Multi Selector and assert filter is opened
    WebElement multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-collapse-icon.collapsed"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-collapse-icon.collapsed"));
    WebElement optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select All, click Apply and assert filter closed and strings correct
    WebElement allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-selection-icon.none-selected"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-selection-icon.none-selected"));
    WebElement applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//button[contains(text(),'Apply')]"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_simple div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_simple']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    /*
     * ## Step 2
     */
    //Click Limited Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_limited div.filter-collapse-icon.collapsed"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_limited div.filter-collapse-icon.collapsed"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_limited div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Select 5 options, assert limit message shown
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='One']/../div"));
    WebElement twoSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Two']/../div"));
    assertNotNull(twoSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Two']/../div"));
    WebElement threeSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Three']/../div"));
    assertNotNull(threeSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Three']/../div"));
    WebElement fourSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Four']/../div"));
    assertNotNull(fourSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Four']/../div"));
    WebElement fiveSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Five']/../div"));
    assertNotNull(fiveSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Five']/../div"));
    String limitMessage = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@class='filter-root-notification']"));
    assertEquals(limitMessage, "The selection limit (5) for specific items has been reached.");

    //Click one more element and assert not selected
    WebElement sixSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Six']/../div"));
    assertNotNull(sixSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='multiFilterObj_limited']//div[@title='Six']/../div"));
    WebElement sixNotSelected = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.cssSelector(
            "div#example_limited div.filter-root-items div.filter-root-child div.filter-item-container.none-selected"));
    assertNotNull(sixNotSelected);

    //Apply and assert string
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//button[contains(text(),'Apply')]"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_limited div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_limited']//span[@class='filter-root-info-selected-items']"));
    assertEquals("5 / 19", selectedString);

    /*
     * ## Step 3
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-collapse-icon.collapsed"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-collapse-icon.collapsed"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Select One, assert filter closed and strings correct
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_group']//div[@title='One']/../div"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_group div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_group']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Click Multi Selector and assert filter is opened
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-collapse-icon.collapsed"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-collapse-icon.collapsed"));
    optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select All, click Apply and assert filter closed and strings correct
    allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-selection-icon.none-selected"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-selection-icon.none-selected"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_group']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_group']//button[contains(text(),'Apply')]"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_group div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_group']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    /*
     * ## Step 4
     */
    //Assert filters are opened
    WebElement expandedSingleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_expanded div.filter-root-body"));
    assertNotNull(expandedSingleSelector);
    WebElement expandedMultiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_expanded div.filter-root-body"));
    assertNotNull(expandedMultiSelector);

    //Select One, assert filter closed and strings correct
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_expanded']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_expanded']//div[@title='One']/../div"));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_expanded']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Select All, click Apply and assert filter closed and strings correct
    allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_expanded div.filter-root-selection-icon.none-selected"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_expanded div.filter-root-selection-icon.none-selected"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_expanded']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_expanded']//button[contains(text(),'Apply')]"));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_expanded']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    //Assert filters are opened
    expandedSingleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_expanded div.filter-root-body"));
    assertNotNull(expandedSingleSelector);
    expandedMultiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_expanded div.filter-root-body"));
    assertNotNull(expandedMultiSelector);

    /*
     * ## Step 5
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple_paginated div.filter-collapse-icon.collapsed"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#singleFilterObj_simple_paginated div.filter-collapse-icon.collapsed"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_simple_paginated div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Select One, assert filter closed and strings correct
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_simple_paginated']//div[@title='Entry 1']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='singleFilterObj_simple_paginated']//div[@title='Entry 1']/../div"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#singleFilterObj_simple_paginated div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='singleFilterObj_simple_paginated']//span[@class='filter-root-info-selected-item']"));
    assertEquals("Entry 1", selectedString);

    //Click Multi Selector and assert filter is opened
    multiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple_paginated div.filter-collapse-icon.collapsed"));
    assertNotNull(multiSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_simple_paginated div.filter-collapse-icon.collapsed"));
    optionMultiContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple_paginated div.filter-root-body"));
    assertNotNull(optionMultiContainer);

    //Select All, click Apply and assert filter closed and strings correct
    allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_simple_paginated div.filter-root-selection-icon.none-selected"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_simple_paginated div.filter-root-selection-icon.none-selected"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_simple_paginated']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_simple_paginated']//button[contains(text(),'Apply')]"));
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.cssSelector("div#multiFilterObj_simple_paginated div.filter-root-body")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='multiFilterObj_simple_paginated']//span[@class='filter-root-info-selected-items']"));
    assertEquals("50 / 1000", selectedString);

    /*
     * ## Step 6
     */
    //Click Single Selector and assert filter is opened
    singleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_addIn div.filter-collapse-icon.collapsed"));
    assertNotNull(singleSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#singleFilterObj_addIn div.filter-collapse-icon.collapsed"));
    optionSingleContainer = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_addIn div.filter-root-body"));
    assertNotNull(optionSingleContainer);

    //Assert different colors
    String oneColor = this.elemHelper
            .WaitForElementPresenceAndVisible(driver,
                    By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='One']/../../div"))
            .getAttribute("style");
    assertFalse(oneColor.isEmpty());
    String twoColor = this.elemHelper
            .WaitForElementPresenceAndVisible(driver,
                    By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='Two']/../../div"))
            .getAttribute("style");
    assertNotNull(twoColor);
    String threeColor = this.elemHelper
            .WaitForElementPresenceAndVisible(driver,
                    By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='Three']/../../div"))
            .getAttribute("style");
    assertNotNull(threeColor);
    String fourColor = this.elemHelper
            .WaitForElementPresenceAndVisible(driver,
                    By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='Four']/../../div"))
            .getAttribute("style");
    assertNotNull(fourColor);

    //Select One, assert filter closed and strings correct
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    this.elemHelper.ClickJS(driver, By.xpath("//div[@id='singleFilterObj_addIn']//div[@title='One']/../div"));
    assertTrue(this.elemHelper.WaitForElementInvisibility(driver,
            By.xpath("//div[@id='singleFilterObj_addIn']//div[@class='filter-root-body']")));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_addIn']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Assert messages on next 2 filters
    String firstMessage = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_noData']//div[@class='filter-root-header-label']"));
    assertEquals("Unavailable", firstMessage);
    String secondMessage = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_noData_custom']//div[@class='filter-root-header-label']"));
    assertEquals("No available data", secondMessage);

    /*
     * ## Step 7
     */
    //Assert filters are opened
    WebElement valuesSingleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_values div.filter-root-body"));
    assertNotNull(valuesSingleSelector);
    WebElement valuesMultiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_values div.filter-root-body"));
    assertNotNull(valuesMultiSelector);

    //Select One, assert filter closed and strings correct
    WebElement filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_values']//input[@class='filter-filter-input']"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("one");
    oneSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_values']//div[@title='One']/../div"));
    assertNotNull(oneSelector);
    WebElement oneValue = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='singleFilterObj_values']//div[@title='One']/../div[@class='filter-item-value']"));
    assertNotNull(oneValue);
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='singleFilterObj_values']//div[@title='One']/../div[@class='filter-item-value']"));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='singleFilterObj_values']//span[@class='filter-root-info-selected-item']"));
    assertEquals("One", selectedString);

    //Select All, click Apply and assert filter closed and strings correct
    filterSearch = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.xpath("//div[@id='singleFilterObj_values']//input[@class='filter-filter-input']"));
    assertNotNull(filterSearch);
    filterSearch.sendKeys("one");
    oneValue = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath(
            "//div[@id='singleFilterObj_values']//div[@title='One']/../div[@class='filter-item-value']"));
    assertNotNull(oneValue);
    allSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_values div.filter-root-selection-icon.none-selected"));
    assertNotNull(allSelector);
    this.elemHelper.ClickJS(driver,
            By.cssSelector("div#multiFilterObj_values div.filter-root-selection-icon.none-selected"));
    applyButton = this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='multiFilterObj_values']//button[contains(text(),'Apply')]"));
    assertNotNull(applyButton);
    this.elemHelper.ClickJS(driver,
            By.xpath("//div[@id='multiFilterObj_values']//button[contains(text(),'Apply')]"));
    selectedString = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='multiFilterObj_values']//span[@class='filter-root-info-selected-items']"));
    assertEquals("All", selectedString);

    //Assert filters are opened
    valuesSingleSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#singleFilterObj_values div.filter-root-body"));
    assertNotNull(valuesSingleSelector);
    valuesMultiSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver,
            By.cssSelector("div#multiFilterObj_values div.filter-root-body"));
    assertNotNull(valuesMultiSelector);

}