Search in sources :

Example 6 with EditableToolbar

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

the class Commons method openInlineEditor.

/**
 * Opens the inline editor for a component.
 * @param editorPage
 * @param compPath
 * @return
 * @throws TimeoutException
 */
public static InlineEditor openInlineEditor(EditorPage editorPage, 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);
    return editableToolbar.clickEdit();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) EditableToolbar(com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait)

Example 7 with EditableToolbar

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

the class AccordionIT 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 = "/accordion/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 accordion 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, "/accordion", data, policyAssignmentPath, 200, 201);
    String testPage = authorClient.createPage("testPage", "Test Page Title", rootPage, defaultPageTemplate).getSlingPath();
    String compPath = Commons.addComponent(adminClient, proxyPath, testPage + Commons.relParentCompPath, "accordion", 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);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) EditableToolbarAssertion(com.adobe.cq.wcm.core.components.it.seljup.util.assertion.EditableToolbarAssertion) HashMap(java.util.HashMap) EditableToolbar(com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar) PageEditorPage(com.adobe.cq.testing.selenium.pageobject.PageEditorPage) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) AuthorBaseUITest(com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 8 with EditableToolbar

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

the class CarouselIT 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 = "/carousel/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 carousel 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, "/carousel", data, policyAssignmentPath, 200, 201);
    String testPage = authorClient.createPage("testPage", "Test Page Title", rootPage, defaultPageTemplate).getSlingPath();
    String compPath = Commons.addComponent(adminClient, proxyPath, testPage + Commons.relParentCompPath, "carousel", 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);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) EditableToolbarAssertion(com.adobe.cq.wcm.core.components.it.seljup.util.assertion.EditableToolbarAssertion) HashMap(java.util.HashMap) EditableToolbar(com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar) PageEditorPage(com.adobe.cq.testing.selenium.pageobject.PageEditorPage) WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) AuthorBaseUITest(com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

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