From fbab79aeaccf74385c9a55b697a1055a86bdf171 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Tue, 21 Jun 2022 15:06:12 +0100 Subject: Block interface operation edit in checkedin VFC VFC interface operation could be edited even when checked in, due to an incorrect viewOnly input passed to the modal component. Blocks edition also in the backend, by verifying if the component can be edited. Change-Id: I816e28897273aaa677237ca55794bb3dc8460975 Issue-ID: SDC-4058 Signed-off-by: andre.schmid Signed-off-by: JvD_Ericsson --- .../ci/tests/execute/sanity/ImportVfcUiTest.java | 16 +++---- .../flow/GoToInterfaceDefinitionPageFlow.java | 56 ++++++++++++++++++++++ .../ci/tests/flow/InterfaceDefinitionFlow.java | 56 ---------------------- .../InterfaceDefinitionOperationsModal.java | 10 ++-- 4 files changed, 69 insertions(+), 69 deletions(-) create mode 100644 integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/GoToInterfaceDefinitionPageFlow.java delete mode 100644 integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/InterfaceDefinitionFlow.java (limited to 'integration-tests/src/test/java/org') diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java index e1705a2255..ba4b6d77fe 100644 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/ImportVfcUiTest.java @@ -48,7 +48,7 @@ import org.onap.sdc.frontend.ci.tests.flow.AddNodeToCompositionFlow; import org.onap.sdc.frontend.ci.tests.flow.CreateVfFlow; import org.onap.sdc.frontend.ci.tests.flow.CreateVfcFlow; import org.onap.sdc.frontend.ci.tests.flow.DownloadCsarArtifactFlow; -import org.onap.sdc.frontend.ci.tests.flow.InterfaceDefinitionFlow; +import org.onap.sdc.frontend.ci.tests.flow.GoToInterfaceDefinitionPageFlow; import org.onap.sdc.frontend.ci.tests.flow.exception.UiTestFlowRuntimeException; import org.onap.sdc.frontend.ci.tests.pages.AttributeModal; import org.onap.sdc.frontend.ci.tests.pages.AttributesPage; @@ -144,14 +144,14 @@ public class ImportVfcUiTest extends SetupCDTest { } private ComponentPage viewInterfaceDefinitionFromVFC(final ComponentPage componentPage) { - final InterfaceDefinitionFlow interfaceDefinitionFlow = new InterfaceDefinitionFlow(webDriver); - interfaceDefinitionFlow.run(componentPage); - final InterfaceDefinitionPage interfaceDefinitionPage = interfaceDefinitionFlow.getLandedPage() + final GoToInterfaceDefinitionPageFlow goToInterfaceDefinitionPageFlow = new GoToInterfaceDefinitionPageFlow(webDriver); + goToInterfaceDefinitionPageFlow.run(componentPage); + final InterfaceDefinitionPage interfaceDefinitionPage = goToInterfaceDefinitionPageFlow.getLandedPage() .orElseThrow(() -> new UiTestFlowRuntimeException("Missing expected return InterfaceDefinitionPage")); - final var OPERATION_NAME = "create"; - assertTrue(interfaceDefinitionPage.isInterfaceDefinitionOperationPresent(OPERATION_NAME)); - final InterfaceDefinitionOperationsModal interfaceDefinitionOperationsModal = interfaceDefinitionPage.clickOnInterfaceDefinitionOperation( - OPERATION_NAME); + final var operationName = "create"; + assertTrue(interfaceDefinitionPage.isInterfaceDefinitionOperationPresent(operationName)); + final InterfaceDefinitionOperationsModal interfaceDefinitionOperationsModal = + interfaceDefinitionPage.clickOnInterfaceDefinitionOperation(operationName); interfaceDefinitionOperationsModal.isLoaded(true); ExtentTestActions .takeScreenshot(Status.INFO, "clickOnOInterfaceOperation", "Interface Definition Operation Modal opened"); diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/GoToInterfaceDefinitionPageFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/GoToInterfaceDefinitionPageFlow.java new file mode 100644 index 0000000000..72ae269b4e --- /dev/null +++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/GoToInterfaceDefinitionPageFlow.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.sdc.frontend.ci.tests.flow; + +import com.aventstack.extentreports.Status; +import java.util.Optional; +import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions; +import org.onap.sdc.frontend.ci.tests.pages.ComponentPage; +import org.onap.sdc.frontend.ci.tests.pages.PageObject; +import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionPage; +import org.openqa.selenium.WebDriver; + +/** + * UI Flow to go to the interfaces page of a VFC from the VFC Workspace + */ +public class GoToInterfaceDefinitionPageFlow extends AbstractUiTestFlow { + + private InterfaceDefinitionPage interfaceDefinitionPage; + + public GoToInterfaceDefinitionPageFlow(final WebDriver webDriver) { + super(webDriver); + } + + @Override + public Optional run(final PageObject... pageObjects) { + extendTest.log(Status.INFO, "Going to access the Interfaces page from the resource Workspace"); + final ComponentPage componentPage = findParameter(pageObjects, ComponentPage.class); + componentPage.isLoaded(); + interfaceDefinitionPage = componentPage.goToInterfaceDefinition(); + interfaceDefinitionPage.isLoaded(); + ExtentTestActions.takeScreenshot(Status.INFO, "interface-definition-page", "Interface Definition page loaded"); + return Optional.of(interfaceDefinitionPage); + } + + @Override + public Optional getLandedPage() { + return Optional.ofNullable(interfaceDefinitionPage); + } +} diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/InterfaceDefinitionFlow.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/InterfaceDefinitionFlow.java deleted file mode 100644 index a0955ff800..0000000000 --- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/flow/InterfaceDefinitionFlow.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.sdc.frontend.ci.tests.flow; - -import com.aventstack.extentreports.Status; -import java.util.Optional; -import org.onap.sdc.frontend.ci.tests.execute.setup.ExtentTestActions; -import org.onap.sdc.frontend.ci.tests.pages.ComponentPage; -import org.onap.sdc.frontend.ci.tests.pages.PageObject; -import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinitionPage; -import org.openqa.selenium.WebDriver; - -/** - * UI Flow for managing an Interface Definition from a component - */ -public class InterfaceDefinitionFlow extends AbstractUiTestFlow { - - private InterfaceDefinitionPage interfaceDefinitionPage; - - public InterfaceDefinitionFlow(final WebDriver webDriver) { - super(webDriver); - } - - @Override - public Optional run(final PageObject... pageObjects) { - extendTest.log(Status.INFO, "Downloading Tosca CSAR generated"); - final ComponentPage componentPage = findParameter(pageObjects, ComponentPage.class); - componentPage.isLoaded(); - interfaceDefinitionPage = componentPage.goToInterfaceDefinition(); - interfaceDefinitionPage.isLoaded(); - ExtentTestActions.takeScreenshot(Status.INFO, "interface-definition-page", "Interface Definition page loaded"); - return Optional.of(interfaceDefinitionPage); - } - - @Override - public Optional getLandedPage() { - return Optional.ofNullable(interfaceDefinitionPage); - } -} 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 78828d7bbe..160c314665 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 @@ -19,8 +19,9 @@ package org.onap.sdc.frontend.ci.tests.pages.component.workspace; +import static org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils.waitForLoader; + import com.aventstack.extentreports.Status; -import java.time.Duration; import java.util.List; import lombok.AllArgsConstructor; import lombok.Getter; @@ -30,9 +31,6 @@ import org.onap.sdc.frontend.ci.tests.pages.component.workspace.InterfaceDefinit import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; - -import static org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils.waitForLoader; /** * Represents the Composition Interface Operations Modal. @@ -55,7 +53,9 @@ public class InterfaceDefinitionOperationsModal extends AbstractPageObject { 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.SAVE_BTN.getXPath())); + if (!isInViewMode) { + waitForElementVisibility(By.xpath(XpathSelector.SAVE_BTN.getXPath())); + } waitToBeClickable(By.xpath(XpathSelector.CANCEL_BTN.getXPath())); this.inputListComponent = new InterfaceOperationInputListComponent(webDriver); this.inputListComponent.isLoaded(); -- cgit 1.2.3-korg