Skip to content

Commit

Permalink
HPCC-31857 : Added comments, Updated Readme, Updated wait time logic …
Browse files Browse the repository at this point in the history
…for sorting functionality, applied additional check for Total Cluster Time UI value parsing
  • Loading branch information
Nisha-Bagdwal committed Jun 26, 2024
1 parent 8de9710 commit aeca50d
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 89 deletions.
4 changes: 3 additions & 1 deletion esp/src/test-ui/tests/framework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ The names of the Java classes that the TestRunner class needs to load should be
file.

Each Java class created to write tests for specific web pages should have at least one method annotated with @Test. The
code for each class starts to run from this method.
code for each class starts to run from this method.

Note: Users need to run these tests with regression test suite only.
2 changes: 1 addition & 1 deletion esp/src/test-ui/tests/framework/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ public class Config {
public static final int[] dropdownValues = {10, 25, 50, 100, 250, 500, 1000};
public static final int MALFORMED_TIME_STRING = -1;
public static final int WAIT_TIME_IN_SECONDS = 1;
public static final int WAIT_TIME_THRESHOLD_IN_SECONDS = 10;
public static final int WAIT_TIME_THRESHOLD_IN_SECONDS = 20;
}
28 changes: 13 additions & 15 deletions esp/src/test-ui/tests/framework/pages/ActivitiesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import framework.model.NavigationWebElement;
import framework.utility.Common;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;

Expand All @@ -27,21 +26,20 @@ public class ActivitiesTest {

@Test
public void testActivitiesPage() {
WebDriver driver = Common.driver;
Common.openWebPage(Common.getUrl(Config.ACTIVITIES_URL));

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

testForAllText(driver);
testForAllText();

List<NavigationWebElement> navWebElements = getNavWebElements(driver);
List<NavigationWebElement> navWebElements = getNavWebElements();

testForNavigationLinks(driver, navWebElements);
testForNavigationLinks(navWebElements);

Common.logDebug("Tests finished for: Activities page.");
}

private void testForNavigationLinks(WebDriver driver, List<NavigationWebElement> navWebElements) {
private void testForNavigationLinks(List<NavigationWebElement> navWebElements) {

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

Expand All @@ -50,11 +48,11 @@ private void testForNavigationLinks(WebDriver driver, List<NavigationWebElement>
try {
element.webElement().click();

if (testTabsForNavigationLinks(driver, element)) {
if (testTabsForNavigationLinks(element)) {
String msg = "Success: Navigation Menu Link for " + element.name() + ". URL : " + element.hrefValue();
Common.logDetail(msg);
} else {
String currentPage = getCurrentPage(driver);
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);
}
Expand All @@ -64,14 +62,14 @@ private void testForNavigationLinks(WebDriver driver, List<NavigationWebElement>
}
}

private String getCurrentPage(WebDriver driver) {
private String getCurrentPage() {

for (var entry : tabsListMap.entrySet()) {

List<String> tabs = entry.getValue();
boolean allTabsPresent = true;
for (String tab : tabs) {
if (!driver.getPageSource().contains(tab)) {
if (!Common.driver.getPageSource().contains(tab)) {
allTabsPresent = false;
break;
}
Expand All @@ -85,9 +83,9 @@ private String getCurrentPage(WebDriver driver) {
return "Invalid Page";
}

private boolean testTabsForNavigationLinks(WebDriver driver, NavigationWebElement element) {
private boolean testTabsForNavigationLinks(NavigationWebElement element) {
List<String> tabsList = tabsListMap.get(element.name());
String pageSource = driver.getPageSource();
String pageSource = Common.driver.getPageSource();

for (String tab : tabsList) {
if (!pageSource.contains(tab)) {
Expand All @@ -98,13 +96,13 @@ private boolean testTabsForNavigationLinks(WebDriver driver, NavigationWebElemen
return true;
}

private List<NavigationWebElement> getNavWebElements(WebDriver driver) {
private List<NavigationWebElement> getNavWebElements() {

List<NavigationWebElement> navWebElements = new ArrayList<>();

for (String navName : navNamesArray) {
try {
WebElement webElement = driver.findElement(By.name(navName)).findElement(By.tagName("a"));
WebElement webElement = Common.driver.findElement(By.name(navName)).findElement(By.tagName("a"));
String hrefValue = webElement.getAttribute("href");
navWebElements.add(new NavigationWebElement(navName, hrefValue, webElement));
} catch (Exception ex) {
Expand All @@ -117,7 +115,7 @@ private List<NavigationWebElement> getNavWebElements(WebDriver driver) {
return navWebElements;
}

private void testForAllText(WebDriver driver) {
private void testForAllText() {
Common.logDebug("Tests started for: Activities page: Testing Text");
for (String text : textArray) {
Common.checkTextPresent(text, "Activities Page");
Expand Down
Loading

0 comments on commit aeca50d

Please sign in to comment.