aboutsummaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java
diff options
context:
space:
mode:
Diffstat (limited to 'integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java100
1 files changed, 61 insertions, 39 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java
index c8af405411..5a2cb2f5d5 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/InterfaceDefinitionOperationsModal.java
@@ -21,10 +21,12 @@ package org.onap.sdc.frontend.ci.tests.pages.component.workspace;
import com.aventstack.extentreports.Status;
import java.time.Duration;
+import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
+import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionOperationsModal.InterfaceOperationsData.InputData;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@@ -35,23 +37,33 @@ import org.openqa.selenium.interactions.Actions;
*/
public class InterfaceDefinitionOperationsModal extends AbstractPageObject {
+ private InterfaceOperationInputListComponent inputListComponent;
+ private InterfaceOperationAddInputComponent addInputComponent;
+
public InterfaceDefinitionOperationsModal(final WebDriver webDriver) {
super(webDriver);
}
@Override
public void isLoaded() {
+ isLoaded(false);
+ }
+
+ public void isLoaded(boolean isInViewMode) {
waitForElementVisibility(By.xpath(XpathSelector.TITLE_SPAN.getXPath()));
waitForElementVisibility(By.xpath(XpathSelector.INTERFACE_NAME_LABEL.getXPath()));
waitForElementVisibility(By.xpath(XpathSelector.OPERATION_NAME_LABEL.getXPath()));
- waitForElementVisibility(By.xpath(XpathSelector.INPUT_NAME_SPAN.getXPath()));
- waitForElementVisibility(By.xpath(XpathSelector.INPUT_VALUE_SPAN.getXPath()));
- waitForElementVisibility(By.xpath(XpathSelector.ADD_INPUT_BTN.getXPath()));
waitForElementVisibility(By.xpath(XpathSelector.SAVE_BTN.getXPath()));
waitToBeClickable(By.xpath(XpathSelector.CANCEL_BTN.getXPath()));
+ this.inputListComponent = new InterfaceOperationInputListComponent(webDriver);
+ this.inputListComponent.isLoaded();
+ if (!isInViewMode) {
+ this.addInputComponent = new InterfaceOperationAddInputComponent(webDriver);
+ this.addInputComponent.isLoaded();
+ }
}
- public void clickOnSave() {
+ private void clickOnSave() {
waitToBeClickable(By.xpath(XpathSelector.SAVE_BTN.getXPath())).click();
}
@@ -63,11 +75,26 @@ public class InterfaceDefinitionOperationsModal extends AbstractPageObject {
waitToBeClickable(By.xpath(XpathSelector.DELETE_BTN.getXPath())).click();
}
+ public void deleteInput(String inputName) {
+ inputListComponent.loadInputList();
+ inputListComponent.deleteInput(inputName);
+ }
+
public void updateInterfaceOperation(final InterfaceOperationsData interfaceOperationsData) {
fillDescription(interfaceOperationsData.getDescription());
fillImplementationName(interfaceOperationsData.getImplementationName());
- fillInputName(interfaceOperationsData.getInputName());
- fillInputValue(interfaceOperationsData.getInputValue());
+ interfaceOperationsData.getInputList().forEach(inputData -> {
+ final InterfaceOperationAddInputComponent addInputComponent = new InterfaceOperationAddInputComponent(webDriver);
+ addInputComponent.isLoaded();
+ addInputComponent.clickOnAddInputLink();
+ addInputComponent.fillInput(inputData);
+ addInputComponent.clickOnAddButton();
+ ExtentTestActions.takeScreenshot(Status.INFO,
+ "compositionInterfaceOperationsModal.addInput." + inputData.getName(),
+ String.format("Input '%s' added", inputData.getName())
+ );
+ addInputComponent.fillValue(inputData);
+ });
clickOnSave();
//there is no feedback from the UI to check if the update was successful. Forcing a wait time trying to guarantee that,
// although time is never a guarantee in this case.
@@ -82,14 +109,6 @@ public class InterfaceDefinitionOperationsModal extends AbstractPageObject {
setInputField(By.xpath(XpathSelector.INTERFACE_OPERATION_IMPLEMENTATION_NAME_INPUT.getXPath()), implementationName);
}
- private void fillInputName(final String inputName) {
- setInputField(By.xpath(XpathSelector.FIELD_INPUT_NAME_INPUT.getXPath()), inputName);
- }
-
- private void fillInputValue(final String inputValue) {
- setInputField(By.xpath(XpathSelector.FIELD_INPUT_VALUE_INPUT.getXPath()), inputValue);
- }
-
private void setInputField(final By locator, final String value) {
if (value == null) {
return;
@@ -97,11 +116,12 @@ public class InterfaceDefinitionOperationsModal extends AbstractPageObject {
final WebElement webElement = findElement(locator);
webElement.clear();
webElement.sendKeys(value);
+
ExtentTestActions.takeScreenshot(Status.INFO, value, value);
}
- public void addInput() {
- waitToBeClickable(By.xpath(XpathSelector.ADD_INPUT_BTN.getXPath())).click();
+ public void clickOnAddInput() {
+ addInputComponent.clickOnAddInputLink();
}
public String getDescription() {
@@ -112,42 +132,44 @@ public class InterfaceDefinitionOperationsModal extends AbstractPageObject {
return findElement(By.xpath(XpathSelector.INTERFACE_OPERATION_IMPLEMENTATION_NAME_INPUT.getXPath())).getAttribute("value");
}
- public String getInputName() {
- return findElement(By.xpath(XpathSelector.FIELD_INPUT_NAME_INPUT.getXPath())).getAttribute("value");
- }
-
- public String getInputValue() {
- return findElement(By.xpath(XpathSelector.FIELD_INPUT_VALUE_INPUT.getXPath())).getAttribute("value");
- }
-
- @Getter
- @AllArgsConstructor
- public static class InterfaceOperationsData {
-
- private final String description;
- private final String implementationName;
- private final String inputName;
- private final String inputValue;
+ public List<InputData> getInputs() {
+ inputListComponent.loadInputList();
+ return inputListComponent.getInputList();
}
@AllArgsConstructor
private enum XpathSelector {
TITLE_SPAN("//span[@class='title' and contains(text(), 'Edit Operation')]"),
- ADD_INPUT_BTN("//a[contains(@class,'add-param-link add-btn') and contains(text(), 'Add Input')]"),
DELETE_BTN("//svg-icon[@name='trash-o']"),
SAVE_BTN("//button[@data-tests-id='Save']"),
CANCEL_BTN("//button[@data-tests-id='Cancel']"),
INTERFACE_NAME_LABEL("//label[contains(@class,'sdc-input') and contains(text(), 'Interface Name')]"),
OPERATION_NAME_LABEL("//label[contains(@class,'sdc-input') and contains(text(), 'Operation Name')]"),
INTERFACE_OPERATION_DESCRIPTION_INPUT("//input[@data-tests-id='interface-operation-description']"),
- INTERFACE_OPERATION_IMPLEMENTATION_NAME_INPUT("//input[@data-tests-id='interface-operation-implementation-name']"),
- INPUT_NAME_SPAN("//span[contains(@class,'field-input-name') and contains(text(), 'Name')]"),
- INPUT_VALUE_SPAN("//span[contains(@class,'field-input-value') and contains(text(), 'Value')]"),
- FIELD_INPUT_NAME_INPUT("//input[@data-tests-id='interface-operation-input-name']"),
- FIELD_INPUT_VALUE_INPUT("//input[@data-tests-id='interface-operation-input-value']");
+ INTERFACE_OPERATION_IMPLEMENTATION_NAME_INPUT("//input[@data-tests-id='interface-operation-implementation-name']");
- @Getter
private final String xPath;
+ public String getXPath(final String... xpathParams) {
+ return String.format(xPath, xpathParams);
+ }
+ }
+
+ @Getter
+ @AllArgsConstructor
+ public static class InterfaceOperationsData {
+
+ private final String description;
+ private final String implementationName;
+ private final List<InputData> inputList;
+
+ @Getter
+ @AllArgsConstructor
+ public static class InputData {
+
+ private final String name;
+ private final String type;
+ private final Object value;
+ }
}
}