Search in sources :

Example 1 with PanelSelector

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

the class AccordionIT method testPanelSelectItems.

/**
 * Test: Panel Select: Check items
 *
 * 1. open the component edit toolbar
 * 2. verify that initially no panel select action is available
 * 3. create new items with titles
 * 4. open the component edit toolbar
 * 5. verify the panel select action is available
 * 6. open the panel selector and verify it's open
 * 7. verify that three items are available and the correct titles are visible
 * 8. verify initial Accordion DOM item order is as expected
 * 9. click elsewhere and verify an out of area click closes the panel selector
 *
 * @throws TimeoutException
 * @throws InterruptedException
 */
@Test
@DisplayName("Test: Panel Select: Check items")
public void testPanelSelectItems() throws TimeoutException, InterruptedException {
    // 1.
    String component = "[data-type='Editable'][data-path='" + cmpPath + "']";
    final WebDriver webDriver = WebDriverRunner.getWebDriver();
    new WebDriverWait(webDriver, RequestConstants.TIMEOUT_TIME_SEC).until(ExpectedConditions.elementToBeClickable(By.cssSelector(component)));
    EditableToolbar editableToolbar = editorPage.openEditableToolbar(cmpPath);
    // 2.
    EditableToolbarAssertion editableToolbarAssertion = new EditableToolbarAssertion(editableToolbar, "editable toolbar of none style selector enabled component - %s button is displayed while it should not");
    editableToolbarAssertion.assertPanelSelectButton(false);
    // 3.
    createItem();
    // 4.
    editableToolbar = editorPage.openEditableToolbar(cmpPath);
    // 5.
    editableToolbarAssertion = new EditableToolbarAssertion(editableToolbar, "editable toolbar of none style selector enabled component - %s button is not displayed while it should");
    editableToolbarAssertion.assertPanelSelectButton(true);
    // 6.
    editableToolbar.clickPanelSelect();
    PanelSelector panelSelector = new PanelSelector();
    assertTrue(panelSelector.isVisible(), "Panel selector should be visible");
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    // 7.
    ElementsCollection items = panelSelector.getItems();
    assertTrue(items.size() == 3, "Number to items added should be 3");
    assertTrue(items.get(0).getText().contains("item0"), "First panel select item should be item0");
    assertTrue(items.get(1).getText().contains("item1"), "Second panel select item should be item1");
    assertTrue(items.get(2).getText().contains("item2"), "Third panel select item should be item2");
    // 8.
    Commons.switchContext("ContentFrame");
    ElementsCollection accordionItems = accordion.getAccordionItem();
    assertTrue(accordionItems.size() == 3, "Number to items added should be 3");
    assertTrue(accordion.getAccordionItemButton(0).getText().contains("item0"), "First panel select item should be item0");
    assertTrue(accordion.getAccordionItemButton(1).getText().contains("item1"), "Second panel select item should be item1");
    assertTrue(accordion.getAccordionItemButton(2).getText().contains("item2"), "Third panel select item should be item2");
    Commons.switchToDefaultContext();
    // 9.
    accordion.getCQOverlay().openPlaceholder(testPage);
    panelSelector = new PanelSelector();
    assertTrue(panelSelector.isVisible() == false, "Panel selector should not be visible");
}
Also used : WebDriver(org.openqa.selenium.WebDriver) ElementsCollection(com.codeborne.selenide.ElementsCollection) EditableToolbarAssertion(com.adobe.cq.wcm.core.components.it.seljup.util.assertion.EditableToolbarAssertion) EditableToolbar(com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) PanelSelector(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.PanelSelector) 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 PanelSelector

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

the class CarouselIT method testPanelSelect.

/**
 * Test: Panel Select
 */
