Skip to content

Commit

Permalink
Update Camunda to v7.18 (#135)
Browse files Browse the repository at this point in the history
* Update Camunda to v7.18
Remove cws_camunda-bpm-tomcat-7.17.0.zip
Remove cws_camunda-bpm-tomcat-7.17.0-lib.zip
Add cws_camunda-bpm-tomcat-7.18.0.zip
Add cws_camunda-bpm-tomcat-7.18.0-lib.zip
Refactor for Camunda 7.18
Set Content Security Policy header value

* Update Groovy dependencies

* Remove Groovy dependencies

* Create runGroovyTest
Create test_groovy_script.bpmn
Update WebTestIT

* Update camunda_mods
Update WebTestIT

* Update Selenium dependencies

* Update deprecated Selenium classes
Update parameters received by Waits and Timeout
Allow any origin to connect to remote instance

* Add Netty dependency
Resolve Netty conflict with Selenium 4

* Update Selenium to v4.8.3
Remove WebDriverManager dependency
Enable Selenium Manager
Update headless mode

* Update Camunda Modeler to v5.7.0
  • Loading branch information
RonnyFrayRegato authored Apr 11, 2023
1 parent 4dbd76c commit cd208be
Show file tree
Hide file tree
Showing 22 changed files with 241 additions and 246 deletions.
7 changes: 0 additions & 7 deletions cws-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,6 @@
<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
30 changes: 14 additions & 16 deletions cws-test/src/test/java/jpl/cws/test/WebTestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.concurrent.TimeUnit;
import java.time.Duration;

import org.junit.After;
import org.junit.Assert;
Expand All @@ -24,7 +24,6 @@
import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.github.bonigarcia.wdm.WebDriverManager;

/**
*
Expand Down Expand Up @@ -116,19 +115,18 @@ protected void initChromeDriver() {
ChromeOptions chromeOptions = new ChromeOptions();

// Turn on headless mode for Bamboo
chromeOptions.setHeadless(true);
chromeOptions.addArguments("--headless=new");
chromeOptions.setAcceptInsecureCerts(true);
chromeOptions.addArguments("--window-size=1920,1080");
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--disable-gpu");
chromeOptions.addArguments("--disable-dev-shm-usage");

WebDriverManager.chromedriver().setup();
driver = new ChromeDriver(chromeOptions);

log.info("Driver initialized: " + driver);

driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(60));
}

protected WebElement findElById(String id) {
Expand Down Expand Up @@ -176,7 +174,7 @@ protected void gotoLoginPage() {

driver.get("http://"+HOSTNAME+":"+PORT + "/cws-ui/login");
driver.manage().window().setSize(new Dimension(1024, 768));
driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(60));
// Verify we have made it to the Login page
findOnPage("Login");
}
Expand Down Expand Up @@ -222,7 +220,7 @@ protected void goToPage(String page) {
log.info("Navigating to " + page + " page");
driver.get("http://"+HOSTNAME+":"+PORT + "/cws-ui/" + page);
driver.manage().window().setSize(new Dimension(1024, 768));
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30));
postLogging(page, "Navigated to ");

}
Expand All @@ -240,7 +238,7 @@ protected void deployFile(String fileName) {

public void startProcDef(String procDef, String procName, long procTime) {
deployFile(procDef);
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));

enableWorkers(procDef);

Expand Down Expand Up @@ -285,7 +283,7 @@ public void startProcDef(String procDef, String procName, long procTime) {
}

public void enableWorkers(String procDef) {
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));

wait.until(ExpectedConditions.elementToBeClickable(By.id("pv-"+procDef)));
WebElement enable = findElById("pv-"+procDef);
Expand All @@ -310,7 +308,7 @@ public void enableWorkers(String procDef) {
}

public void disableWorkers(String procDef) {
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));

wait.until(ExpectedConditions.elementToBeClickable(By.id("pv-"+procDef)));
WebElement enable = findElById("pv-"+procDef);
Expand Down Expand Up @@ -397,22 +395,22 @@ public static void copyFile(File source, File dest) throws IOException {
}

public void waitForElement(WebElement arg0) {
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
wait.until(ExpectedConditions.elementToBeClickable(arg0));
}

public void waitForElementID(String item) {
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
wait.until(ExpectedConditions.elementToBeClickable(By.id(item)));
}

public void waitForElementXPath(String item) {
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(item)));
}

public void waitForElementClass(String item) {
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
wait.until(ExpectedConditions.elementToBeClickable(By.className(item)));
}

Expand Down Expand Up @@ -443,7 +441,7 @@ public void scrollTo(WebElement element) {
}

public void deleteProc(String procName) {
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
goToPage("deployments");

if(driver.getPageSource().contains(procName)) {
Expand Down Expand Up @@ -486,7 +484,7 @@ protected void sleep(long millis) {

public void checkIdle() {
try {
WebDriverWait wait = new WebDriverWait(driver,0);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(0));
wait.until(ExpectedConditions.elementToBeClickable(By.id("resume-refresh")));
WebElement resume = driver.findElement(By.id("resume-refresh"));
resume.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.io.File;
import java.io.IOException;
import java.time.Duration;
import java.util.List;

import org.junit.Test;
Expand Down Expand Up @@ -106,7 +107,7 @@ public void processCompletedTest() throws IOException {

public void runEnableDisableButtonTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
try {
log.info("------ START DeploymentsTestIT:runEnableDisableButtonTest ------");

Expand Down Expand Up @@ -266,7 +267,7 @@ public void runFileVersionTest() throws IOException {

public void runDeleteProcTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver,Duration.ofSeconds(30));
try {
log.info("------ START DeploymentsTestIT:runDeleteProcTest ------");

Expand Down Expand Up @@ -360,7 +361,7 @@ public void runStatusRefreshTest() throws IOException {

public void runOneWorkerTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver,Duration.ofSeconds(30));
try {
log.info("------ START DeploymentsTestIT:runOneWorkerTest ------");
disableWorkers("test_deployments_page");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.time.Duration;

import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
Expand Down Expand Up @@ -65,7 +65,7 @@ public void runInitiatorsPageTest() throws IOException {

public void runStartInitiatorTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
try {
log.info("------ START InitiatorsTestIT:runStartInitiatorTest ------");

Expand Down Expand Up @@ -225,7 +225,7 @@ && findOnPage("Setting (string) variable2 = bar")) {

public void runCronInitiatorTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver,Duration.ofSeconds(30));
try {
log.info("------ START InitiatorsTestIT:runCronInitiatorTest ------");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.time.Duration;

import org.junit.Test;
import org.openqa.selenium.By;
Expand Down Expand Up @@ -78,7 +79,7 @@ public void runLargeLoadTest() throws IOException {

public void runStartLoadTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
try {
log.info("------ START LoadTestIT:runStartLoadTest ------");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.time.Duration;

import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -90,7 +90,7 @@ && findOnPage("Deployed process definition: 'test_logs_page.bpmn'")) {

public void runTableColumnTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
try {
log.info("------ START LogsTestIT:runTableColumnTest ------");

Expand Down Expand Up @@ -150,7 +150,7 @@ public void runTableColumnTest() throws IOException {
//Disabled test for inconsistency on the refresh in the logs.
public void runOutputRefreshTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver,Duration.ofSeconds(30));
try {
log.info("------ START LogsTestIT:runOutputRefreshTest ------");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.time.Duration;
import java.util.List;

import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
Expand Down Expand Up @@ -58,7 +58,7 @@ public void runProcessesPageTest() {

public void runStatusCompleteTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
try {
log.info("------ START ProcessesTestIT:runStatusCompleteTest ------");

Expand Down
46 changes: 46 additions & 0 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 @@ -274,6 +274,52 @@ public void runHelloWorldTest() {
logout();
log.info("------ END deployTest ------");
}

@Test
public void runGroovyTest() {
log.info("------ START runGroovyTest ------");
gotoLoginPage();
login();
goToPage("deployments");

startProcDef("test_groovy_script", "Test Groovy Script", 90000);

if(findOnPage("completed")) {
goToProcesses();
sleep(1000);
log.info("Found a completed task.");

WebElement completeBox = findElById("complete");
completeBox.click();
sleep(1000);

Select select = new Select(findElById("pd-select"));
select.selectByVisibleText("Test Groovy Script");
sleep(1000);

WebElement filterSubmit = findElById("filter-submit-btn");
filterSubmit.click();
sleep(1000);

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

findOnPage("Groovy.");

sleep(9000);


} else {
log.info("Process did not complete either in time or at all");
}

deleteProc("test_groovy_script");
logout();
log.info("------ END runGroovyTest ------");
}

@Test
public void runProcessTest() {
log.info("------ START runProcessTest ------");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.time.Duration;

import org.junit.Ignore;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
Expand Down Expand Up @@ -191,7 +191,7 @@ public void runNumberActiveTest() throws IOException {

public void runThreadLimitTest() throws IOException {
Boolean scriptPass = false;
WebDriverWait wait = new WebDriverWait(driver,30);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
JavascriptExecutor js = (JavascriptExecutor) driver;
try {
log.info("------ START WorkersTestIT:runThreadLimitTest ------");
Expand Down
Loading

0 comments on commit cd208be

Please sign in to comment.