Search in sources :

Example 21 with PageEditorPage

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

the class SearchIT method setupBeforeEach.

/**
 * Before Test Case
 */
@BeforeEach
public void setupBeforeEach() throws ClientException {
    // level 1
    page1Path = authorClient.createPage("page_1", "page_1", rootPage, defaultPageTemplate).getSlingPath();
    HashMap<String, String> data = new HashMap<String, String>();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Parent Page 1");
    Commons.editNodeProperties(adminClient, page1Path, data);
    // create 20 pages
    for (int i = 0; i < 20; i++) {
        String pagePath = authorClient.createPage("page" + i, "page" + i, page1Path, defaultPageTemplate).getSlingPath();
        data.clear();
        data.put("_charset_", "UTF-8");
        data.put("./jcr:content/jcr:title", "Page " + i);
        Commons.editNodeProperties(adminClient, pagePath, data);
    }
    // level 2
    page11Path = authorClient.createPage("page_1_1", "page_1_1", page1Path, defaultPageTemplate).getSlingPath();
    data.clear();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Page 1.1");
    Commons.editNodeProperties(adminClient, page11Path, data);
    // level 2 1
    page111Path = authorClient.createPage("page_1_1_1", "page_1_1_1", page11Path, defaultPageTemplate).getSlingPath();
    data.clear();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Page 1.1.1");
    Commons.editNodeProperties(adminClient, page111Path, data);
    // level 2 2
    page112Path = authorClient.createPage("page_1_1_2", "page_1_1_2", page11Path, defaultPageTemplate).getSlingPath();
    data.clear();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Page 1.1.2");
    Commons.editNodeProperties(adminClient, page112Path, data);
    // level 2 3
    String page113Path = authorClient.createPage("page_1_1_3", "page_1_1_3", page11Path, defaultPageTemplate).getSlingPath();
    data.clear();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Page 1.1.3");
    Commons.editNodeProperties(adminClient, page113Path, data);
    // 2.
    String policySuffix = "/structure/page/new_policy";
    data.clear();
    data.put("jcr:title", "New Policy");
    data.put("sling:resourceType", "wcm/core/components/policy/policy");
    data.put("clientlibs", clientlibs);
    String policyPath1 = "/conf/" + label + "/settings/wcm/policies/core-component/components";
    policyPath = Commons.createPolicy(adminClient, policySuffix, data, policyPath1);
    // 3.
    String policyLocation = "core-component/components";
    String policyAssignmentPath = defaultPageTemplate + "/policies/jcr:content";
    data.clear();
    data.put("cq:policy", policyLocation + policySuffix);
    data.put("sling:resourceType", "wcm/core/components/policies/mappings");
    Commons.assignPolicy(adminClient, "", data, policyAssignmentPath);
    // create a proxy component
    proxyPath = Commons.createProxyComponent(adminClient, Commons.rtSearch_v1, Commons.proxyPath, null, null);
    // add the component to test page
    compPath = Commons.addComponent(adminClient, proxyPath, page11Path + Commons.relParentCompPath, "search", null);
    // open test page in page editor
    editorPage = new PageEditorPage(page11Path);
    editorPage.open();
    search = new Search();
}
Also used : HashMap(java.util.HashMap) Search(com.adobe.cq.wcm.core.components.it.seljup.util.components.search.v1.Search) PageEditorPage(com.adobe.cq.testing.selenium.pageobject.PageEditorPage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 22 with PageEditorPage

use of com.adobe.cq.testing.selenium.pageobject.PageEditorPage 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 23 with PageEditorPage

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

the class DataLayerIT method setupBeforeEach.

@BeforeEach
public void setupBeforeEach() throws ClientException {
    testPage = adminClient.createPage("testPage-" + System.currentTimeMillis(), "Test Page Title", "/content/core-components", "/conf/core-components/settings/wcm/templates/simple-template").getSlingPath();
    editorPage = new PageEditorPage(testPage);
    editorPage.open();
}
Also used : PageEditorPage(com.adobe.cq.testing.selenium.pageobject.PageEditorPage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 24 with PageEditorPage

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

the class FormHiddenIT method setup.

protected void setup() throws ClientException {
    // create the test page, store page path in 'testPagePath'
    testPage = authorClient.createPage("testPage", "Test Page Title", rootPage, defaultPageTemplate).getSlingPath();
    // create a proxy component
    compPathHidden = Commons.createProxyComponent(adminClient, formHiddenRT, Commons.proxyPath, null, null);
    // add the core form container component
    hiddenPath = Commons.addComponent(adminClient, compPathHidden, testPage + Commons.relParentCompPath, "formhidden", null);
    formHidden = new FormHidden();
    // open the page in the editor
    editorPage = new PageEditorPage(testPage);
    editorPage.open();
}
Also used : PageEditorPage(com.adobe.cq.testing.selenium.pageobject.PageEditorPage) FormHidden(com.adobe.cq.wcm.core.components.it.seljup.util.components.formhidden.v1.FormHidden)

Example 25 with PageEditorPage

use of com.adobe.cq.testing.selenium.pageobject.PageEditorPage 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

PageEditorPage (com.adobe.cq.testing.selenium.pageobject.PageEditorPage)28 HashMap (java.util.HashMap)16 BeforeEach (org.junit.jupiter.api.BeforeEach)8 EditableToolbar (com.adobe.cq.testing.selenium.pagewidgets.cq.EditableToolbar)3 AuthorBaseUITest (com.adobe.cq.wcm.core.components.it.seljup.AuthorBaseUITest)3 EditableToolbarAssertion (com.adobe.cq.wcm.core.components.it.seljup.util.assertion.EditableToolbarAssertion)3 DisplayName (org.junit.jupiter.api.DisplayName)3 Test (org.junit.jupiter.api.Test)3 WebDriver (org.openqa.selenium.WebDriver)3 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)3 ContentFragment (com.adobe.cq.wcm.core.components.it.seljup.util.components.contentfragment.v1.ContentFragment)2 FormComponents (com.adobe.cq.wcm.core.components.it.seljup.util.components.formcomponents.v1.FormComponents)2 PropertiesPage (com.adobe.cq.testing.selenium.pageobject.cq.sites.PropertiesPage)1 Accordion (com.adobe.cq.wcm.core.components.it.seljup.util.components.accordion.v1.Accordion)1 Button (com.adobe.cq.wcm.core.components.it.seljup.util.components.button.v1.Button)1 Carousel (com.adobe.cq.wcm.core.components.it.seljup.util.components.carousel.v1.Carousel)1 AssetFinder (com.adobe.cq.wcm.core.components.it.seljup.util.components.commons.AssetFinder)1 ContentFragmentList (com.adobe.cq.wcm.core.components.it.seljup.util.components.contentfragmentlist.v1.ContentFragmentList)1 UrlProcessors (com.adobe.cq.wcm.core.components.it.seljup.util.components.embed.UrlProcessors)1 OEmbed (com.adobe.cq.wcm.core.components.it.seljup.util.components.embed.UrlProcessors.OEmbed)1