aboutsummaryrefslogtreecommitdiffstats
path: root/integration-tests/src/test/java/org
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2022-01-23 12:40:06 +0000
committerMichael Morris <michael.morris@est.tech>2022-03-02 11:44:48 +0000
commitc4a8271d664deb39e69fbba329b11ff57b9b276b (patch)
tree3f070217dd738d0d0ab4231ff1bd06b903e7cb19 /integration-tests/src/test/java/org
parent7f07f514eacacfb54d851201c49b24acd9b5e343 (diff)
Support for multiple directives
Issue-ID: SDC-3861 Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech> Change-Id: Ie63c4879c28567b2d87e5fb08975b46014cf3660
Diffstat (limited to 'integration-tests/src/test/java/org')
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java2
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateDirectiveNodeFilterFlow.java12
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDirectiveNodeFilterTab.java48
3 files changed, 40 insertions, 22 deletions
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
index a2dbd5729e..46c0aefe18 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ServiceTemplateDesignUiTests.java
@@ -299,7 +299,7 @@ public class ServiceTemplateDesignUiTests extends SetupCDTest {
compositionPage.selectNode(vfcNameInComposition);
final CreateDirectiveNodeFilterFlow createDirectiveNodeFilterFlow =
- new CreateDirectiveNodeFilterFlow(webDriver, 2, DirectiveType.SELECT, serviceDependencyProperty);
+ new CreateDirectiveNodeFilterFlow(webDriver, 2, serviceDependencyProperty);
createDirectiveNodeFilterFlow.run(componentPage);
verifyAvailableDirectiveTypes(createDirectiveNodeFilterFlow.getDirectiveOptions());
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateDirectiveNodeFilterFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateDirectiveNodeFilterFlow.java
index b55eab7a57..8443cc4a85 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateDirectiveNodeFilterFlow.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/CreateDirectiveNodeFilterFlow.java
@@ -24,7 +24,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import java.util.Optional;
-import org.onap.sdc.frontend.ci.tests.datatypes.DirectiveType;
import org.onap.sdc.frontend.ci.tests.datatypes.ServiceDependencyProperty;
import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions;
import org.onap.sdc.frontend.ci.tests.pages.PageObject;
@@ -47,15 +46,12 @@ public class CreateDirectiveNodeFilterFlow extends AbstractUiTestFlow {
private List<String> propertyOptions;
private final int buttonIndex;
- private final DirectiveType directiveType;
private final ServiceDependencyProperty serviceDependencyProperty;
private CompositionPage compositionPage;
- public CreateDirectiveNodeFilterFlow(final WebDriver webDriver, final int buttonIndex, final DirectiveType directiveType
- , final ServiceDependencyProperty serviceDependencyProperty) {
+ public CreateDirectiveNodeFilterFlow(final WebDriver webDriver, final int buttonIndex, final ServiceDependencyProperty serviceDependencyProperty) {
super(webDriver);
this.buttonIndex = buttonIndex;
- this.directiveType = directiveType;
this.serviceDependencyProperty = serviceDependencyProperty;
}
@@ -72,9 +68,9 @@ public class CreateDirectiveNodeFilterFlow extends AbstractUiTestFlow {
sideBar.selectTab(CompositionDetailTabName.DIRECTIVE_NODE_FILTER);
compositionDirectiveNodeFilterTab.isLoaded();
directiveOptions = compositionDirectiveNodeFilterTab.getDirectiveSelectOptions();
- if (!compositionDirectiveNodeFilterTab.isDirectiveSelected(directiveType)) {
- compositionDirectiveNodeFilterTab.selectDirective(directiveType);
- }
+ compositionDirectiveNodeFilterTab.selectDirective();
+ compositionDirectiveNodeFilterTab.updateDirectives();
+ ExtentTestActions.takeScreenshot(Status.INFO, "select multiple directives", String.format("multiple directives added"));
final ServiceDependenciesEditor compositionDependenciesEditor = compositionDirectiveNodeFilterTab.clickAddNodeFilter(buttonIndex);
compositionDependenciesEditor.isLoaded();
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDirectiveNodeFilterTab.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDirectiveNodeFilterTab.java
index 92f8056e3b..919629e29e 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDirectiveNodeFilterTab.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/component/workspace/CompositionDirectiveNodeFilterTab.java
@@ -19,8 +19,8 @@
package org.onap.sdc.frontend.ci.tests.pages.component.workspace;
+import java.util.ArrayList;
import java.util.List;
-import java.util.stream.Collectors;
import org.onap.sdc.frontend.ci.tests.datatypes.DirectiveType;
import org.onap.sdc.frontend.ci.tests.pages.AbstractPageObject;
@@ -47,13 +47,23 @@ public class CompositionDirectiveNodeFilterTab extends AbstractPageObject {
}
/**
- * Select option from the directive select web element
+ * Select option from the directive ng-select web element
*
- * @param type which directive type to select from options
*/
- public void selectDirective(final DirectiveType type) {
- final Select directiveSelect = getDirectiveSelect();
- directiveSelect.selectByVisibleText(type.getName());
+ public void selectDirective() {
+ waitToBeClickable(By.xpath(XpathSelector.NODE_FILTER_DIRECTIVE_DROPDOWN.getXPath())).click();
+ waitToBeClickable(By.xpath(XpathSelector.NODE_FILTER_DIRECTIVE_OPTIONS_SELECTABLE.getXPath())).click();
+ saveDirectivesSelected();
+ }
+ /**
+ * Select multiple options from the directive ng-select web element
+ *
+ */
+ public void updateDirectives() {
+ waitToBeClickable(By.xpath(XpathSelector.NODE_FILTER_DIRECTIVE_EDIT_BTN.getXPath())).click();
+ waitToBeClickable(By.xpath(XpathSelector.NODE_FILTER_DIRECTIVE_DROPDOWN.getXPath())).click();
+ waitToBeClickable(By.xpath(XpathSelector.NODE_FILTER_DIRECTIVE_OPTIONS_SUBSTITUTABLE.getXPath())).click();
+ saveDirectivesSelected();
}
/**
@@ -63,6 +73,7 @@ public class CompositionDirectiveNodeFilterTab extends AbstractPageObject {
* @return a new ServiceDependenciesEditor component instance
*/
public ServiceDependenciesEditor clickAddNodeFilter(final int index) {
+ waitForElementInvisibility(By.xpath(XpathSelector.LOADER_HELPER.getXPath()));
waitForElementVisibility(By.xpath(XpathSelector.ADD_RULE_BUTTON.formatXPath(index))).click();
return new ServiceDependenciesEditor(webDriver);
}
@@ -82,16 +93,17 @@ public class CompositionDirectiveNodeFilterTab extends AbstractPageObject {
}
/**
- * Return all available directive types from the directive select web element
+ * Return all available directive types from the directive ng-select web element
*
- * @return list of strings in lower case based on visible text of the select's web element options.
+ * @return list of strings in lower case based on visible text of the ng-select's web element options.
* The List values should correspond to {@link DirectiveType}
*/
public List<String> getDirectiveSelectOptions() {
- final Select directiveSelect = getDirectiveSelect();
- final List<String> directiveOptions = directiveSelect.getOptions().stream()
- .map(option -> option.getText().toLowerCase()).collect(Collectors.toList());
- directiveOptions.remove("select directive");
+ final List<String> directiveOptions = new ArrayList<>();
+ directiveOptions.add(DirectiveType.SELECT.getName());
+ directiveOptions.add(DirectiveType.SELECTABLE.getName());
+ directiveOptions.add(DirectiveType.SUBSTITUTE.getName());
+ directiveOptions.add(DirectiveType.SUBSTITUTABLE.getName());
return directiveOptions;
}
@@ -115,14 +127,24 @@ public class CompositionDirectiveNodeFilterTab extends AbstractPageObject {
return new Select(findElement(By.xpath(XpathSelector.NODE_FILTER_DIRECTIVE_SELECT.xPath)));
}
+ private void saveDirectivesSelected() {
+ waitToBeClickable(By.xpath(XpathSelector.NODE_FILTER_DIRECTIVE_APPLY_BTN.formatXPath("Apply"))).click();
+ }
+
@AllArgsConstructor
@Getter
private enum XpathSelector {
NODE_FILTER_TAB("//service-dependencies-tab"),
+ NODE_FILTER_DIRECTIVE_DROPDOWN("//div[@class='select-directives']//div[@class='ng-input']"),
NODE_FILTER_DIRECTIVE_SELECT("//select[@id='singleSelect']"),
NODE_FILTER_DIRECTIVE_SELECTED("//label[contains(text(),': %s')]"),
+ NODE_FILTER_DIRECTIVE_OPTIONS_SELECTABLE("//div[@class='select-directives']//*[contains(text(), 'selectable')]"),
+ NODE_FILTER_DIRECTIVE_APPLY_BTN("//*[@id=\"multi-select-apply\"]"),
+ NODE_FILTER_DIRECTIVE_EDIT_BTN("//*[@data-tests-id='directive-edit-icon']"),
+ NODE_FILTER_DIRECTIVE_OPTIONS_SUBSTITUTABLE("//div[@class='select-directives']//*[contains(text(), 'substitutable')]"),
ADD_RULE_BUTTON("(//*[@data-tests-id='add-rule-button'])[%d]"),
- RULE_DESC("//*[contains(text(),'%s')]");
+ RULE_DESC("//*[contains(text(),'%s')]"),
+ LOADER_HELPER("//div[@class='tlv-loader-back tlv-loader-relative']");
private final String xPath;