aboutsummaryrefslogtreecommitdiffstats
path: root/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
diff options
context:
space:
mode:
Diffstat (limited to 'ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java')
-rw-r--r--ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java245
1 files changed, 177 insertions, 68 deletions
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
index 04e3a8bb28..97128945a0 100644
--- a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
@@ -20,141 +20,250 @@
package org.openecomp.sdc.ci.tests.pages;
-import java.util.List;
-import java.util.function.Supplier;
-
+import com.aventstack.extentreports.Status;
import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
-import com.aventstack.extentreports.Status;
+import java.util.List;
+import java.util.function.Supplier;
public class GeneralPageElements {
public GeneralPageElements() {
- super();
+ super();
}
public static ResourceLeftMenu getLeftMenu() {
- return new ResourceLeftMenu();
+ return new ResourceLeftMenu();
}
-
+
public static void clickOKButton() {
SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the OK button");
GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
- GeneralUIUtils.waitForLoader();
- }
+ }
public static void clickCreateButton() {
SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button.");
GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
GeneralUIUtils.ultimateWait();
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
ExtentTestActions.log(Status.INFO, "Succeeded.");
}
-
+
public static void clickCreateButton(int timeout) {
SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button");
GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), timeout);
GeneralUIUtils.ultimateWait();
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
}
-
- public static void clickUpdateButton(){
- clickCreateButton();
- }
+
+ public static void clickCreateUpdateButton(int timeout) {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), timeout);
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickUpdateButton() {
+ clickCreateButton();
+ }
public static void clickCheckinButton(String componentName) throws Exception {
SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CHECKIN button");
+ GeneralUIUtils.ultimateWait();
GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys("Checkin " + componentName);
- GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
- GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), 60);
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEPT_TESTING_MESSAGE.getValue()).sendKeys("Checkin " + componentName);
+ clickOKButton();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
GeneralUIUtils.ultimateWait();
}
public static void clickSubmitForTestingButton(String componentName) throws Exception {
- SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the submiting for testing button");
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the submitting for testing button");
GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.SUBMIT_FOR_TESTING_BUTTON.getValue());
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.SUMBIT_FOR_TESTING_MESSAGE.getValue()).sendKeys("Submit for testing " + componentName);
GeneralUIUtils.ultimateWait();
- GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
- GeneralUIUtils.ultimateWait();
+ clickOKButton();
GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), 60);
- GeneralUIUtils.ultimateWait();;
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickSubmitForTestingButtonErrorCase(String componentName) throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the submitting for testing button");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.SUBMIT_FOR_TESTING_BUTTON.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.SUMBIT_FOR_TESTING_MESSAGE.getValue()).sendKeys("Submit for testing " + componentName);
+ GeneralUIUtils.ultimateWait();
+ clickOKButton();
+ clickOKButton();
}
-
- public static void clickCheckoutButton() throws Exception{
- SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on CHECKOUT button ...");
- GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKOUT_BUTTON.getValue());
- GeneralUIUtils.ultimateWait();
+
+ public static void restoreComponentFromArchivedCatalog(String componentName) throws Exception {
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue());
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CatalogSwitchButtons.CATALOG_SWITCH_BUTTON.getValue());
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CatalogSwitchButtons.CATALOG_ARCHIVE.getValue());
+ GeneralUIUtils.findComponentAndClick(componentName);
+ clickRestoreButton(componentName);
+ }
+
+ public static void restoreComponentFromElementPage(String componentName) throws Exception {
+ clickRestoreButton(componentName);
+ }
+
+ private static void clickRestoreButton(String componentName){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to restore component: %s", componentName));
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.RESTORE_BUTTON.getValue());
}
- public static void clickDeleteVersionButton() throws Exception {
- SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on DELETE VERSION button ...");
- GeneralUIUtils.ultimateWait();
- GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue());
- GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.OK.getValue());
- GeneralUIUtils.ultimateWait();
+ public static void clickArchivedButtonFromCatalog(String componentName) throws Exception {
+ CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+ GeneralUIUtils.findComponentAndClick(componentName);
+ clickArchiveButton(componentName);
}
- public static void clickRevertButton() throws Exception{
- SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on REVERT button ...");
- GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.REVERT_BUTTON.getValue());
+ public static void archiveComponentFromElementPage(String componentName) throws Exception {
+ clickArchiveButton(componentName);
+ }
+
+ private static void clickArchiveButton(String componentName){
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to archive component: %s", componentName));
+ GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.GeneralElementsEnum.ARCHIVE_BUTTON.getValue());
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.ARCHIVE_BUTTON.getValue());
+ SetupCDTest.getExtendTest().log(Status.INFO, String.format("Component %s archived successfully", componentName));
+ }
+
+ //TODO should implement real code
+ public static void clickCertifyButton(String componentName) throws Exception {
+ try {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on certify button");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.LifeCyleChangeButtons.CERTIFY.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue())
+ .sendKeys("resource " + componentName + " certified successfully");
+ clickOKButton();
+ clickUpgradeServicesCloseButton();
+ GeneralUIUtils.ultimateWait();
+ HomePage.navigateToHomePage();
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), GeneralUIUtils.getTimeOut()/10);
+ } catch (Exception e) {
+ throw new Exception("Certification of " + componentName + " failed");
+ }
+ }
+
+ public static void clickCertifyButtonNoUpgradePopupDismiss(String componentName) throws Exception {
+ try {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on certify button");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.LifeCyleChangeButtons.CERTIFY.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue())
+ .sendKeys("resource " + componentName + " certified successfully");
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ } catch (Exception e) {
+ throw new Exception("Certification of " + componentName + " failed");
+ }
+ }
+
+ public static void clickCertifyButtonNoUpgradePopupDismissErrorCase(String componentName) throws Exception {
+ try {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on certify button");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.LifeCyleChangeButtons.CERTIFY.getValue());
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue())
+ .sendKeys("resource " + componentName + " certified successfully");
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+ clickOKButton();
+ } catch (Exception e) {
+ throw new Exception("Certification of " + componentName + " failed");
+ }
+ }
+
+ public static void clickUpgradeServicesCloseButton(){
+ WebElement closeButton = null;
+ try {
+ closeButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.UPGRADE_SERVICES_CANCEL.getValue(), GeneralUIUtils.getTimeOut()/10);
+ UpgradeServicesPopup.setUpgradePopupShown(true);
+ SetupCDTest.getExtendTest().log(Status.INFO, "Closing Update Services popup with X button ...");
+ closeButton.click();
+ }catch (WebDriverException e){
+ // regular flow
+ UpgradeServicesPopup.setUpgradePopupShown(false);
+ SetupCDTest.getExtendTest().log(Status.INFO, "Update Services popup is not shown, continuing ...");
+ }
+ }
+
+ public static void clickCheckoutButton() throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on CHECKOUT button ...");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKOUT_BUTTON.getValue());
+ GeneralUIUtils.ultimateWait();
+ }
+
+
+
+
+ public static void clickDeleteVersionButton() throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on DELETE VERSION button ...");
+ GeneralUIUtils.ultimateWait();
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue());
+ GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.OK.getValue());
+ }
+
+ public static void clickRevertButton() throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on REVERT button ...");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.REVERT_BUTTON.getValue());
}
public static String getLifeCycleState() {
return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()).getText();
}
+ public static String getWebElementTextByTestId(String dataTestIdEnumValue) {
+ return GeneralUIUtils.getWebElementByTestID(dataTestIdEnumValue).getText();
+ }
+
public static void selectVersion(String version) {
GeneralUIUtils.getSelectList(version, DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue());
GeneralUIUtils.ultimateWait();
}
public static List<WebElement> getElemenetsFromTable() {
- GeneralUIUtils.ultimateWait();;
- return GeneralUIUtils.getElemenetsFromTable(By.className("flex-container"));
+ GeneralUIUtils.ultimateWait();
+ return GeneralUIUtils.getElemenetsFromTable(By.className("flex-container"));
}
public static boolean checkElementsCountInTable(int expectedElementsCount) {
return checkElementsCountInTable(expectedElementsCount, () -> getElemenetsFromTable());
}
-
-
- public static void clickTrashButtonAndConfirm() throws InterruptedException{
- SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on TRASH button ...");
- GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue());
- clickOKButton();
- }
-
+
+
+ public static void clickTrashButtonAndConfirm() throws InterruptedException {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on TRASH button ...");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue());
+ clickOKButton();
+ }
+
+ public static void clickBrowseButton() throws InterruptedException{
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on Browse button ...");
+ GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue());
+ }
+
public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) {
- SetupCDTest.getExtendTest().log(Status.INFO, "Checking the number of elements in the table; should be " + (expectedElementsCount - 1));
-// int maxWaitingPeriodMS = 10*1000;
-// int napPeriodMS = 200;
-// int sumOfWaiting = 0;
-// List<WebElement> elements = null;
-// boolean isKeepWaiting = false;
-// while (!isKeepWaiting) {
-// GeneralUIUtils.sleep(napPeriodMS);
-// sumOfWaiting += napPeriodMS;
-// elements = func.get();
-// isKeepWaiting = (expectedElementsCount == elements.size());
-// if (sumOfWaiting > maxWaitingPeriodMS)
-// return false;
-// }
- GeneralUIUtils.ultimateWait();
+ SetupCDTest.getExtendTest().log(Status.INFO, "Checking the number of elements in the table; should be " + (expectedElementsCount - 1));
+ GeneralUIUtils.ultimateWait();
return true;
}
-
- public static void clickDeleteFile() throws Exception{
- SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on delete file X-button ...");
- GeneralUIUtils.clickOnAreaJS(GeneralUIUtils.getWebElementBy
- (By.cssSelector("div[class='i-sdc-form-file-upload-x-btn']")));
- GeneralUIUtils.ultimateWait();;
- }
+
+ public static void clickDeleteFile() throws Exception {
+ SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on delete file X-button ...");
+ GeneralUIUtils.clickOnAreaJS(GeneralUIUtils.getWebElementBy
+ (By.cssSelector("div[class='i-sdc-form-file-upload-x-btn']")));
+ GeneralUIUtils.ultimateWait();
+ }
+
+ public static void clickOnHomeButton() {
+ GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+ }
}