Skip to content

Commit

Permalink
update-tests (#103)
Browse files Browse the repository at this point in the history
* Fixed location of configuration.properties file used in installerTest.sh
* Restored WebTest and subtests
* Fixed integration tests
* Updated InitiatorsTestIT
  • Loading branch information
RonnyFrayRegato authored Jun 29, 2022
1 parent 9c5ff73 commit 7edf2cd
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 130 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ See the [wiki](https://github.com/NASA-AMMOS/common-workflow-service/wiki) for m

## Prerequisites

- [**Maven**](https://docs.docker.com/get-docker/): Used to dynamically download libraries and other required project dependencies.
- [**Maven**](https://maven.apache.org/download.cgi): Used to dynamically download libraries and other required project dependencies.
- For Home-brew users:
- Install Maven using: `brew install maven`
- Verify installation using: `mvn -v`
- [**Docker**](https://maven.apache.org/download.cgi): Used to run external Elasticsearch, and create and configure mariaDB database container
- MariaDB or MySQL database set up on either your local machine or a remote host. You will also need to create the following:
- A database for CWS to use. `cws_dev` is a good default name.
- A database user with full access to the above database.
- Recommended minimum system requirements from Docker Resources window:
- [**Docker**](https://docs.docker.com/get-docker/): Used to run external Elasticsearch, and create and configure mariaDB database container
- Recommended minimum system requirements from Docker Resources window:
- CPUs: 4
- Memory: 5.00 GB
- Swap: 1 GB
- Disk image size: 59.6 GB
- MariaDB or MySQL database set up on either your local machine or a remote host. You will also need to create the following:
- A database for CWS to use. `cws_dev` is a good default name.
- A database user with full access to the above database.
- [**ITerm2**](https://iterm2.com/): Currently these build scripts include commands to open new terminal windows using ITerm2, so they are best run from that terminal.
- **Logstash 7.16.2+**: Download Logstash (OSS version) for the Windows platform. Rename the ZIP file from 'logstash-oss-7.16.2-windows-x86_64.zip' to 'logstash-7.16.2.zip' and place in `install/logging/`. This is a temporary workaround while we clean up our installation process. You can find the zip download [here](https://www.elastic.co/downloads/past-releases/logstash-oss-7-16-2).
- **Elasticsearch 7.16.2+**: CWS requires an externally-configured elasticsearch cluster to be set up. You can use an SSL Secure Elasticsearch with or without authentication, or an Insecure HTTP Elasticsearch.
Expand Down
11 changes: 9 additions & 2 deletions cws-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,14 @@
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>


<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.2.0</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -379,7 +386,7 @@
</execution>
</executions>
</plugin>
</plugins>
</plugins>
</build>

</project>
22 changes: 6 additions & 16 deletions cws-test/src/test/java/jpl/cws/test/WebTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class WebTest extends WebTestUtil {
private static final Logger log = LoggerFactory.getLogger(WebTest.class);

@Test
@Ignore (value="Not portable (specific to Hollins/local-setup)")
public void loginTest() {
log.info("------ START loginTest ------");
gotoLoginPage();
Expand All @@ -25,7 +24,6 @@ public void loginTest() {
}

@Test
@Ignore (value="Not portable (specific to Hollins/local-setup)")
public void deployTest() {
log.info("------ START deployTest ------");
gotoLoginPage();
Expand All @@ -36,33 +34,25 @@ public void deployTest() {
}

@Test
@Ignore (value="Not portable (specific to Hollins/local-setup)")
public void runProcessTest() {
log.info("------ START runProcessTest ------");
gotoLoginPage();
login();
startProcessFromConsole("test_simplest");
startProcDef("test_simplest", "Test Simplest");
deleteProc("test_simplest");
logout();
log.info("------ END runProcessTest ------");
}

private void uploadProcessDefinitionFile() {
WebElement fileUploadInput = findElById("file");
WebElement fileUploadInput = findElById("file-input");
fileUploadInput.sendKeys(TEST_BPMN_DIR+"/test_simplest.bpmn");

WebElement deployProcDefBtn = findElById("deployProcDefBtn");
WebElement deployProcDefBtn = findElById("bpmn-form");
deployProcDefBtn.click();
findOnPage("Deployed process definition");
findOnPage("test_simplest");
}

private void startProcessFromConsole(String procDefKey) {
findOnPage(procDefKey);
WebElement startIcon = findElById("start_"+procDefKey+"_icon");
log.info("Clicking on " + startIcon);
startIcon.click();
findOnPage("Scheduled the '"+procDefKey+"' process.");
}




}
127 changes: 71 additions & 56 deletions cws-test/src/test/java/jpl/cws/test/WebTestIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class WebTestIT extends WebTestUtil {


@Test
@Ignore (value="Not portable (specific to Hollins/local-setup)")
public void testGoogleSearch() throws InterruptedException, IOException {

driver.get("http://www.google.com");
Expand All @@ -44,7 +43,6 @@ public void testGoogleSearch() throws InterruptedException, IOException {
}

@Test
@Ignore (value="Not portable (specific to Hollins/local-setup)")
public void loginTest() {
log.info("------ START loginTest ------");
gotoLoginPage();
Expand All @@ -54,7 +52,6 @@ public void loginTest() {
}

@Test
@Ignore (value="Not portable (specific to Hollins/local-setup)")
public void deployTest() {
log.info("------ START deployTest ------");
gotoLoginPage();
Expand All @@ -66,7 +63,6 @@ public void deployTest() {
}

@Test
@Ignore (value="Not portable (specific to Wood/local-setup)")
public void runDeployTest() {
log.info("------ START deployTest ------");
gotoLoginPage();
Expand All @@ -78,14 +74,21 @@ public void runDeployTest() {
WebElement enable = findElById("pv-test_set_vars");
enable.click();
sleep(1000);

WebElement allWorkers = findElById("all-workers");
allWorkers.click();
sleep(1000);

WebElement allWorkersDone = findElById("done-workers-btn");
allWorkersDone.click();
sleep(10000);

if(allWorkers.isSelected()) {
allWorkersDone.click();
sleep(1000);
} else {
allWorkers.click();
sleep(1000);
allWorkersDone.click();
sleep(1000);
}

sleep(2000);


// Start Instance
Expand All @@ -98,7 +101,11 @@ public void runDeployTest() {
WebElement start = driver.findElement(By.xpath("//*[contains(@class,'start-process-action')]"));
start.click();
sleep(5000);


WebElement searchProcessField = driver.findElement(By.xpath("//input[contains(@class,'form-control')]"));
searchProcessField.sendKeys("Test Set Variables");
sleep(5000);

WebElement li = driver.findElement(By.xpath("//*[contains(text(),'Test Set Variables')]"));
li.click();
sleep(5000);
Expand All @@ -111,20 +118,18 @@ public void runDeployTest() {
// Go back to CWS
WebElement cws = driver.findElement(By.xpath("//a[@href='/cws-ui']"));
cws.click();
findOnPage("<title>CWS - Dashboard</title>");


gotoDeployments();
findOnPage("<title>CWS - Deployments</title>");


// Wait for Finish
sleep(25000);

sleep(90000);

deleteProc("test_set_vars");
logout();
log.info("------ END deployTest ------");
}

@Test
@Ignore (value="Not portable (specific to Hollins/local-setup)")
public void runErrorHandlingTest() {
log.info("------ START deployTest ------");
gotoLoginPage();
Expand All @@ -138,14 +143,21 @@ public void runErrorHandlingTest() {
enable.click();
sleep(1000);


WebElement allWorkers = findElById("all-workers");
allWorkers.click();
sleep(1000);

WebElement allWorkersDone = findElById("done-workers-btn");
allWorkersDone.click();
sleep(10000);

if(allWorkers.isSelected()) {
allWorkersDone.click();
sleep(1000);
} else {
allWorkers.click();
sleep(1000);
allWorkersDone.click();
sleep(1000);
}

sleep(2000);


// Start Instance (1) through Camunda
Expand All @@ -158,7 +170,11 @@ public void runErrorHandlingTest() {
WebElement start = driver.findElement(By.xpath("//*[contains(@class,'start-process-action')]"));
start.click();
sleep(5000);


WebElement searchProcessField = driver.findElement(By.xpath("//input[contains(@class,'form-control')]"));
searchProcessField.sendKeys("Test Error Handling");
sleep(5000);

WebElement li = driver.findElement(By.xpath("//*[contains(text(),'Test Error Handling')]"));
li.click();
sleep(5000);
Expand All @@ -171,20 +187,18 @@ public void runErrorHandlingTest() {
// Go back to CWS
WebElement cws = driver.findElement(By.xpath("//a[@href='/cws-ui']"));
cws.click();
findOnPage("<title>CWS - Dashboard</title>");

gotoDeployments();

findOnPage("<title>CWS - Deployments</title>");

// Wait for Finish
sleep(90000);
sleep(180000);
procCounter++;


deleteProc("test_error_handling");
logout();
log.info("------ END deployTest ------");
}

@Test
@Ignore (value="Not portable (specific to Hasan/local-setup)")
public void runHelloWorldTest() {
log.info("------ START deployTest ------");
gotoLoginPage();
Expand All @@ -199,16 +213,18 @@ public void runHelloWorldTest() {

WebElement allWorkers = findElById("all-workers");
WebElement allWorkersDone = findElById("done-workers-btn");
if(allWorkers.isEnabled()) {

if(allWorkers.isSelected()) {
allWorkersDone.click();
sleep(10000);
sleep(1000);
} else {
allWorkers.click();
sleep(1000);
allWorkersDone.click();
sleep(10000);
sleep(1000);
}

sleep(2000);

WebElement tasks = driver.findElement(By.xpath("//a[@href='/camunda/app/tasklist']"));
tasks.click();
Expand All @@ -219,7 +235,11 @@ public void runHelloWorldTest() {
WebElement start = driver.findElement(By.xpath("//*[contains(@class,'start-process-action')]"));
start.click();
sleep(5000);


WebElement searchProcessField = driver.findElement(By.xpath("//input[contains(@class,'form-control')]"));
searchProcessField.sendKeys("Test Hello World");
sleep(5000);

WebElement li = driver.findElement(By.xpath("//*[contains(text(),'Test Hello World')]"));
li.click();
sleep(5000);
Expand All @@ -232,7 +252,10 @@ public void runHelloWorldTest() {
// Go back to CWS
WebElement cws = driver.findElement(By.xpath("//a[@href='/cws-ui']"));
cws.click();
findOnPage("<title>CWS - Dashboard</title>");
findOnPage("<title>CWS - Deployments</title>");

// Wait for Finish
sleep(90000);


/*
Expand Down Expand Up @@ -265,9 +288,7 @@ public void runHelloWorldTest() {
sleep(1000);
*/

goToPage("deployments");



if(findOnPage("completed")) {
goToProcesses();
Expand All @@ -285,9 +306,10 @@ public void runHelloWorldTest() {
WebElement filterSubmit = findElById("filter-submit-btn");
filterSubmit.click();
sleep(1000);

WebElement logCheck = findElById("processes-table");
logCheck.click();

waitForElementXPath("//button[contains(text(),'History')]");
WebElement historyButton = driver.findElement(By.xpath("//button[contains(text(),'History')]"));
historyButton.click();
sleep(1000);

findOnPage("ls");
Expand All @@ -301,17 +323,18 @@ public void runHelloWorldTest() {
} else {
log.info("Process did not complete either in time or at all");
}


deleteProc("test_hello_world");
logout();
log.info("------ END deployTest ------");
}
@Test
@Ignore (value="Not portable (specific to Hollins/local-setup)")
public void runProcessTest() {
log.info("------ START runProcessTest ------");
gotoLoginPage();
login();
startProcessFromConsole("test_simplest");
startProcDef("test_simplest", "Test Simplest");
deleteProc("test_simplest");
logout();
log.info("------ END runProcessTest ------");
}
Expand Down Expand Up @@ -346,15 +369,7 @@ private void uploadErrorHandlingProcessDefinitionFile() {
deployFile("test_error_handling");

}

private void startProcessFromConsole(String procDefKey) {
findOnPage(procDefKey);
WebElement startIcon = findElById("start_"+procDefKey+"_icon");
log.info("Clicking on " + startIcon);
startIcon.click();
findOnPage("Scheduled the '"+procDefKey+"' process.");
}


//Demo for Sarjil
private void goToProcesses() {
if(findOnPage("completed")) {
Expand Down
Loading

0 comments on commit 7edf2cd

Please sign in to comment.