Search in sources :

Example 1 with FormComponents

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

the class FormComponentsIT 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
    compPathContainer = Commons.createProxyComponent(adminClient, formContainerRT, Commons.proxyPath, null, null);
    // add the core form container component
    containerPath = Commons.addComponent(adminClient, compPathContainer, testPage + Commons.relParentCompPath, "container", null);
    // create a proxy component
    compPathText = Commons.createProxyComponent(adminClient, formTextRT, Commons.proxyPath, null, null);
    // inside the form add a form text input field
    String inputPath = Commons.addComponent(adminClient, compPathText, containerPath + "/", "text", null);
    // set name and default value for the input field
    HashMap<String, String> data = new HashMap<String, String>();
    data.put("name", "inputName");
    data.put("defaultValue", "inputValue");
    Commons.editNodeProperties(adminClient, inputPath, data);
    // create a proxy component
    compPathHidden = Commons.createProxyComponent(adminClient, formHiddenRT, Commons.proxyPath, null, null);
    // inside the form add a hidden field component
    String hiddenPath = Commons.addComponent(adminClient, compPathHidden, containerPath + "/", "hidden", null);
    // set name and default value for the hidden field component
    data.clear();
    data.put("name", "hiddenName");
    data.put("value", "hiddenValue");
    Commons.editNodeProperties(adminClient, hiddenPath, data);
    // create a proxy component
    compPathOptions = Commons.createProxyComponent(adminClient, formOptionsRT, Commons.proxyPath, null, null);
    ;
    // inside the form add a form option component
    String optionPath = Commons.addComponent(adminClient, compPathOptions, containerPath + "/", "options", null);
    // create an option list items
    data.clear();
    data.put("./name", "optionName");
    data.put("./type", "checkbox");
    data.put("./items/item0/selected", "true");
    data.put("./items/item0/text", "text1");
    data.put("./items/item0/value", "value1");
    data.put("./items/item1/selected", "false");
    data.put("./items/item1/text", "text2");
    data.put("./items/item1/value", "value2");
    Commons.editNodeProperties(adminClient, optionPath, data);
    // create a proxy component
    compPathButton = Commons.createProxyComponent(adminClient, formButtonRT, Commons.proxyPath, null, null);
    // add a button to the form
    String buttonPath = Commons.addComponent(adminClient, compPathButton, containerPath + "/", "button", null);
    // make sure the button is a submit button
    data.clear();
    data.put("type", "submit");
    data.put("caption", "Submit");
    Commons.editNodeProperties(adminClient, buttonPath, data);
    // open the page in the editor
    editorPage = new PageEditorPage(testPage);
    editorPage.open();
    formComponents = new FormComponents();
}
Also used : HashMap(java.util.HashMap) PageEditorPage(com.adobe.cq.testing.selenium.pageobject.PageEditorPage) FormComponents(com.adobe.cq.wcm.core.components.it.seljup.util.components.formcomponents.v1.FormComponents)

Example 2 with FormComponents

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

the class FormContainerIT 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
    compPathContainer = Commons.createProxyComponent(adminClient, formContainerRT, Commons.proxyPath, null, null);
    // add the core form container component
    containerPath = Commons.addComponent(adminClient, compPathContainer, testPage + Commons.relParentCompPath, "container", null);
    // create a proxy component
    compPathText = Commons.createProxyComponent(adminClient, formTextRT, Commons.proxyPath, null, null);
    // inside the form add a form text input field
    String inputPath = Commons.addComponent(adminClient, compPathText, containerPath + "/", "text", null);
    // set name and default value for the input field
    HashMap<String, String> data = new HashMap<String, String>();
    data.put("name", "inputName");
    data.put("defaultValue", "inputValue");
    Commons.editNodeProperties(adminClient, inputPath, data);
    // create a proxy component
    compPathButton = Commons.createProxyComponent(adminClient, formButtonRT, Commons.proxyPath, null, null);
    // add a button to the form
    String buttonPath = Commons.addComponent(adminClient, compPathButton, containerPath + "/", "button", null);
    // create an option list items
    data.clear();
    data.put("type", "submit");
    data.put("title", "submit");
    Commons.editNodeProperties(adminClient, buttonPath, data);
    // open the page in the editor
    editorPage = new PageEditorPage(testPage);
    editorPage.open();
    formComponents = new FormComponents();
}
Also used : HashMap(java.util.HashMap) PageEditorPage(com.adobe.cq.testing.selenium.pageobject.PageEditorPage) FormComponents(com.adobe.cq.wcm.core.components.it.seljup.util.components.formcomponents.v1.FormComponents)

Aggregations

PageEditorPage (com.adobe.cq.testing.selenium.pageobject.PageEditorPage)2 FormComponents (com.adobe.cq.wcm.core.components.it.seljup.util.components.formcomponents.v1.FormComponents)2 HashMap (java.util.HashMap)2