use of com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar 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");
}
use of com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class BreadcrumbTests method openConfiguration.
private void openConfiguration(String compPath) throws TimeoutException {
String component = "[data-type='Editable'][data-path='" + compPath + "']";
final WebDriver webDriver = WebDriverRunner.getWebDriver();
new WebDriverWait(webDriver, RequestConstants.TIMEOUT_TIME_SEC).until(ExpectedConditions.elementToBeClickable(By.cssSelector(component)));
EditableToolbar editableToolbar = editorPage.openEditableToolbar(compPath);
EditableToolbarAssertion editableToolbarAssertion = new EditableToolbarAssertion(editableToolbar, "editable toolbar of none style selector enabled component - %s button is not displayed while it should");
editableToolbarAssertion.assertConfigureButton(true);
editableToolbar.clickConfigure();
}
use of com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class Commons method openEditDialog.
public static void openEditDialog(EditorPage editorPage, String compPath) throws TimeoutException, InterruptedException {
String component = "[data-type='Editable'][data-path='" + compPath + "']";
final WebDriver webDriver = WebDriverRunner.getWebDriver();
new WebDriverWait(webDriver, RequestConstants.TIMEOUT_TIME_SEC).until(ExpectedConditions.elementToBeClickable(By.cssSelector(component)));
EditableToolbar editableToolbar = editorPage.openEditableToolbar(compPath);
editableToolbar.clickConfigure();
Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
}
use of com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar 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();
}
use of com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class TabsIT method testAllowedComponents.
/**
* Test: Allowed components
*/
@Test
@DisplayName("Test: Allowed components")
public void testAllowedComponents() throws ClientException, InterruptedException, TimeoutException {
String teaserProxyPath = Commons.createProxyComponent(adminClient, Commons.rtTeaser_v1, Commons.proxyPath, null, null);
String policySuffix = "/tabs/new_policy";
HashMap<String, String> data = new HashMap<String, String>();
data.clear();
data.put("jcr:title", "New Policy");
data.put("sling:resourceType", "wcm/core/components/policy/policy");
data.put("components", teaserProxyPath);
String policyPath1 = "/conf/" + label + "/settings/wcm/policies/core-component/components";
policyPath = Commons.createPolicy(adminClient, policySuffix, data, policyPath1);
// add a policy for tabs component
String policyLocation = "core-component/components";
String policyAssignmentPath = defaultPageTemplate + "/policies/jcr:content/root/responsivegrid/core-component/components";
data.clear();
data.put("cq:policy", policyLocation + policySuffix);
data.put("sling:resourceType", "wcm/core/components/policies/mappings");
Commons.assignPolicy(adminClient, "/tabs", data, policyAssignmentPath, 200, 201);
String testPage = authorClient.createPage("testPage", "Test Page Title", rootPage, defaultPageTemplate).getSlingPath();
String compPath = Commons.addComponent(adminClient, proxyPath, testPage + Commons.relParentCompPath, "tabs", null);
// open test page in page editor
editorPage = new PageEditorPage(testPage);
editorPage.open();
String component = "[data-type='Editable'][data-path='" + compPath + "']";
final WebDriver webDriver = WebDriverRunner.getWebDriver();
new WebDriverWait(webDriver, RequestConstants.TIMEOUT_TIME_SEC).until(ExpectedConditions.elementToBeClickable(By.cssSelector(component)));
EditableToolbar editableToolbar = editorPage.openEditableToolbar(compPath);
// 2.
EditableToolbarAssertion editableToolbarAssertion = new EditableToolbarAssertion(editableToolbar, "editable toolbar of none style selector enabled component - %s button is displayed while it should not");
editableToolbarAssertion.assertInsertButton(true);
editableToolbar.getInsertButton().click();
Commons.webDriverWait(RequestConstants.WEBDRIVER_WAIT_TIME_MS);
assertTrue(Commons.isComponentPresentInInsertDialog(teaserProxyPath), "teaser component should be present in insert dialog");
Commons.deleteProxyComponent(adminClient, teaserProxyPath);
}
Aggregations