Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-33041 ECL Watch UI test (GH Action) reports an error with 'Files' page. #19341

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions esp/src/test-ui/tests/framework/pages/ActivitiesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,25 @@ private void testForNavigationLinks(List<NavigationWebElement> navWebElements) {

for (NavigationWebElement element : navWebElements) {

StringBuilder errorMsg = new StringBuilder("OK");

try {
element.webElement().click();

if (testTabsForNavigationLinks(element)) {
if (testTabsForNavigationLinks(element, errorMsg)) {
String msg = "Success: Navigation Menu Link for " + element.name() + ". URL : " + element.hrefValue();
Common.logDetail(msg);
if ( errorMsg.length() > 0 ){
String currentPage = getCurrentPage();
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();
Common.logError(errorMsg);
String failureMsg = "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(failureMsg);
// Needs to log the error into the logDetails as well.
}
} catch (Exception ex) {
Common.logException("Failure: Exception in Navigation Link for " + element.name() + ". URL : " + element.hrefValue() + " Error: " + ex.getMessage(), ex);
Expand Down Expand Up @@ -80,19 +89,33 @@ private String getCurrentPage() {
return "Invalid Page";
}

private boolean testTabsForNavigationLinks(NavigationWebElement element) {
private boolean testTabsForNavigationLinks(NavigationWebElement element, StringBuilder msg) {
msg.delete(0, msg.length());
boolean retVal = true;

List<String> tabsList = URLConfig.tabsListMap.get(element.name());
int numOfElements = tabsList.size();
if ( numOfElements == 0 ) {
return retVal;
}

double elementFound = 0.0; // It is double for calculating ratio later.

for (String tab : tabsList) {
try {
WebElement webElement = Common.waitForElement(By.xpath("//a[text()='" + tab + "']"));
urlMap.get(element.name()).getUrlMappings().put(tab, new URLMapping(tab, webElement.getAttribute("href")));
elementFound += 1.0;
} catch (TimeoutException ex) {
return false;
msg.append("'" + tab + "', ");
}
}

return true;

if ( (elementFound / numOfElements) < 0.5 ) {
retVal = false;
}
Common.logDebug("In testTabsForNavigationLinks(element = '" + element.name() + "') -> numOfElements:" + numOfElements + ", elementFound:" + elementFound + ", ratio: " + (elementFound / numOfElements) + ", retVal:" + retVal + "." );
return retVal;
}

private List<NavigationWebElement> getNavWebElements() {
Expand Down
Loading