From ff236b76bd87cc615850f863d69a5a21f5c61c05 Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Tue, 16 Apr 2024 07:16:50 -0700 Subject: [PATCH] cleanup --- .../test/java/jpl/cws/test/WebTestUtil.java | 41 +------------------ .../cws/test/integration/ui/LoadTestIT.java | 2 - .../test/integration/ui/SnippetsTestIT.java | 10 ----- .../cws/test/integration/ui/WebTestIT.java | 12 ------ 4 files changed, 2 insertions(+), 63 deletions(-) diff --git a/cws-test/src/test/java/jpl/cws/test/WebTestUtil.java b/cws-test/src/test/java/jpl/cws/test/WebTestUtil.java index 7e25380a..a99f4f0a 100644 --- a/cws-test/src/test/java/jpl/cws/test/WebTestUtil.java +++ b/cws-test/src/test/java/jpl/cws/test/WebTestUtil.java @@ -23,14 +23,10 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.TakesScreenshot; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -import org.apache.commons.io.FileUtils; import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.Point; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -292,34 +288,16 @@ public void startProcDef(String procDef, String procName, long procTime) { public void enableWorkers(String procDef) { WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30)); - - // wait.until(ExpectedConditions.elementToBeClickable(By.id("pv-"+procDef))); sleep(5000); WebElement enable = findElById("pv-"+procDef); - // String elementHTML = enable.getAttribute("outerHTML"); JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].scrollIntoViewIfNeeded();", enable); - -// TakesScreenshot screenshot = (TakesScreenshot)driver; -// //Saving the screenshot in desired location -// File source = screenshot.getScreenshotAs(OutputType.FILE); -// //Path to the location to save screenshot -// try{FileUtils.copyFile(source, new File("/tmp/Before-"+procDef+".png"));} - -// catch(IOException e) { -// e.printStackTrace(); -// } - // System.out.println("Src attribute is: "+ elementHTML); sleep(5000); enable.click(); sleep(1000); - - - - WebElement allWorkers = findElById("all-workers"); WebElement allWorkersDone = findElById("done-workers-btn"); log.info("Enabling workers."); @@ -486,21 +464,6 @@ public void deleteProc(String procName) { JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("arguments[0].scrollIntoViewIfNeeded();", delButton); - - TakesScreenshot screenshot = (TakesScreenshot)driver; - //Saving the screenshot in desired location - File source = screenshot.getScreenshotAs(OutputType.FILE); - //Path to the location to save screenshot - try{FileUtils.copyFile(source, new File("/tmp/Before-"+procName+".png"));} - -catch(IOException e) { - e.printStackTrace(); -} - - String elementHTML = delButton.getAttribute("outerHTML"); - System.out.println("Src attribute is: "+ elementHTML); - - delButton.click(); waitForElementID("delete-proc-def"); diff --git a/cws-test/src/test/java/jpl/cws/test/integration/ui/LoadTestIT.java b/cws-test/src/test/java/jpl/cws/test/integration/ui/LoadTestIT.java index 71312a4a..196bd15f 100644 --- a/cws-test/src/test/java/jpl/cws/test/integration/ui/LoadTestIT.java +++ b/cws-test/src/test/java/jpl/cws/test/integration/ui/LoadTestIT.java @@ -56,8 +56,6 @@ public void runLargeLoadTest() throws IOException { // run 1000 models, 5 at a time (across 3 workers ideally) runStartLoadTest(); - System.out.println("TEST CASES: " + Integer.toString(testCasesCompleted)); - if (Integer.toString(testCasesCompleted).equals("1")) { scriptPass = true; } else { 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 8c8ca4d4..3c2f4ffb 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 @@ -43,15 +43,10 @@ public void runSnippetsPageTest() throws IOException { login(); runSnippetsModelTest(); - log.info("Done model test: "+ testCasesCompleted); runValidateButtonTest(); - log.info("Done validate test: "+ testCasesCompleted); runUpdateSnippetTest(); - log.info("Done snippets test: "+ testCasesCompleted); runUpdateErrorTest(); - log.info("Done validate error test: "+ testCasesCompleted); runReloadEditorTest(); - log.info("Done editor test: "+ testCasesCompleted); if(Integer.toString(testCasesCompleted).equals("5")) { scriptPass = true; @@ -234,11 +229,6 @@ public void runUpdateSnippetTest() throws IOException { js.executeScript("arguments[0].scrollIntoViewIfNeeded();", validateAndSaveButton); sleep(2000); - screenShot("SnippetsTestIT-EXCEPTION"); - - String elementHTML = validateAndSaveButton.getAttribute("outerHTML"); - log.info(elementHTML); - validateAndSaveButton.click(); log.info("Verifying 'Saved the snippets' shows up on the page."); diff --git a/cws-test/src/test/java/jpl/cws/test/integration/ui/WebTestIT.java b/cws-test/src/test/java/jpl/cws/test/integration/ui/WebTestIT.java index 8cbb5953..ae9dc93c 100644 --- a/cws-test/src/test/java/jpl/cws/test/integration/ui/WebTestIT.java +++ b/cws-test/src/test/java/jpl/cws/test/integration/ui/WebTestIT.java @@ -226,12 +226,6 @@ public void runHelloWorldTest() { WebElement historyButton = driver.findElement(By.xpath("//a[contains(text(),'History')]")); js.executeScript("arguments[0].scrollIntoViewIfNeeded();", historyButton); - try { - File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); - // Now you can do whatever you need to do with it, for example copy somewhere - FileUtils.copyFile(scrFile, new File("/tmp/history_button.png")); - } catch(IOException e) {} - historyButton.click(); sleep(1000); @@ -286,12 +280,6 @@ public void runGroovyTest() { sleep(1000); - try { - File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); - // Now you can do whatever you need to do with it, for example copy somewhere - FileUtils.copyFile(scrFile, new File("/tmp/groovy.png")); - } catch(IOException e) {} - findOnPage("Groovy."); sleep(9000);