Search in sources :

Example 11 with CoralSelectList

use of com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ButtonEditDialog method selectButtonType.

public void selectButtonType(String type) {
    $("[name='./type'] > button").click();
    CoralSelectList coralSelectList = new CoralSelectList($("[name='./type']"));
    if (!coralSelectList.isVisible()) {
        CoralSelect selectList = new CoralSelect("name='./type'");
        coralSelectList = selectList.openSelectList();
    }
    final WebDriver webDriver = WebDriverRunner.getWebDriver();
    WebElement element = webDriver.findElement(By.cssSelector("coral-selectlist-item[value='" + type + "']"));
    ((JavascriptExecutor) webDriver).executeScript("arguments[0].scrollIntoView(true);", element);
    coralSelectList.selectByValue(type);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) WebElement(org.openqa.selenium.WebElement) CoralSelectList(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList) CoralSelect(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelect)

Example 12 with CoralSelectList

use of com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class FormOptionsEditDialog method setOptionType.

/**
 * Set the option type
 */
public void setOptionType(String optionType) {
    // Open selectlist
    $("[name='./type'] > button").click();
    CoralSelectList coralSelectList = new CoralSelectList($("[name='./type']"));
    if (!coralSelectList.isVisible()) {
        CoralSelect selectList = new CoralSelect("name='./type'");
        coralSelectList = selectList.openSelectList();
    }
    final WebDriver webDriver = WebDriverRunner.getWebDriver();
    WebElement element = webDriver.findElement(By.cssSelector("coral-selectlist-item[value='" + optionType + "']"));
    ((JavascriptExecutor) webDriver).executeScript("arguments[0].scrollIntoView(true);", element);
    coralSelectList.selectByValue(optionType);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) WebElement(org.openqa.selenium.WebElement) CoralSelectList(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList) CoralSelect(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelect)

Example 13 with CoralSelectList

use of com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class AccordionIT method verifyExpandedItemsSelect.

/**
 * Switches to the edit dialog properties tab and verifies the provided (ordered) expanded items exist
 * in the expanded items select. Assumes the edit dialog is open.
 *
 * @param items list of items in component to be verified
 * @param properties editdialog properties object
 *
 * 1. switch to the properties tab
 * 2. open the expanded items select
 * 3. verify the expanded items match those passed
 */
private void verifyExpandedItemsSelect(ElementsCollection items, AccordionEditDialog.EditDialogProperties properties) {
    // 1.
    properties.openProperties();
    // 2.
    properties.openExpandedSelect(" > button");
    // 3.
    CoralSelectList selectedItems = properties.selectList();
    assertTrue(selectedItems.items().size() == items.size(), "Number of items in property config should be equal to added items number");
    for (int i = 0; i < items.size(); i++) {
        assertTrue(properties.getSelectedItemValue(i).contains(items.get(i).getValue()), "Selected item should be same as added item");
    }
}
Also used : CoralSelectList(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList)

Example 14 with CoralSelectList

use of com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class AccordionIT method testSetExpandedItems.

/**
 * Test: Edit Dialog : Set expanded items
 *
 * 1. create new items with titles
 * 2. set the second item expanded
 * 3. verify the second item is expanded
 * 4. open the edit dialog
 * 5. switch to the properties tab and also set the third item expanded
 * 6. save the edit dialog
 * 7. verify both second and third items are expanded
 *
 * @throws InterruptedException
 */
@Test
@DisplayName("Test: Edit Dialog : Set expanded items")
public void testSetExpandedItems() throws InterruptedException {
    // 1.
    createItem();
    // 2.
    selectExpandedItem(1);
    // 3.
    ArrayList<String> items = new ArrayList<>();
    items.add("item1");
    verifyExpandedItems(items);
    // 4.
    AccordionEditDialog editDialog = accordion.openEditDialog(cmpPath);
    // 5.
    AccordionEditDialog.EditDialogProperties properties = editDialog.getEditDialogProperties();
    properties.openProperties();
    properties.openExpandedSelect(" > button");
    CoralSelectList selectedItems = properties.selectList();
    selectedItems.selectByIndex(2);
    // 6.
    Commons.saveConfigureDialog();
    // wait for configuration changes to reflect
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    // 7.
    items.clear();
    items.add("item1");
    items.add("item2");
    verifyExpandedItems(items);
}
Also used : ArrayList(java.util.ArrayList) AccordionEditDialog(com.adobe.cq.wcm.core.components.it.seljup.util.components.accordion.AccordionEditDialog) CoralSelectList(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList) AuthorBaseUITest(com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 15 with CoralSelectList

use of com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class TitleEditDialog method getTitleTypeSelectList.

/**
 * @return list of the related coral popover that is opened.
 */
public CoralSelectList getTitleTypeSelectList() {
    CoralSelectList coralSelectList = new CoralSelectList($(titleType));
    if (coralSelectList.isVisible()) {
        return coralSelectList;
    } else {
        CoralPopOver popOver = CoralPopOver.firstOpened();
        popOver.waitVisible();
        waitForElementAnimationFinished(popOver.getCssSelector());
        return new CoralSelectList(popOver.element());
    }
}
Also used : CoralPopOver(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralPopOver) CoralSelectList(com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList)

Aggregations

CoralSelectList (com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelectList)15 CoralSelect (com.adobe.cq.testing.selenium.pagewidgets.coral.CoralSelect)7 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)7 WebDriver (org.openqa.selenium.WebDriver)7 WebElement (org.openqa.selenium.WebElement)7 CoralPopOver (com.adobe.cq.testing.selenium.pagewidgets.coral.CoralPopOver)3 AccordionEditDialog (com.adobe.cq.wcm.core.components.it.seljup.util.components.accordion.AccordionEditDialog)2 AuthorBaseUITest (com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest)1 ArrayList (java.util.ArrayList)1 DisplayName (org.junit.jupiter.api.DisplayName)1 Test (org.junit.jupiter.api.Test)1