From 8bbed3f7e956e3be8eb45fd616e78f22d57c19ca Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Tue, 9 Apr 2024 22:40:16 -0700 Subject: [PATCH] wip --- .../test/integration/ui/SnippetsTestIT.java | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/cws-test/src/test/java/jpl/cws/test/integration/ui/SnippetsTestIT.java b/cws-test/src/test/java/jpl/cws/test/integration/ui/SnippetsTestIT.java index ef9d5600..10a28efd 100644 --- a/cws-test/src/test/java/jpl/cws/test/integration/ui/SnippetsTestIT.java +++ b/cws-test/src/test/java/jpl/cws/test/integration/ui/SnippetsTestIT.java @@ -160,7 +160,12 @@ public void runValidateButtonTest() { waitForElementID("validateAndSaveSnippetsSubmitBtn"); log.info("Clicking on 'Validate and Save' button."); - driver.findElement(By.id("validateAndSaveSnippetsSubmitBtn")).click(); + + WebElement validateAndSaveButton = driver.findElement(By.id("validateAndSaveSnippetsSubmitBtn")); + JavascriptExecutor js = (JavascriptExecutor) driver; + js.executeScript("arguments[0].scrollIntoViewIfNeeded();", validateAndSaveButton); + + validateAndSaveButton.click(); log.info("Verifying 'Saved the snippets' shows up on the page."); if(findOnPage("Saved the snippets")) { @@ -219,7 +224,11 @@ public void runUpdateSnippetTest() throws IOException { waitForElementID("validateAndSaveSnippetsSubmitBtn"); log.info("Clicking on 'Validate and Save' button..."); - driver.findElement(By.id("validateAndSaveSnippetsSubmitBtn")).click(); + + WebElement validateAndSaveButton = driver.findElement(By.id("validateAndSaveSnippetsSubmitBtn")); + js.executeScript("arguments[0].scrollIntoViewIfNeeded();", validateAndSaveButton); + + validateAndSaveButton.click(); log.info("Verifying 'Saved the snippets' shows up on the page."); if(findOnPage("Saved the snippets")) { @@ -255,7 +264,11 @@ public void runUpdateErrorTest() throws IOException { waitForElementID("validateAndSaveSnippetsSubmitBtn"); log.info("Clicking on 'Validate and Save' button"); - driver.findElement(By.id("validateAndSaveSnippetsSubmitBtn")).click(); + + WebElement validateAndSaveButton = driver.findElement(By.id("validateAndSaveSnippetsSubmitBtn")); + js.executeScript("arguments[0].scrollIntoViewIfNeeded();", validateAndSaveButton); + + validateAndSaveButton.click(); log.info("Looking for 'ERROR: invalid code.' on page."); if(findOnPage("ERROR: invalid code.")) { @@ -293,7 +306,11 @@ public void runReloadEditorTest() throws IOException { waitForElementID("validateAndSaveSnippetsSubmitBtn"); log.info("Clicking on 'Validate and Save' button"); - driver.findElement(By.id("validateAndSaveSnippetsSubmitBtn")).click(); + + WebElement validateAndSaveButton = driver.findElement(By.id("validateAndSaveSnippetsSubmitBtn")); + js.executeScript("arguments[0].scrollIntoViewIfNeeded();", validateAndSaveButton); + + validateAndSaveButton.click(); log.info("Looking for 'ERROR: invalid code.' on page."); if(findOnPage("ERROR: invalid code.")) {