Skip to content

Commit

Permalink
Amends previous
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrodjpl committed Feb 12, 2025
1 parent b925d74 commit aa33378
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ public void runOneWorkerTest() throws IOException {
disableWorkers("test_deployments_page");
WebElement enable = findElById("pv-test_deployments_page");
waitForElement(enable);
// Refresh element before clicking
enable = findElById("pv-test_deployments_page");
enable.click();

log.info("Enabling one worker.");
Expand All @@ -376,14 +378,19 @@ public void runOneWorkerTest() throws IOException {

WebElement oneWorkerDone = findElById("done-workers-btn");
waitForElement(oneWorkerDone);
// Refresh element before clicking
oneWorkerDone = findElById("done-workers-btn");
oneWorkerDone.click();

wait.until(ExpectedConditions.invisibilityOf(oneWorkerDone));

wait.until(ExpectedConditions.elementToBeClickable(enable));

wait.until(ExpectedConditions.elementToBeClickable(By.id("pv-test_deployments_page")));
// Get fresh reference before second click
enable = findElById("pv-test_deployments_page");
enable.click();

// Get fresh reference to done button
oneWorkerDone = findElById("done-workers-btn");
waitForElement(oneWorkerDone);

List<WebElement> selectElements = driver.findElements(By.cssSelector("input[class='worker-checkbox']"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,37 @@ public void runResultsTest() throws IOException {
waitForElementID("processes-table");

log.info("Verifying the header and output from the model.");
// Get fresh reference to history button
WebElement historyButton = findElByXPath("//button[contains(text(),'History')]");
waitForElement(historyButton);
// Refresh element before scrolling
historyButton = findElByXPath("//button[contains(text(),'History')]");
scrollTo(historyButton);
// Refresh element before clicking
historyButton = findElByXPath("//button[contains(text(),'History')]");
historyButton.click();

// Try up to 3 times to interact with the history button
int maxRetries = 3;
boolean succeeded = false;

for (int attempt = 1; attempt <= maxRetries && !succeeded; attempt++) {
try {
log.info("Attempt " + attempt + " to interact with history button");
// Get fresh reference to history button
WebElement historyButton = findElByXPath("//button[contains(text(),'History')]");
waitForElement(historyButton);

// Refresh element before scrolling
historyButton = findElByXPath("//button[contains(text(),'History')]");
scrollTo(historyButton);

// Refresh element before clicking
historyButton = findElByXPath("//button[contains(text(),'History')]");
historyButton.click();

succeeded = true;
log.info("Successfully interacted with history button on attempt " + attempt);
} catch (org.openqa.selenium.StaleElementReferenceException e) {
if (attempt == maxRetries) {
log.error("Failed to interact with history button after " + maxRetries + " attempts");
throw e;
}
log.warn("Stale element on attempt " + attempt + ", retrying...");
sleep(1000); // Brief pause before retry
}
}

findOnPage("History");

Expand All @@ -88,6 +110,8 @@ public void runResultsTest() throws IOException {

sleep(10000);

// Refresh element before clicking
hideLineCheckbox = findElByXPath("//input[@id='showall']");
hideLineCheckbox.click();

if (findOnPage("History Page.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,13 @@ public void runStartInitiatorTest() throws IOException {

sleep(20000);

log.info("Getting info from progress bar of Test Initiators Page.");
WebElement statsText = driver.findElement(By.id("stat-txt-test_initiators_page"));
String child = statsText.getText();
log.info(child);
// Wait for element to be present and not stale
wait.until(ExpectedConditions.presenceOfElementLocated(By.id("stat-txt-test_initiators_page")));
WebElement statsElement = wait.until(ExpectedConditions.refreshed(
ExpectedConditions.presenceOfElementLocated(By.id("stat-txt-test_initiators_page"))
));
String child = statsElement.getText();
log.info("Stats text after waiting: " + child);

//analyze string to check how many procs completed.
if (child.contains("completed: 10")) {
Expand Down
1 change: 0 additions & 1 deletion install/cws-ui/processes.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,6 @@
}
var copyValue = $(this).attr('data-copyValue');
var isImage = $(this).attr('data-isImage');
console.log(isImage);
copyInput(copyValue, isImage);
$(this).attr('aria-label', 'Copied!');
setTimeout(function () {
Expand Down

0 comments on commit aa33378

Please sign in to comment.