Skip to content

Commit

Permalink
* new options on actions and controls in order to force screenshot be…
Browse files Browse the repository at this point in the history
…fore and after (that avoid the necessary takeScreenshot control)

* new options on actions and controls in order to add a wait in ms before and after (that avoid the necessary wait action). This is to be used with care as Cerberus already wait for an element before interacting with it.
  • Loading branch information
vertigo17 committed Jan 29, 2024
1 parent 0942cb9 commit 0022137
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ public void insertTestCaseStepActionControl(TestCaseStepActionControl testCaseSt
boolean throwExcep = false;
StringBuilder query = new StringBuilder();
query.append("INSERT INTO testcasestepactioncontrol (`test`, `testcase`, `stepId`, `actionId`, `controlId`, `sort`, ");
query.append("`conditionOperator`, `conditionValue1`, `conditionValue2`, `conditionValue3`, `conditionOptions`, `control`, `value1`, `value2`, `value3`, `options`, `isFatal`, `Description`, `screenshotfilename`) ");
query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
query.append("`conditionOperator`, `conditionValue1`, `conditionValue2`, `conditionValue3`, `conditionOptions`, `control`, `value1`, `value2`, `value3`, `options`, `isFatal`, `Description`, `screenshotfilename`, `waitBefore`, `waitAfter`, `doScreenshotBefore`, `doScreenshotAfter`) ");
query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

// Debug message on SQL.
if (LOG.isDebugEnabled()) {
Expand Down Expand Up @@ -172,6 +172,10 @@ public void insertTestCaseStepActionControl(TestCaseStepActionControl testCaseSt
preStat.setBoolean(i++, testCaseStepActionControl.isFatal());
preStat.setString(i++, testCaseStepActionControl.getDescription());
preStat.setString(i++, testCaseStepActionControl.getScreenshotFilename());
preStat.setInt(i++, testCaseStepActionControl.getWaitBefore());
preStat.setInt(i++, testCaseStepActionControl.getWaitAfter());
preStat.setBoolean(i++, testCaseStepActionControl.isDoScreenshotBefore());
preStat.setBoolean(i++, testCaseStepActionControl.isDoScreenshotAfter());
throwExcep = preStat.executeUpdate() == 0;
} catch (SQLException exception) {
LOG.warn("Unable to execute query : " + exception.toString());
Expand Down Expand Up @@ -236,6 +240,10 @@ public void updateTestCaseStepActionControl(TestCaseStepActionControl testCaseSt
.append("`Description` = ?, ")
.append("`IsFatal` = ?, ")
.append("`screenshotFilename` = ?, ")
.append("`waitBefore` = ?, ")
.append("`waitAfter` = ?, ")
.append("`doScreenshotBefore` = ?, ")
.append("`doScreenshotAfter` = ?, ")
.append("`usrModif` = ?,")
.append("`dateModif` = CURRENT_TIMESTAMP ")
.append("WHERE `Test` = ? AND `Testcase` = ? AND `StepId` = ? AND `ActionId` = ? AND `ControlId` = ? ")
Expand Down Expand Up @@ -270,6 +278,10 @@ public void updateTestCaseStepActionControl(TestCaseStepActionControl testCaseSt
preStat.setString(i++, testCaseStepActionControl.getDescription());
preStat.setBoolean(i++, testCaseStepActionControl.isFatal());
preStat.setString(i++, testCaseStepActionControl.getScreenshotFilename());
preStat.setInt(i++, testCaseStepActionControl.getWaitBefore());
preStat.setInt(i++, testCaseStepActionControl.getWaitAfter());
preStat.setBoolean(i++, testCaseStepActionControl.isDoScreenshotBefore());
preStat.setBoolean(i++, testCaseStepActionControl.isDoScreenshotAfter());
preStat.setString(i++, testCaseStepActionControl.getUsrModif() == null ? "" : testCaseStepActionControl.getUsrModif());
preStat.setString(i++, testCaseStepActionControl.getTest());
preStat.setString(i++, testCaseStepActionControl.getTestcase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ public void createTestCaseStepAction(TestCaseStepAction testCaseStepAction) thro
StringBuilder query = new StringBuilder();
query.append("INSERT INTO testcasestepaction (`test`, `testcase`, `stepId`, `actionId`, `sort`, ")
.append("`conditionOperator`, `conditionValue1`, `conditionValue2`, `conditionValue3`, `conditionOptions`, `action`, ")
.append("`value1`, `value2`, `value3`, `options`, `IsFatal`, `description`, `screenshotfilename`, `usrCreated`) ");
query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
.append("`value1`, `value2`, `value3`, `options`, `IsFatal`, `description`, `screenshotfilename`, `waitBefore`, `waitAfter`, `doScreenshotBefore`, `doScreenshotAfter`, `usrCreated`) ");
query.append("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

// Debug message on SQL.
if (LOG.isDebugEnabled()) {
Expand Down Expand Up @@ -329,6 +329,10 @@ public void createTestCaseStepAction(TestCaseStepAction testCaseStepAction) thro
preStat.setBoolean(i++, testCaseStepAction.isFatal());
preStat.setString(i++, testCaseStepAction.getDescription());
preStat.setString(i++, testCaseStepAction.getScreenshotFilename());
preStat.setInt(i++, testCaseStepAction.getWaitBefore());
preStat.setInt(i++, testCaseStepAction.getWaitAfter());
preStat.setBoolean(i++, testCaseStepAction.isDoScreenshotBefore());
preStat.setBoolean(i++, testCaseStepAction.isDoScreenshotAfter());
preStat.setString(i++, testCaseStepAction.getUsrCreated() == null ? "" : testCaseStepAction.getUsrCreated());

preStat.executeUpdate();
Expand Down Expand Up @@ -360,6 +364,10 @@ public void update(TestCaseStepAction testCaseStepAction) throws CerberusExcepti
.append("`IsFatal` = ?, ")
.append("`Description` = ?, ")
.append("`ScreenshotFilename` = ?, ")
.append("`waitBefore` = ?, ")
.append("`waitAfter` = ?, ")
.append("`doScreenshotBefore` = ?, ")
.append("`doScreenshotAfter` = ?, ")
.append("`UsrModif` = ?, ")
.append("`dateModif` = CURRENT_TIMESTAMP ")
.append("WHERE `Test` = ? AND `Testcase` = ? AND `StepId` = ? AND `actionId` = ? ")
Expand Down Expand Up @@ -394,6 +402,10 @@ public void update(TestCaseStepAction testCaseStepAction) throws CerberusExcepti
preStat.setBoolean(i++, testCaseStepAction.isFatal());
preStat.setString(i++, testCaseStepAction.getDescription());
preStat.setString(i++, testCaseStepAction.getScreenshotFilename());
preStat.setInt(i++, testCaseStepAction.getWaitBefore());
preStat.setInt(i++, testCaseStepAction.getWaitAfter());
preStat.setBoolean(i++, testCaseStepAction.isDoScreenshotBefore());
preStat.setBoolean(i++, testCaseStepAction.isDoScreenshotAfter());
preStat.setString(i++, testCaseStepAction.getUsrModif() == null ? "" : testCaseStepAction.getUsrModif());

preStat.setString(i++, testCaseStepAction.getTest());
Expand Down
Loading

0 comments on commit 0022137

Please sign in to comment.