Skip to content

Commit b4a08b2

Browse files
committed
E2E => set Tjob maxExecution
1 parent 51b54d9 commit b4a08b2

File tree

7 files changed

+32
-23
lines changed

7 files changed

+32
-23
lines changed

e2e-test/src/test/java/io/elastest/etm/test/base/EtmBaseTest.java

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class EtmBaseTest {
7171

7272
protected String tormUrl = "http://172.17.0.1:37000/"; // local by default
7373
protected String secureTorm = "http://user:pass@172.17.0.1:37000/";
74-
protected static final String TSS_PAGE_SUFFIX = "#/support-services";
74+
protected static final String TSS_PAGE_SUFFIX = "#/support-services";
7575
protected String apiPath = "api";
7676
protected String tormApiUrl;
7777
protected String eUser = null;
@@ -183,8 +183,8 @@ protected void navigateToTorm(WebDriver driver) {
183183

184184
protected void navigateToRoot(WebDriver driver) {
185185
log.info("Navigating to Root Path (/)");
186-
driver.findElement(By.xpath(
187-
"//*[@id=\\\"main_nav\\\"]/div/mat-toolbar/span"))
186+
driver.findElement(
187+
By.xpath("//*[@id=\\\"main_nav\\\"]/div/mat-toolbar/span"))
188188
.click();
189189
}
190190

@@ -302,7 +302,7 @@ protected WebElement getElementByXpath(WebDriver driver, String xpath,
302302
} catch (InterruptedException e) {
303303
log.error("Time Slot between actions interrupted.");
304304
}
305-
305+
306306
WebElement element = getElementsByXpath(driver, xpath, secondsTimeout)
307307
.get(0);
308308
if (withScroll) {
@@ -420,7 +420,7 @@ protected void navigateToETProject(WebDriver driver, String projectName) {
420420
}
421421

422422
protected boolean etProjectExists(WebDriver driver, String projectName) {
423-
navigateToProjects(driver);
423+
navigateToProjects(driver);
424424
log.info("Checking if Project {} exists", projectName);
425425
String projectsTableXpath = getProjectsTableXpathFromProjectPage();
426426

@@ -635,7 +635,7 @@ protected boolean etSutExistsIntoTLProject(WebDriver driver,
635635
protected void selectItem(WebDriver driver, String item,
636636
String selectDesc) {
637637
String sutSelectXpath = "//*[@placeholder='" + selectDesc + "']";
638-
638+
639639
this.getElementByXpath(driver, sutSelectXpath).click();
640640

641641
if (item != null) {
@@ -751,20 +751,28 @@ protected void createNewTJob(WebDriver driver, String tJobName,
751751
String testResultPath, String sutName, String dockerImage,
752752
boolean imageCommands, String commands,
753753
Map<String, String> parameters, Map<String, List<String>> tssMap,
754-
Map<String, List<String>> multiConfigurations) {
754+
Map<String, List<String>> multiConfigurations,
755+
Integer maxExecutions) {
755756
log.info("Wait for the \"New TJob\" button");
756757
getElementById(driver, "newTJobBtn").click();
757758

758759
log.info("Creating TJob...");
759760
WebDriverWait waitService2 = new WebDriverWait(driver, 20); //
760-
By serviceFieldTJobName = By.name("tJobName");
761-
waitService2.until(visibilityOfElementLocated(serviceFieldTJobName));
762-
driver.findElement(serviceFieldTJobName).sendKeys(tJobName);
761+
By tJobNameField = By.name("tJobName");
762+
waitService2.until(visibilityOfElementLocated(tJobNameField));
763+
driver.findElement(tJobNameField).sendKeys(tJobName);
763764

764765
if (testResultPath != null) {
765766
driver.findElement(By.name("resultsPath")).sendKeys(testResultPath);
766767
}
767768

769+
if (maxExecutions == null) {
770+
maxExecutions = 5;
771+
}
772+
773+
driver.findElement(By.name("maxExecutions"))
774+
.sendKeys(maxExecutions + "");
775+
768776
// Select SuT
769777
String sutSelectXpath = "//mat-select/div/div/span[contains(string(), 'Select a SuT')]";
770778
this.getElementByXpath(driver, sutSelectXpath).click();
@@ -900,7 +908,7 @@ protected void startTestSupportService(WebDriver driver,
900908

901909
log.info("Create and wait for instance");
902910
getElementById(driver, "create_instance").click();
903-
911+
904912
log.info("Navigate for instance view");
905913
getElementByXpath(driver, "//button[@title='View Service Detail']", 240)
906914
.click();
@@ -991,6 +999,7 @@ public List<WebElement> findElements(
991999
return null;
9921000
}
9931001
}
1002+
9941003
public void setupTestBrowser(TestInfo testInfo, BrowserType browser,
9951004
WebDriver driver) throws MalformedURLException {
9961005
setupTestBrowser(testInfo, browser, "latest", driver);
@@ -1012,7 +1021,7 @@ public void setupTestBrowser(TestInfo testInfo, BrowserType browser,
10121021
caps.setBrowserName("firefox");
10131022
}
10141023
caps.setCapability("testName", testName);
1015-
if (!browserVersion.equals(BROWSER_VERSION_LATEST)){
1024+
if (!browserVersion.equals(BROWSER_VERSION_LATEST)) {
10161025
log.info("Use this browser version: {}", browserVersion);
10171026
caps.setVersion(browserVersion);
10181027
}
@@ -1029,7 +1038,7 @@ public void sleep(long millis) {
10291038
} catch (InterruptedException e) {
10301039
}
10311040
}
1032-
1041+
10331042
protected void deleteTSSInstance(WebDriver driver) {
10341043
WebElement tssId = getElementByXpath(driver,
10351044
"//*[@id=\"tss-instances\"]/div/table/tbody/tr[1]/td[1]/div/span");

e2e-test/src/test/java/io/elastest/etm/test/e2e/demoprojects/EtmFullteachingE2eTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public void fullTeachingBaseTest(WebDriver driver, String tJobName,
212212
if (!etTJobExistsIntoProject(driver, projectName, tJobName)) {
213213

214214
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
215-
tJobImage, false, commands, null, tssMap, null);
215+
tJobImage, false, commands, null, tssMap, null, null);
216216
} else {
217217
navigateToETProject(driver, projectName);
218218
}

e2e-test/src/test/java/io/elastest/etm/test/e2e/demoprojects/EtmOpenViduWebRTCE2eTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void testCreateOpenViduWebRTC(
131131
String commands = "echo \"Cloning project\"; git clone https://github.com/elastest/demo-projects; cd demo-projects/openvidu-test; echo \"Compiling project\"; mvn -DskipTests=true -B package; echo \"Executing test\"; mvn -B test;";
132132

133133
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
134-
tJobImage, false, commands, null, tssMap, null);
134+
tJobImage, false, commands, null, tssMap, null, null);
135135
}
136136
// Run TJob
137137
runTJobFromProjectPage(driver, tJobName);

e2e-test/src/test/java/io/elastest/etm/test/e2e/demoprojects/EtmRestApiE2eTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void testCreateRestTest(
7979
String commands = "git clone https://github.com/elastest/demo-projects; cd /demo-projects/rest/junit5-rest-test; mvn -B test";
8080

8181
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
82-
tJobImage, false, commands, null, null, null);
82+
tJobImage, false, commands, null, null, null, null);
8383
}
8484

8585
// Run the TJob and check its result

e2e-test/src/test/java/io/elastest/etm/test/e2e/demoprojects/EtmUnitTestE2eTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void testCreateUnitTest(
7070
String tJobImage = "elastest/test-etm-alpinegitjava";
7171
String commands = "git clone https://github.com/elastest/demo-projects; cd /demo-projects/unit/junit5-unit-test; mvn -B test;";
7272
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
73-
tJobImage, false, commands, null, null, null);
73+
tJobImage, false, commands, null, null, null, null);
7474
}
7575
// Run the TJob and check its result
7676
runTJobFromProjectPage(driver, tJobName);

e2e-test/src/test/java/io/elastest/etm/test/e2e/demoprojects/EtmWebappE2eTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void testCreateChromeTest(
9494
String commands = "git clone https://github.com/elastest/demo-projects; cd /demo-projects/webapp/junit5-web-multiple-browsers-test; mvn -Dtest=WebAppTest -B -Dbrowser=chrome test;";
9595

9696
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
97-
tJobImage, false, commands, null, tssMap, null);
97+
tJobImage, false, commands, null, tssMap, null, null);
9898
}
9999
// Run TJob
100100
runTJobFromProjectPage(driver, tJobName);
@@ -125,7 +125,7 @@ void testCreateFirefoxTest(
125125
String commands = "git clone https://github.com/elastest/demo-projects; cd /demo-projects/webapp/junit5-web-multiple-browsers-test; mvn -Dtest=WebAppTest -B -Dbrowser=firefox test;";
126126

127127
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
128-
tJobImage, false, commands, null, tssMap, null);
128+
tJobImage, false, commands, null, tssMap, null, null);
129129
}
130130
// Run TJob
131131
runTJobFromProjectPage(driver, tJobName);
@@ -156,7 +156,7 @@ void testCreateMultiTest(
156156

157157
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
158158
tJobImage, false, commands, null, tssMap,
159-
multiConfigurations);
159+
multiConfigurations, null);
160160
}
161161
// Run TJob
162162
runTJobFromProjectPage(driver, tJobName);

