Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrodjpl committed Apr 16, 2024
1 parent 85618b9 commit ff236b7
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 63 deletions.
41 changes: 2 additions & 39 deletions cws-test/src/test/java/jpl/cws/test/WebTestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;


/**
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.");
Expand Down
12 changes: 0 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 @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ff236b7

Please sign in to comment.