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)

Tested locally.

Signed-off-by: Attila Vamos <[email protected]>
  • Loading branch information
AttilaVamos committed Dec 5, 2024
1 parent 38456ac commit 5551d4f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test-ui-gh_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ jobs:
export PATH=$PATH:$JAVA_HOME/bin
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt-get install -y ./google-chrome-stable_current_amd64.deb
wget https://storage.googleapis.com/chrome-for-testing-public/126.0.6478.126/linux64/chromedriver-linux64.zip
#wget https://storage.googleapis.com/chrome-for-testing-public/126.0.6478.126/linux64/chromedriver-linux64.zip
wget https://storage.googleapis.com/chrome-for-testing-public/131.0.6778.85/linux64/chromedriver-linux64.zip
unzip chromedriver-linux64.zip -d chromedriver
sudo mv chromedriver/chromedriver-linux64/chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
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 5551d4f

Please sign in to comment.