@Test
@DisplayName("Test: Panel Select")
public void testPanelSelect() throws InterruptedException {
    String component = "[data-type='Editable'][data-path='" + cmpPath + "']";
    WebDriver webDriver = WebDriverRunner.getWebDriver();
    new WebDriverWait(webDriver, RequestConstants.TIMEOUT_TIME_SEC).until(ExpectedConditions.elementToBeClickable(By.cssSelector(component)));
    Commons.openEditableToolbar(cmpPath);
    assertTrue(!Commons.isPanelSelectPresent(), "Panel Select should not be present");
    createItems();
    Commons.openEditableToolbar(cmpPath);
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    assertTrue(Commons.isPanelSelectPresent(), "Panel Select should be present");
    Commons.openPanelSelect();
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    PanelSelector panelSelector = new PanelSelector();
    assertTrue(panelSelector.isVisible(), "Panel selector should be visible");
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    ElementsCollection items = panelSelector.getItems();
    assertTrue(items.size() == 3, "Number to items added should be 3");
    assertTrue(items.get(0).getText().contains("item0"), "First panel select items should be item0");
    assertTrue(items.get(1).getText().contains("item1"), "Second panel select item should be item1");
    assertTrue(items.get(2).getText().contains("item2"), "Second panel select item should be item2");
    Commons.switchContext("ContentFrame");
    assertTrue(carousel.getIndicators().get(0).getText().contains("item0"), "First indicator item should be item0");
    Commons.switchToDefaultContext();
    webDriver = WebDriverRunner.getWebDriver();
    new WebDriverWait(webDriver, RequestConstants.TIMEOUT_TIME_SEC).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(panelSelector.getCssSelector())));
    // 4.
    panelSelector.reorderItems(0, 2);
    Commons.switchContext("ContentFrame");
    // wait for the reordering to reflect
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    assertTrue(carousel.getIndicators().get(2).getText().contains("item0"), "Third indicator item should be item0 after re-order");
    Commons.switchToDefaultContext();
    carousel.getCQOverlay().openPlaceholder(testPage);
    panelSelector = new PanelSelector();
    assertTrue(panelSelector.isVisible() == false, "Panel selector should not be visible");
}
Also used : WebDriver(org.openqa.selenium.WebDriver) ElementsCollection(com.codeborne.selenide.ElementsCollection) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) PanelSelector(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.PanelSelector) 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 PanelSelector

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

the class AccordionIT method testPanelSelectReorder.

/**
 * Test: Panel Select: Reordering items
 *
 * 1. create new items with titles
 * 2. open the component edit toolbar
 * 3. open the panel selector and verify it's open
 * 4. drag to reorder
 * 5. verify new Accordion DOM item order is as expected
 *
 * @throws TimeoutException
 * @throws InterruptedException
 */
@Test
@DisplayName("Test: Panel Select: Reordering items")
public void testPanelSelectReorder() throws TimeoutException, InterruptedException {
    // 1.
    createItem();
    // 2.
    EditableToolbar editableToolbar = editorPage.openEditableToolbar(cmpPath);
    EditableToolbarAssertion editableToolbarAssertion = new EditableToolbarAssertion(editableToolbar, "editable toolbar of none style selector enabled component - %s button is not displayed while it should");
    editableToolbarAssertion.assertPanelSelectButton(true);
    // 3.
    editableToolbar.clickPanelSelect();
    PanelSelector panelSelector = new PanelSelector();
    final WebDriver webDriver = WebDriverRunner.getWebDriver();
    new WebDriverWait(webDriver, RequestConstants.TIMEOUT_TIME_SEC).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(panelSelector.getCssSelector())));
    // 4.
    panelSelector.reorderItems(0, 2);
    Commons.switchContext("ContentFrame");
    // 5.
    ElementsCollection accordionItems = accordion.getAccordionItem();
    // wait for the reordering to reflect
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    assertTrue(accordionItems.size() == 3, "Number to items added should be 3");
    assertTrue(accordion.getAccordionItemButton(0).getText().contains("item1"), "First panel select item should be item1");
    assertTrue(accordion.getAccordionItemButton(1).getText().contains("item2"), "Second panel select item should be item0");
    assertTrue(accordion.getAccordionItemButton(2).getText().contains("item0"), "Third panel select item should be item2");
    Commons.switchToDefaultContext();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) ElementsCollection(com.codeborne.selenide.ElementsCollection) EditableToolbarAssertion(com.adobe.cq.wcm.core.components.it.seljup.util.assertion.EditableToolbarAssertion) EditableToolbar(com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) PanelSelector(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.PanelSelector) 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 PanelSelector

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

the class TabsIT method testPanelSelectReorder.

