Skip to content

Commit

Permalink
HPCC-33041 ECL Watch UI test (GH Action) reports an error with 'Files…
Browse files Browse the repository at this point in the history
…' page.

ActivitiesTest.java:
- Change the 'should match' behaviour to a 'looks like' attempt when the test
  tries to identify a WEB page where it is landed after clicked a hyperlink..

test-ui-gh_runner.yml:
- Change Chromedriver vesion (PR-19330 not merged yet)
- Fix the tests log artifact name

Tested locally.

Signed-off-by: Attila Vamos <[email protected]>
  • Loading branch information
AttilaVamos committed Jan 7, 2025
1 parent d8a4cb3 commit 7063862
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-ui-gh_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
- name: Get content
working-directory: /home/runner/HPCCSystems-regression/log
shell: "bash"
run: |
run: |
curl localhost:8010/WsWorkunits/WUQuery.json | python3 -m json.tool > workunits.json
curl localhost:8010/WsDfu/DFUQuery.json?PageSize=250 | python3 -m json.tool > files.json
curl localhost:8010/FileSpray/GetDFUWorkunits.json | python3 -m json.tool > dfu-workunits.json
Expand Down
33 changes: 26 additions & 7 deletions esp/src/test-ui/tests/framework/pages/ActivitiesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,28 @@ public void testActivitiesPage() {
private void testForNavigationLinks(List<NavigationWebElement> navWebElements) {

Common.logDebug("Tests started for: Activities page: Testing Navigation Links");

for (NavigationWebElement element : navWebElements) {

StringBuilder erorMmsg = new StringBuilder("OK");

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

if (testTabsForNavigationLinks(element)) {
if (testTabsForNavigationLinks(element, erorMmsg)) {
String msg = "Success: Navigation Menu Link for " + element.name() + ". URL : " + element.hrefValue();
Common.logDetail(msg);
if ( erorMmsg.length() > 0 ){
String currentPage = getCurrentPage();
String warningMsg = " Warning: on '" + currentPage + "' page there is missing/not matching element(s):" + erorMmsg;
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();
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;
Common.logError(errorMsg);
// 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,29 @@ 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 numOfElemets = tabsList.size();
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 / numOfElemets) < 0.5 ) {
retVal = false;
}
Common.logDebug("In testTabsForNavigationLinks(element = '" + element.name() + "') -> numOfElemets:" + numOfElemets + ", elementFound:" + elementFound + ", ratio: " + (elementFound / numOfElemets) + ", retVal:" + retVal + "." );
return retVal;
}

private List<NavigationWebElement> getNavWebElements() {
Expand Down

0 comments on commit 7063862

Please sign in to comment.