e2e-test/src/test/java/io/elastest/etm/test/e2e/monitoring/StableMonitorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void testCreateChromeTest(TestInfo testInfo)
8686
String commands = "git clone https://github.com/elastest/demo-projects; cd /demo-projects/webapp/junit5-web-multiple-browsers-test; mvn -Dtest=WebAppTest -B -Dbrowser=chrome test;";
8787

8888
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
89-
tJobImage, false, commands, null, tssMap, null);
89+
tJobImage, false, commands, null, tssMap, null, null);
9090
}
9191
// Run TJob
9292
runTJobFromProjectPage(driver, tJobName);
@@ -112,7 +112,7 @@ void testCreateFirefoxTest(
112112
String commands = "git clone https://github.com/elastest/demo-projects; cd /demo-projects/webapp/junit5-web-multiple-browsers-test; mvn -Dtest=WebAppTest -B -Dbrowser=firefox test;";
113113

114114
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
115-
tJobImage, false, commands, null, tssMap, null);
115+
tJobImage, false, commands, null, tssMap, null, null);
116116
}
117117
// Run TJob
118118
runTJobFromProjectPage(driver, tJobName);
@@ -144,7 +144,7 @@ void testCreateMultiTest(
144144

145145
createNewTJob(driver, tJobName, tJobTestResultPath, sutName,
146146
tJobImage, false, commands, null, tssMap,
147-
multiConfigurations);
147+
multiConfigurations, null);
148148
}
149149
// Run TJob
150150
runTJobFromProjectPage(driver, tJobName);

0 commit comments

Comments
 (0)