From 4c37565ed9353d8d322b9ad7b819da2d49591dcd Mon Sep 17 00:00:00 2001 From: Benoit CIVEL Date: Thu, 28 Nov 2024 22:38:55 +0100 Subject: [PATCH 1/2] Condition related to execution (if action executed and returned OK....etc) > support the usage of the condition from a step library --- .../core/crud/entity/TestCaseExecution.java | 18 +++++++++++++++--- .../execution/impl/ExecutionRunService.java | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/source/src/main/java/org/cerberus/core/crud/entity/TestCaseExecution.java b/source/src/main/java/org/cerberus/core/crud/entity/TestCaseExecution.java index be841bd0b..d3cc25bc1 100644 --- a/source/src/main/java/org/cerberus/core/crud/entity/TestCaseExecution.java +++ b/source/src/main/java/org/cerberus/core/crud/entity/TestCaseExecution.java @@ -141,6 +141,7 @@ public class TestCaseExecution { private List fileList; // Host the list of Steps that will be executed (both pre tests and main test) private List testCaseStepExecutionList; + private TestCaseStepExecution testCaseStepInExecution; // Host the full list of data calculated during the execution. private TreeMap testCaseExecutionDataMap; // This is used to keep track of all property calculated within a step/action/control. It is reset each time we enter a step/action/control and the property name is added to the list each time it gets calculated. In case it was already asked for calculation, we stop the execution with FA message. @@ -339,9 +340,20 @@ public TestCaseStepExecution getTestCaseStepExecutionBySortId(int sortID) { } public TestCaseStepExecution getTestCaseStepExecutionByStepId(int stepId) { - for (TestCaseStepExecution tcse : this.testCaseStepExecutionList) { - if (stepId == tcse.getTestCaseStep().getStepId()) { - return tcse; + TestCaseStepExecution tcsee = this.getTestCaseStepInExecution(); + //If step executing if from library, return the step from the library instead + if (tcsee.isUsingLibraryStep()){ + for (TestCaseStepExecution tcse : this.testCaseStepExecutionList) { + if (stepId == tcse.getTestCaseStep().getLibraryStepStepId()) { + return tcse; + } + } + return tcsee; + } else { + for (TestCaseStepExecution tcse : this.testCaseStepExecutionList) { + if (stepId == tcse.getTestCaseStep().getStepId()) { + return tcse; + } } } return null; diff --git a/source/src/main/java/org/cerberus/core/engine/execution/impl/ExecutionRunService.java b/source/src/main/java/org/cerberus/core/engine/execution/impl/ExecutionRunService.java index 5f9e758b8..b53150fa5 100644 --- a/source/src/main/java/org/cerberus/core/engine/execution/impl/ExecutionRunService.java +++ b/source/src/main/java/org/cerberus/core/engine/execution/impl/ExecutionRunService.java @@ -1018,6 +1018,7 @@ private TestCaseStepExecution executeStep(TestCaseStepExecution stepExecution, T List testCaseStepActionList = stepExecution.getTestCaseStep().getActions(); LOG.debug("{}Getting list of actions of the step. {} action(s) to perform.", logPrefix, testCaseStepActionList.size()); + execution.setTestCaseStepInExecution(stepExecution); for (TestCaseStepAction tcAction : testCaseStepActionList) { // Start Execution of TestCaseStepAction From 2f05614218b292f642eef4a135fddf03366369c5 Mon Sep 17 00:00:00 2001 From: Benoit CIVEL Date: Thu, 28 Nov 2024 23:28:20 +0100 Subject: [PATCH 2/2] Fix offset after scroll for IPA and APK --- .../org/cerberus/core/service/appium/impl/AppiumService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/src/main/java/org/cerberus/core/service/appium/impl/AppiumService.java b/source/src/main/java/org/cerberus/core/service/appium/impl/AppiumService.java index b9908639b..1b44c49c5 100644 --- a/source/src/main/java/org/cerberus/core/service/appium/impl/AppiumService.java +++ b/source/src/main/java/org/cerberus/core/service/appium/impl/AppiumService.java @@ -451,7 +451,7 @@ private boolean scrollDown(AppiumDriver driver, By element, int numberOfScrollDo //Element found, perform another scroll to offset from middle of screen int pressOffsetX = driver.manage().window().getSize().width / 2; int pressOffsetY = driver.manage().window().getSize().height / 2; - scroll(driver, pressOffsetX, pressOffsetY, hOffset, vOffset); + scroll(driver, pressOffsetX, pressOffsetY, pressOffsetX-hOffset, pressOffsetY-vOffset); return true; } else {