Skip to content

Commit 266f52b

Browse files
Merge pull request #60 from testsigmahq/dev
1.6.1 Release
2 parents 9c8e919 + 3fbed47 commit 266f52b

File tree

76 files changed

+898
-324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+898
-324
lines changed

agent/src/main/resources/agent.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
cloud.url=${CLOUD_URL:https://local.testsigmaos.com}
1010
local.server.url=${LOCAL_SERVER_URL:http://localhost:9090}
1111
local.agent.register=${LOCAL_AGENT_REGISTER:true}
12-
agent.version=1.6.0
12+
agent.version=1.6.1

automator/src/com/testsigma/automator/actions/Action.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.testsigma.automator.constants.ActionResult;
1313
import com.testsigma.automator.entity.AttributePropertiesEntity;
1414
import com.testsigma.automator.entity.ElementPropertiesEntity;
15+
import com.testsigma.automator.entity.TestDataProfileEntity;
1516
import com.testsigma.automator.entity.TestDataPropertiesEntity;
1617
import com.testsigma.automator.exceptions.AutomatorException;
1718
import com.testsigma.automator.actions.constants.ErrorCodes;
@@ -44,6 +45,7 @@ public abstract class Action {
4445
protected Map<String, String> testDataParams = new HashMap<>();
4546
protected Map<String, Object> additionalData = new HashMap<>();
4647
protected Map<String, String> envSettings = new HashMap<>();
48+
private TestDataProfileEntity testDataProfileEntity;
4749
@Getter
4850
protected String errorMessage;
4951
@Getter
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.testsigma.automator.actions.web.store;
2+
3+
import com.testsigma.automator.actions.ElementAction;
4+
import com.testsigma.automator.exceptions.AutomatorException;
5+
import org.apache.commons.lang3.StringUtils;
6+
7+
public class StoreCurrentTestDataProfileNameNlpSnippet extends ElementAction {
8+
private static final String SUCCESS_MESSAGE = "Successfully test data index is saved into run time variable<br><b>%s</b>";
9+
private static final String ERROR_MESSAGE = "Invalid TestData profile is selected <b>%s</b>";
10+
11+
@Override
12+
protected void execute() throws Exception {
13+
if(StringUtils.isEmpty(this.getTestDataProfileEntity().getTestDataProfile())){
14+
throw new AutomatorException(String.format(ERROR_MESSAGE, this.getTestDataProfileEntity().getTestDataProfile()));
15+
}
16+
runtimeDataProvider.storeRuntimeVariable(getAttribute(), this.getTestDataProfileEntity().getTestDataProfile());
17+
resultMetadata.put(getAttribute(), this.getTestDataProfileEntity().getTestDataProfile());
18+
setSuccessMessage(String.format(SUCCESS_MESSAGE, this.getTestDataProfileEntity().getTestDataProfile()));
19+
}
20+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.testsigma.automator.actions.web.store;
2+
3+
4+
import com.testsigma.automator.actions.ElementAction;
5+
import com.testsigma.automator.exceptions.AutomatorException;
6+
import org.apache.commons.lang3.StringUtils;
7+
8+
public class StoreCurrentTestDataSetNameNlpSnippet extends ElementAction {
9+
private static final String SUCCESS_MESSAGE = "Successfully test data set is saved to run time variable<br><b>%s</b>";
10+
private static final String ERROR_MESSAGE = "Invalid TestData set name <b>%s</b>";
11+
private static final String ERROR_TEST_CASE_MESSAGE = "Test data profile is not associated";
12+
13+
14+
@Override
15+
protected void execute() throws Exception {
16+
if(this.getTestDataProfileEntity().getTestDataSetName() == null){
17+
throw new AutomatorException(String.format(ERROR_TEST_CASE_MESSAGE));
18+
}
19+
20+
if(StringUtils.isEmpty(this.getTestDataProfileEntity().getTestDataSetName())){
21+
throw new AutomatorException(String.format(ERROR_MESSAGE, this.getTestDataProfileEntity().getTestDataSetName()));
22+
}
23+
runtimeDataProvider.storeRuntimeVariable(getAttribute(), this.getTestDataProfileEntity().getTestDataSetName());
24+
resultMetadata.put(getAttribute(), this.getTestDataProfileEntity().getTestDataSetName());
25+
setSuccessMessage(String.format(SUCCESS_MESSAGE, this.getTestDataProfileEntity().getTestDataSetName()));
26+
}
27+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.testsigma.automator.actions.web.store;
2+
3+
4+
import com.testsigma.automator.actions.ElementAction;
5+
import com.testsigma.automator.exceptions.AutomatorException;
6+
7+
public class StoreCurrentTestDatasetIndexNlpSnippet extends ElementAction {
8+
private static final String SUCCESS_MESSAGE = "Successfully test data index is saved into run time variable<br><b>%s</b>";
9+
private static final String ERROR_MESSAGE = "Invalid TestData Index <b>%s</b>";
10+
private static final String ERROR_TEST_CASE_MESSAGE = "Test data profile is not associated";
11+
@Override
12+
protected void execute() throws Exception {
13+
Integer testDataIndex = this.getTestDataProfileEntity().getTestDataIndex();
14+
if(this.getTestDataProfileEntity().getTestDataSetName() == null){
15+
throw new AutomatorException(String.format(ERROR_TEST_CASE_MESSAGE));
16+
}
17+
if(testDataIndex == null || testDataIndex <0){
18+
throw new AutomatorException(String.format(ERROR_MESSAGE, testDataIndex!= null ? testDataIndex+1 : testDataIndex));
19+
}
20+
testDataIndex = testDataIndex+1;
21+
runtimeDataProvider.storeRuntimeVariable(getAttribute(), testDataIndex.toString());
22+
resultMetadata.put(getAttribute(), testDataIndex.toString());
23+
setSuccessMessage(String.format(SUCCESS_MESSAGE, testDataIndex.toString()));
24+
}
25+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.testsigma.automator.actions.web.store;
2+
3+
4+
import com.testsigma.automator.actions.ElementAction;
5+
import com.testsigma.automator.constants.NaturalTextActionConstants;
6+
import com.testsigma.automator.exceptions.AutomatorException;
7+
8+
import java.lang.reflect.InvocationTargetException;
9+
10+
public class StoreTestDataProxyNlpSnippet extends ElementAction {
11+
protected static final String FAILURE_MESSAGE = "Unable to Perform Store Action due to " +
12+
"invalid selectable test data. It accepts only Name/SetIndex/SetName/etc. provided in the list";
13+
14+
@Override
15+
public void execute() throws Exception {
16+
String status = getTestData();
17+
switch (status) {
18+
case NaturalTextActionConstants.TEST_DATA_NAME:
19+
StoreCurrentTestDataProfileNameNlpSnippet presence = (StoreCurrentTestDataProfileNameNlpSnippet) this.initializeChildSnippet(StoreCurrentTestDataProfileNameNlpSnippet.class);
20+
presence.execute();
21+
this.setSuccessMessage(presence.getSuccessMessage());
22+
break;
23+
case NaturalTextActionConstants.SET_INDEX:
24+
StoreCurrentTestDatasetIndexNlpSnippet absence = (StoreCurrentTestDatasetIndexNlpSnippet) this.initializeChildSnippet(StoreCurrentTestDatasetIndexNlpSnippet.class);
25+
absence.execute();
26+
this.setSuccessMessage(absence.getSuccessMessage());
27+
break;
28+
case NaturalTextActionConstants.SET_NAME:
29+
StoreCurrentTestDataSetNameNlpSnippet notDisplayed = (StoreCurrentTestDataSetNameNlpSnippet) this.initializeChildSnippet(StoreCurrentTestDataSetNameNlpSnippet.class);
30+
notDisplayed.execute();
31+
this.setSuccessMessage(notDisplayed.getSuccessMessage());
32+
break;
33+
default:
34+
setErrorMessage(FAILURE_MESSAGE);
35+
throw new AutomatorException(FAILURE_MESSAGE);
36+
}
37+
}
38+
39+
40+
protected Object initializeChildSnippet(Class<?> snippetClassName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
41+
ElementAction snippet = (ElementAction) snippetClassName.getDeclaredConstructor().newInstance();
42+
snippet.setDriver(this.getDriver());
43+
snippet.setElement(this.getElement());
44+
snippet.setElementPropertiesEntityMap(this.getElementPropertiesEntityMap());
45+
snippet.setTestDataPropertiesEntityMap(this.getTestDataPropertiesEntityMap());
46+
snippet.setAttributesMap(this.getAttributesMap());
47+
snippet.setRuntimeDataProvider(this.getRuntimeDataProvider());
48+
snippet.setEnvSettings(this.getEnvSettings());
49+
snippet.setTimeout(this.getTimeout());
50+
snippet.setGlobalElementTimeOut(this.getGlobalElementTimeOut());
51+
snippet.setActualValue(this.getActualValue());
52+
snippet.setAdditionalData(this.getAdditionalData());
53+
snippet.setTestDataProfileEntity(this.getTestDataProfileEntity());
54+
return snippet;
55+
56+
}
57+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package com.testsigma.automator.constants;
22

33
public enum AddonActionParameterType {
4-
ELEMENT, TEST_DATA
4+
ELEMENT, TEST_DATA, TEST_DATA_PROFILE, TEST_DATA_SET, ENVIRONMENT_DATA
55
}

automator/src/com/testsigma/automator/constants/NaturalTextActionConstants.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ public class NaturalTextActionConstants {
2727
public final static String DISABLED = "disabled";
2828
public final static String CHECKED = "checked";
2929
public final static String UN_CHECKED = "unchecked";
30+
public final static String TEST_DATA_NAME = "Test Data Profile Name";
31+
public final static String SET_INDEX = "Test Data Set Index";
32+
public final static String SET_NAME = "Test Data Set Name";
33+
public final static String RUNTIME_TEST_DATA_ID= "TestDataId";
3034
}

automator/src/com/testsigma/automator/entity/TestCaseStepEntity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public class TestCaseStepEntity implements Cloneable {
3838
private String testDataType;
3939
private String testDataName;
4040
private String testDataValue;
41+
private Long testDataId;
42+
private Integer testDataIndex;
43+
private String setName;
4144
private String testDataValuePreSignedURL;
4245
private String locatorStrategy;
4346
private String attribute;
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package com.testsigma.automator.entity;
22

3+
import lombok.AllArgsConstructor;
34
import lombok.Data;
45

56
@Data
7+
@AllArgsConstructor
68
public class TestDataProfileEntity {
7-
private String testDataName;
8-
private String testData;
9+
private Integer testDataIndex;
10+
private String testDataSetName;
11+
private String testDataProfile;
912
}

0 commit comments

Comments
 (0)