diff --git a/esp/src/test-ui/tests/framework/pages/ActivitiesTest.java b/esp/src/test-ui/tests/framework/pages/ActivitiesTest.java index db21a3ac064..03ad0820cc3 100644 --- a/esp/src/test-ui/tests/framework/pages/ActivitiesTest.java +++ b/esp/src/test-ui/tests/framework/pages/ActivitiesTest.java @@ -39,26 +39,26 @@ public void testActivitiesPage() { private void testForNavigationLinks(List navWebElements) { Common.logDebug("Tests started for: Activities page: Testing Navigation Links"); - + for (NavigationWebElement element : navWebElements) { - StringBuilder erorMmsg = new StringBuilder("OK"); + StringBuilder errorMsg = new StringBuilder("OK"); try { element.webElement().click(); - if (testTabsForNavigationLinks(element, erorMmsg)) { + if (testTabsForNavigationLinks(element, errorMsg)) { String msg = "Success: Navigation Menu Link for " + element.name() + ". URL : " + element.hrefValue(); Common.logDetail(msg); - if ( erorMmsg.length() > 0 ){ + if ( errorMsg.length() > 0 ){ String currentPage = getCurrentPage(); - String warningMsg = " Warning: on '" + currentPage + "' page there is missing/not matching element(s):" + erorMmsg; + String warningMsg = " Warning: on '" + currentPage + "' page there is missing/not matching element(s):" + errorMsg; Common.logDetail(warningMsg); } } else { // Needs to report why it is failed String currentPage = getCurrentPage(); - String errorMsg = "Failure: Navigation Menu Link for " + element.name() + " page failed. The current navigation page that we landed on is " + currentPage + ". Current URL : " + element.hrefValue() + ". Missing element(s): " + erorMmsg; + String errorMsg = "Failure: Navigation Menu Link for " + element.name() + " page failed. The current navigation page that we landed on is " + currentPage + ". Current URL : " + element.hrefValue() + ". Missing element(s): " + errorMsg; Common.logError(errorMsg); // Needs to log the error into the logDetails as well. } @@ -94,7 +94,11 @@ private boolean testTabsForNavigationLinks(NavigationWebElement element, StringB boolean retVal = true; List tabsList = URLConfig.tabsListMap.get(element.name()); - int numOfElemets = tabsList.size(); + int numOfElements = tabsList.size(); + if ( numOfElements == 0 ) { + return retVal; + } + double elementFound = 0.0; // It is double for calculating ratio later. for (String tab : tabsList) { @@ -107,10 +111,10 @@ private boolean testTabsForNavigationLinks(NavigationWebElement element, StringB } } - if ( (elementFound / numOfElemets) < 0.5 ) { + if ( (elementFound / numOfElements) < 0.5 ) { retVal = false; } - Common.logDebug("In testTabsForNavigationLinks(element = '" + element.name() + "') -> numOfElemets:" + numOfElemets + ", elementFound:" + elementFound + ", ratio: " + (elementFound / numOfElemets) + ", retVal:" + retVal + "." ); + Common.logDebug("In testTabsForNavigationLinks(element = '" + element.name() + "') -> numOfElements:" + numOfElements + ", elementFound:" + elementFound + ", ratio: " + (elementFound / numOfElements) + ", retVal:" + retVal + "." ); return retVal; }