diff options
Diffstat (limited to 'src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions')
8 files changed, 252 insertions, 0 deletions
diff --git a/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ActionComponent.java b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ActionComponent.java new file mode 100644 index 0000000..c12931a --- /dev/null +++ b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ActionComponent.java @@ -0,0 +1,48 @@ +package com.att.ecomp.dcae.ci.ui.rule_editor.components.actions; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.att.ecomp.dcae.ci.ui.rule_editor.components.BaseComponenet; +import com.att.ecomp.dcae.ci.ui.utils.ByTest; +import com.att.ecomp.dcae.ci.ui.utils.Locator; +import com.att.ecomp.dcae.ci.utilities.Report; +import com.aventstack.extentreports.Status; + +public class ActionComponent extends BaseComponenet { + + public ActionComponent(WebDriverWait timeout, WebElement element) { + super(timeout, element); + } + + public void delete() { + Report.log(Status.INFO, "click on delete action"); + wait.until(Locator.from(root).findVisible(ByTest.id("deleteAction"), 0)).click(); + } + + public void setTarget(String target) { + Report.log(Status.INFO, "Filling input target..."); + getTargetElement().clear(); + getTargetElement().sendKeys(target); + } + + public void setTargetFromTree(){ + Report.log(Status.INFO, "Pick target from tree"); + wait.until(Locator.from(root).findVisible(ByTest.id("openTargetTree"), 0)).click(); + Report.log(Status.INFO, "Click on tree toggle"); + wait.until(Locator.from(root).findVisible(ByTest.cssSelector(".toggle-children-wrapper"),0)).click(); + Report.log(Status.INFO, "Click on first target node"); + wait.until(Locator.from(root).findVisible(ByTest.id("targetNode"), 1)).click(); + } + + public String getTarget() { + Report.log(Status.INFO, "get input target..."); + return getTargetElement().getAttribute("value"); + } + + /* Private Methods */ + + private WebElement getTargetElement() { + return wait.until(Locator.from(root).findVisible(ByTest.id("inputTarget"), 0)); + } +} diff --git a/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ActionType.java b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ActionType.java new file mode 100644 index 0000000..4cb4a28 --- /dev/null +++ b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ActionType.java @@ -0,0 +1,7 @@ +package com.att.ecomp.dcae.ci.ui.rule_editor.components.actions; + +public enum ActionType { + Copy, + Concat, + Map +} diff --git a/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ConcatActionComponent.java b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ConcatActionComponent.java new file mode 100644 index 0000000..435441e --- /dev/null +++ b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/ConcatActionComponent.java @@ -0,0 +1,31 @@ +package com.att.ecomp.dcae.ci.ui.rule_editor.components.actions; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.att.ecomp.dcae.ci.ui.rule_editor.components.actions.from.DeleteableFromComponent; +import com.att.ecomp.dcae.ci.ui.utils.ByTest; +import com.att.ecomp.dcae.ci.ui.utils.Locator; +import com.att.ecomp.dcae.ci.utilities.Report; +import com.aventstack.extentreports.Status; + + +public class ConcatActionComponent extends ActionComponent { + + public ConcatActionComponent(WebDriverWait timeout, WebElement element) { + super(timeout, element); + } + + public DeleteableFromComponent clickAddInput(int index) { + Report.log(Status.INFO, "Clicking on add input (another from)..."); + wait.until(Locator.from(root).findVisible(ByTest.id("btnAddInput"), 0)).click(); + return getFromComponent(index); + } + + public DeleteableFromComponent getFromComponent(int index) { + Report.log(Status.INFO, "Getting from component at index %d...", index); + WebElement fromElement = wait.until(Locator.from(root).findVisible(ByTest.id("fromComponent"), index)); + return new DeleteableFromComponent(wait, fromElement); + } + +} diff --git a/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/CopyActionComponent.java b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/CopyActionComponent.java new file mode 100644 index 0000000..3241ce6 --- /dev/null +++ b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/CopyActionComponent.java @@ -0,0 +1,24 @@ +package com.att.ecomp.dcae.ci.ui.rule_editor.components.actions; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.att.ecomp.dcae.ci.ui.rule_editor.components.actions.from.RegexFromComponent; +import com.att.ecomp.dcae.ci.ui.utils.ByTest; +import com.att.ecomp.dcae.ci.ui.utils.Locator; +import com.att.ecomp.dcae.ci.utilities.Report; +import com.aventstack.extentreports.Status; + +public class CopyActionComponent extends ActionComponent { + + public CopyActionComponent(WebDriverWait timeout, WebElement element) { + super(timeout, element); + } + + public RegexFromComponent getFromComponent() { + Report.log(Status.INFO, "Getting fromComponent..."); + WebElement fromElement = wait.until(Locator.from(root).findVisible(ByTest.id("fromComponent"), 0)); + return new RegexFromComponent(wait, fromElement); + } + +} diff --git a/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/MapActionComponent.java b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/MapActionComponent.java new file mode 100644 index 0000000..37efe17 --- /dev/null +++ b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/MapActionComponent.java @@ -0,0 +1,44 @@ +package com.att.ecomp.dcae.ci.ui.rule_editor.components.actions; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.att.ecomp.dcae.ci.ui.rule_editor.components.actions.from.RegexFromComponent; +import com.att.ecomp.dcae.ci.ui.rule_editor.components.actions.from.SimpleFromComponent; +import com.att.ecomp.dcae.ci.ui.utils.ByTest; +import com.att.ecomp.dcae.ci.ui.utils.Locator; +import com.att.ecomp.dcae.ci.utilities.Report; +import com.aventstack.extentreports.Status; + +public class MapActionComponent extends ActionComponent { + + public MapActionComponent(WebDriverWait timeout, WebElement element) { + super(timeout, element); + } + + public SimpleFromComponent getFromComponent() { + Report.log(Status.INFO, "getting simple from component"); + WebElement fromElement = wait.until(Locator.from(root).findVisible(ByTest.id("fromComponent"), 0)); + return new SimpleFromComponent(wait, fromElement); + } + + public void openDefaultOption(){ + Report.log(Status.INFO, "open default opention by click on checkbox"); + wait.until(Locator.from(root).find(ByTest.id("defaultCheckbox"), 0)).click(); + } + + public void setDefaultData(String value){ + Report.log(Status.INFO, "set default field with a value"); + wait.until(Locator.from(root).findVisible(ByTest.id("defaultInput"), 0)).sendKeys(value); + } + + public void setKeyData(String value){ + Report.log(Status.INFO, "set map key with a value"); + wait.until(Locator.from(root).findVisible(ByTest.id("key"), 0)).sendKeys(value); + } + + public void setValueData(String value){ + Report.log(Status.INFO, "set map value with a value"); + wait.until(Locator.from(root).findVisible(ByTest.id("value"), 0)).sendKeys(value); + } +} diff --git a/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/DeleteableFromComponent.java b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/DeleteableFromComponent.java new file mode 100644 index 0000000..4037419 --- /dev/null +++ b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/DeleteableFromComponent.java @@ -0,0 +1,26 @@ +package com.att.ecomp.dcae.ci.ui.rule_editor.components.actions.from; + +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.att.ecomp.dcae.ci.ui.utils.ByTest; +import com.att.ecomp.dcae.ci.ui.utils.Locator; +import com.att.ecomp.dcae.ci.utilities.Report; +import com.aventstack.extentreports.Status; + +public class DeleteableFromComponent extends SimpleFromComponent { + + public DeleteableFromComponent(WebDriverWait timeout, WebElement element) { + super(timeout, element); + } + + public void clickDelete(WebDriver driver) { + Report.log(Status.INFO, "Click on delete from..."); + Actions action = new Actions(driver); + action.moveToElement(root).perform(); + wait.until(Locator.from(root).findVisible(ByTest.id("btnDelete"), 0)).click(); + } + +} diff --git a/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/RegexFromComponent.java b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/RegexFromComponent.java new file mode 100644 index 0000000..159d0c9 --- /dev/null +++ b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/RegexFromComponent.java @@ -0,0 +1,38 @@ +package com.att.ecomp.dcae.ci.ui.rule_editor.components.actions.from; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.att.ecomp.dcae.ci.ui.utils.ByTest; +import com.att.ecomp.dcae.ci.ui.utils.Locator; +import com.att.ecomp.dcae.ci.utilities.Report; +import com.aventstack.extentreports.Status; + +public class RegexFromComponent extends SimpleFromComponent { + + public RegexFromComponent(WebDriverWait timeout, WebElement element) { + super(timeout, element); + } + + public void clickRegex() { + Report.log(Status.INFO, "Clicking regex button..."); + wait.until(Locator.from(root).findVisible(ByTest.id("btnFromRegex"), 0)).click(); + } + + public String getRegex() { + Report.log(Status.INFO, "Getting regex from..."); + return getRegexElement().getAttribute("value"); + } + + public void setRegex(String value) { + Report.log(Status.INFO, "Setting regex from..."); + getRegexElement().clear(); + getRegexElement().sendKeys(value); + } + + /* Private Methods */ + + private WebElement getRegexElement() { + return wait.until(Locator.from(root).findVisible(ByTest.id("inputFromRegex"), 0)); + } +} diff --git a/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/SimpleFromComponent.java b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/SimpleFromComponent.java new file mode 100644 index 0000000..a7cba3d --- /dev/null +++ b/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/actions/from/SimpleFromComponent.java @@ -0,0 +1,34 @@ +package com.att.ecomp.dcae.ci.ui.rule_editor.components.actions.from; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.att.ecomp.dcae.ci.ui.rule_editor.components.BaseComponenet; +import com.att.ecomp.dcae.ci.ui.utils.ByTest; +import com.att.ecomp.dcae.ci.ui.utils.Locator; +import com.att.ecomp.dcae.ci.utilities.Report; +import com.aventstack.extentreports.Status; + +public class SimpleFromComponent extends BaseComponenet { + + public SimpleFromComponent(WebDriverWait timeout, WebElement element) { + super(timeout, element); + } + + public String getValue() { + Report.log(Status.INFO, "Getting input from..."); + return getFromValueElement().getAttribute("value"); + } + + public void setValue(String value) { + Report.log(Status.INFO, "Setting input from..."); + getFromValueElement().clear(); + getFromValueElement().sendKeys(value); + } + + /* Private Methods */ + + private WebElement getFromValueElement() { + return wait.until(Locator.from(root).findVisible(ByTest.id("valueInput"), 0)); + } +} |