Search in sources :

Example 1 with TabsEditDialog

use of com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class TabsIT method testReorderItem.

/**
 * Test: Edit Dialog : Reorder items
 *
 * 1. create new items with titles
 * 2. open the edit dialog
 * 3. move the last item before the first one
 * 4. save the edit dialog
 * 5. open the edit dialog
 * 6. verify the new order
 * 7. save the edit dialog
 *
 * @throws InterruptedException
 */
@Test
@DisplayName("Test: Edit Dialog : Re-order children")
public void testReorderItem() throws InterruptedException {
    // 1.
    createItems();
    // 2.
    TabsEditDialog editDialog = tabs.openEditDialog(cmpPath);
    ChildrenEditor childrenEditor = editDialog.getChildrenEditor();
    editDialog.openItemsTab();
    // 3.
    childrenEditor.moveItems(2, 0);
    // 4.
    Commons.saveConfigureDialog();
    // 5.
    tabs.openEditDialog(cmpPath);
    editDialog.openItemsTab();
    // 6.
    ElementsCollection items = childrenEditor.getInputItems();
    assertTrue(items.size() == 3, "Number to items added should be 3");
    // In chrome browser re-order is not working as expected
    assertTrue(items.get(0).getValue().equals("item2") || items.get(0).getValue().equals("item0"), "First input item should be item2 or item0");
    assertTrue(items.get(1).getValue().equals("item0") || items.get(1).getValue().equals("item2"), "Second input item should be item0 or item2");
    assertTrue(items.get(2).getValue().equals("item1"), "Second input item should be item1");
    // 7.
    Commons.saveConfigureDialog();
}
Also used : ChildrenEditor(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.ChildrenEditor) ElementsCollection(com.codeborne.selenide.ElementsCollection) TabsEditDialog(com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog) AuthorBaseUITest(com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 2 with TabsEditDialog

use of com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class TabsIT method testRemoveItem.

/**
 * Test: Edit Dialog : Remove items
 *
 * 1. create new items with titles
 * 2. open the edit dialog
 * 3. remove the first item and save the edit dialog
 * 4. open the edit dialog
 * 5. verify that the first item has been removed
 * 6. save the edit dialog
 *
 * @throws InterruptedException
 */
@Test
@DisplayName("Test: Edit Dialog : Remove items")
public void testRemoveItem() throws InterruptedException {
    // 1.
    createItems();
    // 2.
    TabsEditDialog editDialog = tabs.openEditDialog(cmpPath);
    ChildrenEditor childrenEditor = editDialog.getChildrenEditor();
    editDialog.openItemsTab();
    // 3.
    childrenEditor.removeFirstItem();
    Commons.saveConfigureDialog();
    // 4.
    tabs.openEditDialog(cmpPath);
    editDialog.openItemsTab();
    ElementsCollection items = childrenEditor.getInputItems();
    // 5.
    assertTrue(items.size() == 2, "Number to items added should be 2");
    assertTrue(items.get(0).getValue().equals("item1"), "First input item should be item1");
    assertTrue(items.get(1).getValue().equals("item2"), "Second input item should be item2");
    // 6.
    Commons.saveConfigureDialog();
}
Also used : ChildrenEditor(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.ChildrenEditor) ElementsCollection(com.codeborne.selenide.ElementsCollection) TabsEditDialog(com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog) AuthorBaseUITest(com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 3 with TabsEditDialog

use of com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class TabsIT method testSetActiveItem.

/**
 * Test: Edit Dialog : Re-order children
 */
@Test
@DisplayName("Test: Edit Dialog : Re-order children")
public void testSetActiveItem() throws InterruptedException {
    createItems();
    TabsEditDialog editDialog = tabs.openEditDialog(cmpPath);
    // switch to properties tab
    TabsEditDialog.EditDialogProperties editDialogProperties = editDialog.openPropertiesTab();
    // select second item as active
    editDialogProperties.setItemActive("item1");
    // save the edit dialog
    Commons.saveConfigureDialog();
    // check the second tab is active
    Commons.switchContext("ContentFrame");
    assertTrue(tabs.isTabActive("item1"), "item1 tab should be active");
    assertTrue(tabs.isTabPanelActive(1), "Second panel should be active");
    Commons.switchToDefaultContext();
    // open the edit dialog
    tabs.openEditDialog(cmpPath);
    // switch to properties tab
    editDialogProperties = editDialog.openPropertiesTab();
    // select second item as active
    editDialogProperties.setItemActive("Default");
    // save the edit dialog
    Commons.saveConfigureDialog();
    // check the first tab is active
    Commons.switchContext("ContentFrame");
    assertTrue(tabs.isTabActive("item0"), "item0 tab should be active");
    assertTrue(tabs.isTabPanelActive(0), "First panel should be active");
}
Also used : TabsEditDialog(com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog) AuthorBaseUITest(com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 4 with TabsEditDialog

use of com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class TabsIT method createItems.

/**
 * Create three items via the children editor
 *
 * 1. open the edit dialog
 * 2. add item via the children editor
 * 3. save the edit dialog
 * 4. Check if items are added
 *
 * @throws InterruptedException
 */
private ElementsCollection createItems() throws InterruptedException {
    // 1.
    TabsEditDialog editDialog = tabs.openEditDialog(cmpPath);
    editDialog.openItemsTab();
    // 2.
    ChildrenEditor childrenEditor = editDialog.getChildrenEditor();
    childrenEditor.clickAddButton();
    InsertComponentDialog insertComponentDialog = editDialog.getInsertComponentDialog();
    insertComponentDialog.selectComponent("/libs/wcm/foundation/components/responsivegrid");
    childrenEditor.getInputItems().last().sendKeys("item0");
    childrenEditor.clickAddButton();
    insertComponentDialog.selectComponent("/libs/wcm/foundation/components/responsivegrid");
    childrenEditor.getInputItems().last().sendKeys("item1");
    childrenEditor.clickAddButton();
    insertComponentDialog.selectComponent("/libs/wcm/foundation/components/responsivegrid");
    childrenEditor.getInputItems().last().sendKeys("item2");
    // 3.
    Commons.saveConfigureDialog();
    // 4.
    tabs.openEditDialog(cmpPath);
    editDialog.openItemsTab();
    ElementsCollection items = childrenEditor.getInputItems();
    assertTrue(items.size() == 3, "Number to items added should be 3");
    assertTrue(items.get(0).getValue().equals("item0"), "First input item should be item0");
    assertTrue(items.get(1).getValue().equals("item1"), "Second input item should be item1");
    assertTrue(items.get(2).getValue().equals("item2"), "Third input item should be item2");
    Commons.saveConfigureDialog();
    return items;
}
Also used : ChildrenEditor(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.ChildrenEditor) ElementsCollection(com.codeborne.selenide.ElementsCollection) TabsEditDialog(com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog) InsertComponentDialog(com.adobe.cq.testing.selenium.pagewidgets.cq.InsertComponentDialog)

Example 5 with TabsEditDialog

use of com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class TabsIT method addTabsItem.

/**
 * Create and title a single accordion item
 *
 * @param component component path
 * @param parentPath parent component path
 * @param itemName name of the item to be set
 * 1. add a component to the accordion
 * 2. open the edit dialog
 * 3. name the accordion item
 * 4. save the edit dialog
 *
 * @throws ClientException
 * @throws InterruptedException
 */
private String addTabsItem(String component, String parentPath, String itemName) throws ClientException, InterruptedException {
    // 1.
    String cmpPath = Commons.addComponent(adminClient, component, parentPath + "/", null, null);
    // 2.
    TabsEditDialog editDialog = tabs.openEditDialog(parentPath);
    ChildrenEditor childrenEditor = editDialog.getChildrenEditor();
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    editDialog.openItemsTab();
    // 3.
    childrenEditor.getInputItems().last().sendKeys(itemName);
    // 4.
    Commons.saveConfigureDialog();
    return cmpPath;
}
Also used : ChildrenEditor(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.ChildrenEditor) TabsEditDialog(com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog)

Aggregations

TabsEditDialog (com.adobe.cq.wcm.core.components.it.seljup.util.components.tabs.TabsEditDialog)5 ChildrenEditor (com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.ChildrenEditor)4 AuthorBaseUITest (com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest)3 ElementsCollection (com.codeborne.selenide.ElementsCollection)3 DisplayName (org.junit.jupiter.api.DisplayName)3 Test (org.junit.jupiter.api.Test)3 InsertComponentDialog (com.adobe.cq.testing.selenium.pagewidgets.cq.InsertComponentDialog)1