/**
 * Test: Panel Select: Reordering items
 */
@Test
@DisplayName("Test: Panel Select: Reordering items")
public void testPanelSelectReorder() throws InterruptedException {
    // open the toolbar
    Commons.openEditableToolbar(cmpPath);
    // verify that initially no panel select action is available
    assertTrue(!Commons.isPanelSelectPresent(), "Panel Select button should not be present");
    // create new items with titles
    createItems();
    // open the toolbar
    Commons.openEditableToolbar(cmpPath);
    // verify the panel select action is available
    assertTrue(Commons.isPanelSelectPresent(), "Panel Select button should be present");
    // open the panel selector and verify it's open
    Commons.openPanelSelect();
    PanelSelector panelSelector = new PanelSelector();
    assertTrue(panelSelector.isVisible(), "Panel selector should be visible");
    // reorder: move first element to last position
    panelSelector.reorderItems(0, 2);
    Commons.switchContext("ContentFrame");
    // wait for the reordering to reflect
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    // verify new Tabs DOM item order is as expected
    ElementsCollection tabItems = tabs.getTabItems();
    assertTrue(tabItems.size() == 3, "Number to items added should be 3");
    assertTrue(tabItems.get(0).getText().contains("item1"), "First tab item should be item1");
    assertTrue(tabItems.get(1).getText().contains("item2"), "Second tab item should be item2");
    assertTrue(tabItems.get(2).getText().contains("item0"), "Third tab item should be item0");
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) PanelSelector(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.PanelSelector) AuthorBaseUITest(com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 5 with PanelSelector

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

the class TabsIT method testPanelSelectItems.

/**
 * Test: Panel Select: Check items
 */
@Test
@DisplayName("Test: Panel Select: Check items")
public void testPanelSelectItems() throws InterruptedException {
    // open the toolbar
    Commons.openEditableToolbar(cmpPath);
    // verify that initially no panel select action is available
    assertTrue(!Commons.isPanelSelectPresent(), "Panel Select button should not be present");
    // create new items with titles
    createItems();
    // open the toolbar
    Commons.openEditableToolbar(cmpPath);
    // verify the panel select action is available
    assertTrue(Commons.isPanelSelectPresent(), "Panel Select button should be present");
    // open the panel selector and verify it's open
    Commons.openPanelSelect();
    PanelSelector panelSelector = new PanelSelector();
    assertTrue(panelSelector.isVisible(), "Panel selector should be visible");
    // verify that 3 items are available in the panel selector and the correct titles are visible
    Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
    ElementsCollection panelSelectorItems = panelSelector.getItems();
    assertTrue(panelSelectorItems.size() == 3, "Number to items in panel selector should be 3");
    assertTrue(panelSelectorItems.get(0).getText().contains("item0"), "First panel select item should be item0");
    assertTrue(panelSelectorItems.get(1).getText().contains("item1"), "Second panel select item should be item1");
    assertTrue(panelSelectorItems.get(2).getText().contains("item2"), "Third panel select item should be item2");
    Commons.switchContext("ContentFrame");
    // verify initial Tabs DOM item order is as expected
    ElementsCollection tabItems = tabs.getTabItems();
    assertTrue(tabItems.size() == 3, "Number to items added should be 3");
    assertTrue(tabItems.get(0).getText().contains("item0"), "First tab item should be item0");
    assertTrue(tabItems.get(1).getText().contains("item1"), "Second tab item should be item1");
    assertTrue(tabItems.get(2).getText().contains("item2"), "Third tab item should be item2");
}
Also used : ElementsCollection(com.codeborne.selenide.ElementsCollection) PanelSelector(com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.PanelSelector) AuthorBaseUITest(com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

AuthorBaseUITest (com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest)5 PanelSelector (com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.PanelSelector)5 ElementsCollection (com.codeborne.selenide.ElementsCollection)5 DisplayName (org.junit.jupiter.api.DisplayName)5 Test (org.junit.jupiter.api.Test)5 WebDriver (org.openqa.selenium.WebDriver)3 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)3 EditableToolbar (com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar)2 EditableToolbarAssertion (com.adobe.cq.wcm.core.components.it.seljup.util.assertion.EditableToolbarAssertion)2