Skip to content

Commit

Permalink
Fixes unit tests that were looking at the wrong input area for the ta…
Browse files Browse the repository at this point in the history
…ble.
  • Loading branch information
jdrodjpl committed Sep 24, 2024
1 parent 9aad82c commit 05df1fa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ public void runResultsTest() throws IOException {

goToPage("processes");

waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");
waitForElementXPath("//input[@id=\'dt-search-0\']");

sleep(5000);

driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_history_page");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).click();
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys("test_history_page");
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");

log.info("Verifying the header and output from the model.");
WebElement historyButton = findElByXPath("//a[contains(text(),'History')]");
WebElement historyButton = findElByXPath("//button[contains(text(),'History')]");
waitForElement(historyButton);
scrollTo(historyButton);
historyButton.click();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

package jpl.cws.test.integration.ui;

import static org.junit.Assert.assertTrue;
Expand Down Expand Up @@ -206,17 +207,17 @@ public void runVariableProcTest() throws IOException {
goToPage("processes");

log.info("Filtering results for Test Initiators Page test.");
waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");
waitForElementXPath("//input[@id=\'dt-search-0\']");

driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_initiators_page");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).click();
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys("test_initiators_page");
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");

log.info("Clicking on Test Initiators Page history.");
sleep(5000);
WebElement historyButton = findElByXPath("//a[contains(text(),'History')]");
WebElement historyButton = findElByXPath("//button[contains(text(),'History')]");
waitForElement(historyButton);
historyButton.sendKeys(Keys.RETURN);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ public void runStatusCompleteTest() throws IOException {
sleep(8000);

log.info("Locating Test Processes Page from table rows and verifying that it completed.");
waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");
waitForElementXPath("//input[@id=\'dt-search-0\']");

driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_snippets_page");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).click();
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys("test_snippets_page");
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");
//selenium: check if "test_processes_page" is on the page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ public void runSnippetsModelTest() throws IOException {
goToPage("processes");
sleep(8000);

waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");
waitForElementXPath("//input[@id=\'dt-search-0\']");

driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_snippets_page");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).click();
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys("test_snippets_page");
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");

log.info("Clicking on Test Snippets Page history.");
WebElement historyButton = findElByXPath("//a[contains(text(),'History')]");
WebElement historyButton = findElByXPath("//button[contains(text(),'History')]");
waitForElement(historyButton);
scrollTo(historyButton);
historyButton.click();
Expand Down
24 changes: 12 additions & 12 deletions cws-test/src/test/java/jpl/cws/test/integration/ui/WebTestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,21 +209,21 @@ public void runHelloWorldTest() {
sleep(1000);
log.info("Found a completed task.");

waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");
waitForElementXPath("//input[@id=\'dt-search-0\']");

WebElement filter = driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input"));
WebElement filter = driver.findElement(By.xpath("//input[@id=\'dt-search-0\']"));

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].scrollIntoViewIfNeeded();", filter);
// filter.click();

driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_hello_world");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys("test_hello_world");
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");

waitForElementXPath("//a[contains(text(),'History')]");
WebElement historyButton = driver.findElement(By.xpath("//a[contains(text(),'History')]"));
waitForElementXPath("//button[contains(text(),'History')]");
WebElement historyButton = driver.findElement(By.xpath("//button[contains(text(),'History')]"));
js.executeScript("arguments[0].scrollIntoViewIfNeeded();", historyButton);

historyButton.click();
Expand Down Expand Up @@ -259,21 +259,21 @@ public void runGroovyTest() {
sleep(1000);
log.info("Found a completed task.");

waitForElementXPath("//div[@id=\'processes-table_filter\']/label/input");
waitForElementXPath("//input[@id=\'dt-search-0\']");

WebElement filter = driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input"));
WebElement filter = driver.findElement(By.xpath("//input[@id=\'dt-search-0\']"));

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].scrollIntoViewIfNeeded();", filter);

// filter.click();
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys("test_groovy_script");
driver.findElement(By.xpath("//div[@id=\'processes-table_filter\']/label/input")).sendKeys(Keys.ENTER);
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys("test_groovy_script");
driver.findElement(By.xpath("//input[@id=\'dt-search-0\']")).sendKeys(Keys.ENTER);

waitForElementID("processes-table");

waitForElementXPath("//a[contains(text(),'History')]");
WebElement historyButton = driver.findElement(By.xpath("//a[contains(text(),'History')]"));
waitForElementXPath("//button[contains(text(),'History')]");
WebElement historyButton = driver.findElement(By.xpath("//button[contains(text(),'History')]"));
js.executeScript("arguments[0].scrollIntoViewIfNeeded();", historyButton);

historyButton.click();
Expand Down

0 comments on commit 05df1fa

Please sign in to comment.