How to use DeprecatedActionMapper class of com.testsigma.util package

Best Testsigma code snippet using com.testsigma.util.DeprecatedActionMapper

Source:TestStepService.java Github

copy

Full Screen

...20import com.testsigma.repository.TestStepRepository;21import com.testsigma.specification.SearchCriteria;22import com.testsigma.specification.SearchOperation;23import com.testsigma.specification.TestStepSpecificationsBuilder;24import com.testsigma.util.DeprecatedActionMapper;25import lombok.AllArgsConstructor;26import lombok.Data;27import lombok.RequiredArgsConstructor;28import lombok.extern.log4j.Log4j2;29import org.apache.commons.lang3.StringUtils;30import org.apache.poi.xssf.usermodel.XSSFWorkbook;31import org.springframework.beans.factory.annotation.Autowired;32import org.springframework.context.ApplicationEventPublisher;33import org.springframework.context.annotation.Lazy;34import org.springframework.data.domain.Page;35import org.springframework.data.domain.PageRequest;36import org.springframework.data.domain.Pageable;37import org.springframework.data.jpa.domain.Specification;38import org.springframework.stereotype.Service;39import java.io.IOException;40import java.util.*;41import java.util.stream.Collectors;42@Service43@Log4j244@RequiredArgsConstructor(onConstructor = @__({@Autowired, @Lazy}))45public class TestStepService extends XMLExportImportService<TestStep> {46 private final TestStepRepository repository;47 private final RestStepService restStepService;48 private final RestStepMapper mapper;49 private final ProxyAddonService addonService;50 private final AddonNaturalTextActionService addonNaturalTextActionService;51 private final ApplicationEventPublisher applicationEventPublisher;52 private final TestCaseService testCaseService;53 private final TestStepMapper exportTestStepMapper;54 private final TestDataProfileService testDataService;55 private final NaturalTextActionsService naturalTextActionsService;56 private final DefaultDataGeneratorService defaultDataGeneratorService;57 private final ImportAffectedTestCaseXLSExportService affectedTestCaseXLSExportService;58 private final List<ActionTestDataMap> actionTestDataMap = getMapsList();59 private final List<Integer> depreciatedIds = DeprecatedActionMapper.getAllDeprecatedActionIds();60 public List<TestStep> findAllByTestCaseId(Long testCaseId) {61 return this.repository.findAllByTestCaseIdOrderByPositionAsc(testCaseId);62 }63 public List<TestStep> findAllByTestCaseIdAndEnabled(Long testCaseId) {64 List<TestStep> testSteps = repository.findAllByTestCaseIdAndDisabledIsNotOrderByPositionAsc(testCaseId, true);65 List<TestStep> stepGroups = repository.findAllByTestCaseIdAndDisabledIsNotAndStepGroupIdIsNotNullOrderByPositionAsc(testCaseId, true);66 for (TestStep teststep : stepGroups) {67 if (teststep.getStepGroup() != null) {68 List<TestStep> groupsSteps = repository.findAllByTestCaseIdAndDisabledIsNotOrderByPositionAsc(teststep.getStepGroupId(), true);69 teststep.getStepGroup().setTestSteps(new HashSet<>(groupsSteps));70 }71 }72 return testSteps;73 }74 public List<String> findElementNamesByTestCaseIds(List<Long> testCaseIds) {75 List<String> ElementNames = repository.findTestStepsByTestCaseIdIn(testCaseIds);76 return ElementNames.stream().map(x -> StringUtils.strip(x, "\"")).collect(Collectors.toList());77 }78 public List<String> findAddonActionElementsByTestCaseIds(List<Long> testCaseIds) {79 List<String> elementsNames = new ArrayList<>();80 List<TestStep> testSteps = repository.findAllByTestCaseIdInAndAddonActionIdIsNotNull(testCaseIds);81 for (TestStep step : testSteps) {82 Map<String, AddonElementData> addonElementData = step.getAddonElements();83 if (step.getAddonElements() != null) {84 for (AddonElementData elementData : addonElementData.values()) {85 elementsNames.add(elementData.getName());86 }87 }88 }89 return elementsNames;90 }91 public Page<TestStep> findAll(Specification<TestStep> spec, Pageable pageable) {92 return this.repository.findAll(spec, pageable);93 }94 public void destroy(TestStep testStep) throws ResourceNotFoundException {95 repository.decrementPosition(testStep.getPosition(), testStep.getTestCaseId());96 repository.delete(testStep);97 if (testStep.getAddonActionId() != null) {98 AddonNaturalTextAction addonNaturalTextAction = addonNaturalTextActionService.findById(testStep.getAddonActionId());99 addonService.notifyActionNotUsing(addonNaturalTextAction);100 }101 publishEvent(testStep, EventType.DELETE);102 }103 public TestStep find(Long id) throws ResourceNotFoundException {104 return this.repository.findById(id).orElseThrow(() -> new ResourceNotFoundException("TestStep missing with id:" + id));105 }106 private TestStep updateDetails(TestStep testStep) {107 RestStep restStep = testStep.getRestStep();108 testStep.setRestStep(null);109 testStep = this.repository.save(testStep);110 if (restStep != null) {111 restStep.setStepId(testStep.getId());112 restStep = this.restStepService.update(restStep);113 testStep.setRestStep(restStep);114 }115 return testStep;116 }117 public TestStep update(TestStep testStep) {118 testStep = updateDetails(testStep);119 this.updateDisablePropertyForChildSteps(testStep);120 publishEvent(testStep, EventType.UPDATE);121 return testStep;122 }123 private void updateDisablePropertyForChildSteps(TestStep testStep) {124 List<TestStep> childSteps = this.repository.findAllByParentIdOrderByPositionAsc(testStep.getId());125 if (childSteps.size() > 0) {126 for (TestStep childStep : childSteps) {127 childStep.setDisabled(testStep.getDisabled());128 this.update(childStep);129 }130 }131 }132 public TestStep create(TestStep testStep) throws ResourceNotFoundException {133 this.repository.incrementPosition(testStep.getPosition(), testStep.getTestCaseId());134 RestStep restStep = testStep.getRestStep();135 testStep.setRestStep(null);136 testStep = this.repository.save(testStep);137 if (restStep != null) {138 RestStep newRestStep = mapper.mapStep(restStep);139 newRestStep.setStepId(testStep.getId());140 newRestStep = this.restStepService.create(newRestStep);141 testStep.setRestStep(newRestStep);142 }143 if (testStep.getAddonActionId() != null) {144 AddonNaturalTextAction addonNaturalTextAction = addonNaturalTextActionService.findById(testStep.getAddonActionId());145 addonService.notifyActionUsing(addonNaturalTextAction);146 }147 publishEvent(testStep, EventType.CREATE);148 return testStep;149 }150 public void bulkUpdateProperties(Long[] ids, TestStepPriority testStepPriority, Integer waitTime, Boolean disabled,151 Boolean ignoreStepResult,Boolean visualEnabled) {152 this.repository.bulkUpdateProperties(ids, testStepPriority != null ? testStepPriority.toString() : null, waitTime,visualEnabled);153 if (disabled != null || ignoreStepResult != null)154 this.bulkUpdateDisableAndIgnoreResultProperties(ids, disabled, ignoreStepResult);155 }156 private void bulkUpdateDisableAndIgnoreResultProperties(Long[] ids, Boolean disabled, Boolean ignoreStepResult) {157 List<TestStep> testSteps = this.repository.findAllByIdInOrderByPositionAsc(ids);158 for (TestStep testStep : testSteps) {159 if (disabled != null) {160 if (!disabled && testStep.getParentStep() == null) {161 testStep.setDisabled(false);162 } else if (!disabled && testStep.getParentStep() != null) {163 testStep.setDisabled(testStep.getParentStep().getDisabled());164 } else {165 testStep.setDisabled(disabled);166 }167 }168 if (ignoreStepResult != null) {169 testStep.setIgnoreStepResult(ignoreStepResult);170 }171 this.updateDetails(testStep);172 }173 }174 public List<TestStep> findAllByTestCaseIdAndIdIn(Long testCaseId, List<Long> stepIds) {175 return this.repository.findAllByTestCaseIdAndIdInOrderByPosition(testCaseId, stepIds);176 }177 public void updateTestDataParameterName(Long testDataId, String parameter, String newParameterName) {178 this.repository.updateTopLevelTestDataParameter(newParameterName, parameter, testDataId);179 List<TestStep> topConditionalSteps = this.repository.getTopLevelConditionalStepsExceptLoop(testDataId);180 for (TestStep step : topConditionalSteps) {181 updateChildLoops(step.getId(), parameter, newParameterName);182 }183 List<TestStep> loopSteps = this.repository.getAllLoopSteps(testDataId);184 for (TestStep step : loopSteps) {185 updateChildLoops(step.getId(), parameter, newParameterName);186 }187 }188 public void updateElementName(String oldName, String newName) {189 this.repository.updateElementName(newName, oldName);190 }191 private void updateChildLoops(Long parentId, String parameter, String newParameterName) {192 this.repository.updateChildStepsTestDataParameter(newParameterName, parameter, parentId);193 this.repository.updateChildStepsTestDataParameterUsingTestDataProfileId(newParameterName, parameter, parentId);194 List<TestStep> conditionalSteps = this.repository.getChildConditionalStepsExceptLoop(parentId);195 for (TestStep step : conditionalSteps) {196 updateChildLoops(step.getId(), parameter, newParameterName);197 }198 }199 public List<TestStep> findAllByTestCaseIdAndNaturalTextActionIds(Long id, List<Integer> ids) {200 return this.repository.findAllByTestCaseIdAndNaturalTextActionIdIn(id, ids);201 }202 public Integer countAllByAddonActionIdIn(List<Long> ids) {203 return this.repository.countAllByAddonActionIdIn(ids);204 }205 public void updateAddonElementsName(String oldName, String newName) {206 List<TestStep> testSteps = this.repository.findAddonElementsByName(oldName);207 testSteps.forEach(testStep -> {208 Map<String, AddonElementData> elements = testStep.getAddonElements();209 for (Map.Entry<String, AddonElementData> entry : elements.entrySet()) {210 if (entry.getValue().getName().equals(oldName)) {211 entry.getValue().setName(newName);212 }213 }214 testStep.setAddonElements(elements);215 this.repository.save(testStep);216 });217 }218 public void export(BackupDTO backupDTO) throws IOException, ResourceNotFoundException {219 if (!backupDTO.getIsTestStepEnabled()) return;220 log.debug("backup process for test step initiated");221 writeXML("test_steps", backupDTO, PageRequest.of(0, 25));222 log.debug("backup process for test step completed");223 }224 public Specification<TestStep> getExportXmlSpecification(BackupDTO backupDTO) {225 List<TestCase> testCaseList = testCaseService.findAllByWorkspaceVersionId(backupDTO.getWorkspaceVersionId());226 List<Long> testcaseIds = testCaseList.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());227 SearchCriteria criteria = new SearchCriteria("testCaseId", SearchOperation.IN, testcaseIds);228 List<SearchCriteria> params = new ArrayList<>();229 params.add(criteria);230 TestStepSpecificationsBuilder testStepSpecificationsBuilder = new TestStepSpecificationsBuilder();231 testStepSpecificationsBuilder.params = params;232 return testStepSpecificationsBuilder.build();233 }234 @Override235 protected List<TestStepXMLDTO> mapToXMLDTOList(List<TestStep> list) {236 return exportTestStepMapper.mapTestSteps(list);237 }238 public void publishEvent(TestStep testSuite, EventType eventType) {239 TestStepEvent<TestStep> event = createEvent(testSuite, eventType);240 log.info("Publishing event - " + event.toString());241 applicationEventPublisher.publishEvent(event);242 }243 public TestStepEvent<TestStep> createEvent(TestStep testSuite, EventType eventType) {244 TestStepEvent<TestStep> event = new TestStepEvent<>();245 event.setEventData(testSuite);246 event.setEventType(eventType);247 return event;248 }249 private void generateXLSheet(BackupDTO importDTO){250 HashMap<TestStep, String> stepsMap= this.affectedTestCaseXLSExportService.getStepsMap();251 if (stepsMap !=null && !stepsMap.isEmpty()) {252 XSSFWorkbook workbook = this.affectedTestCaseXLSExportService.initializeWorkBook();253 try {254 this.affectedTestCaseXLSExportService.addToExcelSheet(stepsMap, workbook, importDTO, 1);255 } catch (Exception e) {256 log.error(e.getMessage());257 }258 }259 }260 public void importXML(BackupDTO importDTO) throws IOException, ResourceNotFoundException {261 if (!importDTO.getIsTestStepEnabled()) return;262 log.debug("import process for Test step initiated");263 this.affectedTestCaseXLSExportService.setStepsMap(new HashMap<>());264 importFiles("test_steps", importDTO);265 generateXLSheet(importDTO);266 log.debug("import process for Test step completed");267 }268 @Override269 public List<TestStep> readEntityListFromXmlData(String xmlData, XmlMapper xmlMapper, BackupDTO importDTO) throws JsonProcessingException, ResourceNotFoundException {270 if (importDTO.getIsCloudImport()) {271 List<TestStep> steps = mapper.mapTestStepsCloudList(xmlMapper.readValue(xmlData, new TypeReference<List<TestStepCloudXMLDTO>>() {272 }));273 HashMap<TestStep, String> stepsMap= this.affectedTestCaseXLSExportService.getStepsMap();274 for (TestStep step : steps) {275 String message =null;276 try {277 if (step.getAddonActionId() != null && step.getAddonActionId() > 0) {278 message = "Not supported Addon Step!";279 addonNaturalTextActionService.findById(step.getAddonActionId());280 }281 if (step.getNaturalTextActionId() != null && step.getNaturalTextActionId() > 0) {282 if (step.getNaturalTextActionId()==574){ //// TODO: need to changes on Cloud side [Siva Nagaraju]283 step.setNaturalTextActionId(1038);284 continue;285 }286 message = "Deprecated Action!";287 try {288 naturalTextActionsService.findById(Long.valueOf(step.getNaturalTextActionId()));289 }290 catch (Exception e){291 if (this.depreciatedIds.contains(step.getNaturalTextActionId()))292 this.mapDeprecatedActionsWithUpdatesOnes(step);293 else {294 log.error(e.getMessage() + " and Not able to Map this Action Id with the Mapper");295 step.setDisabled(true);296 step.setAddonActionId(null);297 stepsMap.put(step, message);298 }299 }300 }301 if (Objects.equals(step.getTestDataType(), TestDataType.function.getDispName()) && step.getType() != TestStepType.CUSTOM_FUNCTION) {302 message = "Deprecated Data Generator / Data Generator not found!";303 defaultDataGeneratorService.find(step.getTestDataFunctionId());304 }305 } catch (Exception e) {306 log.error(e.getMessage());307 step.setDisabled(true);308 step.setAddonActionId(null);309 stepsMap.put(step, message);310 log.info("disabling test steps having template id or addon action id or custom function id is not found!");311 }312 if (step.getType() == TestStepType.CUSTOM_FUNCTION) {313 step.setDisabled(true);314 stepsMap.put(step, "Custom Functions not supported in OS");315 log.info("disabling Custom function test step to avoid further issues, since CSFs are deprecated");316 }317 if (step.getType() == TestStepType.FOR_LOOP) {318 Optional<TestData> testData = testDataService.getRecentImportedEntity(importDTO, step.getForLoopTestDataId());319 if (testData.isPresent())320 step.setForLoopTestDataId(testData.get().getId());321 }322 }323 return steps;324 } else {325 List<TestStep> steps = mapper.mapTestStepsList(xmlMapper.readValue(xmlData, new TypeReference<List<TestStepXMLDTO>>() {326 }));327 for (TestStep step : steps) {328 if (step.getTestDataProfileStepId() != null) {329 Optional<TestData> testData = testDataService.getRecentImportedEntity(importDTO, step.getTestDataProfileStepId());330 testData.ifPresent(data -> step.setTestDataProfileStepId(data.getId()));331 }332 if (step.getType() == TestStepType.FOR_LOOP) {333 Optional<TestData> testData = testDataService.getRecentImportedEntity(importDTO, step.getForLoopTestDataId());334 testData.ifPresent(data -> step.setForLoopTestDataId(data.getId()));335 }336 }337 return steps;338 }339 }340 private void mapDeprecatedActionsWithUpdatesOnes(TestStep step) {341 ActionTestDataMap filteredMap = this.actionTestDataMap.stream().filter(dataMap -> dataMap.getTestDataHash().containsKey(step.getNaturalTextActionId())).findFirst().orElse(null);342 if (filteredMap != null) {343 step.setTestData(filteredMap.getTestDataHash().get(step.getNaturalTextActionId()));344 step.setNaturalTextActionId(filteredMap.getOptimizedActionId());345 step.setTestDataType(TestDataType.raw.getDispName());346 }347 }348 @Override349 public Optional<TestStep> findImportedEntity(TestStep testStep, BackupDTO importDTO) {350 Optional<TestCase> testCase = testCaseService.getRecentImportedEntity(importDTO, testStep.getTestCaseId());351 if (testCase.isEmpty()) {352 return Optional.empty();353 }354 Optional<TestStep> previous = repository.findByTestCaseIdInAndImportedId(List.of(testCase.get().getId()), testStep.getId());355 return previous;356 }357 @Override358 public TestStep processBeforeSave(Optional<TestStep> previous, TestStep present, TestStep toImport, BackupDTO importDTO) throws ResourceNotFoundException {359 present.setImportedId(present.getId());360 if (previous.isPresent() && importDTO.isHasToReset()) {361 present.setId(previous.get().getId());362 } else {363 present.setId(null);364 }365 setTemplateId(present, importDTO);366 processTestDataMap(present, importDTO);367 Optional<TestCase> testCase = testCaseService.getRecentImportedEntity(importDTO, present.getTestCaseId());368 if (testCase.isPresent())369 present.setTestCaseId(testCase.get().getId());370 if (present.getStepGroupId() != null) {371 Optional<TestCase> testComponent = testCaseService.getRecentImportedEntity(importDTO, present.getStepGroupId());372 if (testComponent.isPresent())373 present.setStepGroupId(testComponent.get().getId());374 }375 if (present.getParentId() != null) {376 Optional<TestStep> testStep = getRecentImportedEntity(importDTO, present.getParentId());377 if (testStep.isPresent()) {378 present.setParentId(testStep.get().getId());379 if (testStep.get().getDisabled()) {380 present.setDisabled(true);381 }382 }383 }384 if (present.getPreRequisiteStepId() != null) {385 Optional<TestStep> recentPrerequisite = getRecentImportedEntityForPreq(present.getTestCaseId(), present.getPreRequisiteStepId());386 if (recentPrerequisite.isPresent())387 present.setPreRequisiteStepId(recentPrerequisite.get().getId());388 }389 return present;390 }391 public boolean hasToSkip(TestStep testStep, BackupDTO importDTO) {392 Optional<TestCase> testCase = testCaseService.getRecentImportedEntity(importDTO, testStep.getTestCaseId());393 return testCase.isEmpty();394 }395 @Override396 void updateImportedId(TestStep testStep, TestStep previous, BackupDTO importDTO) {397 previous.setImportedId(testStep.getId());398 save(previous);399 }400 private void processTestDataMap(TestStep present, BackupDTO importDTO) {401 TestStepDataMap testStepDataMap = present.getDataMapBean();402 if (testStepDataMap != null) {403 if ((testStepDataMap.getForLoop() != null || testStepDataMap.getWhileCondition() != null)404 && testStepDataMap.getForLoop() != null && testStepDataMap.getForLoop().getTestDataId() != null) {405 Optional<TestData> testData = testDataService.getRecentImportedEntity(importDTO, testStepDataMap.getForLoop().getTestDataId());406 if (testData.isPresent())407 testStepDataMap.getForLoop().setTestDataId(testData.get().getId());408 }409 }410 }411 private void setTemplateId(TestStep present, BackupDTO importDTO) throws ResourceNotFoundException {412 if (!importDTO.getIsSameApplicationType() && present.getNaturalTextActionId() != null && present.getNaturalTextActionId() > 0) {413 try {414 NaturalTextActions nlpTemplate = naturalTextActionsService.findById(present.getNaturalTextActionId().longValue());415 if (importDTO.getWorkspaceType().equals(WorkspaceType.WebApplication)) {416 present.setNaturalTextActionId(nlpTemplate.getImportToWeb().intValue());417 if (nlpTemplate.getImportToWeb().intValue() == 0) {418 present.setDisabled(true);419 }420 } else if (importDTO.getWorkspaceType().equals(WorkspaceType.MobileWeb)) {421 present.setNaturalTextActionId(nlpTemplate.getImportToMobileWeb().intValue());422 if (nlpTemplate.getImportToMobileWeb().intValue() == 0) {423 present.setDisabled(true);424 }425 } else if (importDTO.getWorkspaceType().equals(WorkspaceType.AndroidNative)) {426 present.setNaturalTextActionId(nlpTemplate.getImportToAndroidNative().intValue());427 if (nlpTemplate.getImportToAndroidNative().intValue() == 0) {428 present.setDisabled(true);429 }430 } else if (importDTO.getWorkspaceType().equals(WorkspaceType.IOSNative)) {431 present.setNaturalTextActionId(nlpTemplate.getImportToIosNative().intValue());432 if (nlpTemplate.getImportToIosNative().intValue() == 0) {433 present.setDisabled(true);434 }435 }436 } catch (Exception e) {437 log.debug("mapping failed for templateId " + present.getNaturalTextActionId().longValue());438 present.setNaturalTextActionId(0);439 present.setDisabled(true);440 }441 }442 }443 @Override444 public TestStep copyTo(TestStep testStep) {445 return mapper.copy(testStep);446 }447 @Override448 public TestStep save(TestStep testStep) {449 return repository.save(testStep);450 }451 @Override452 public Optional<TestStep> getRecentImportedEntity(BackupDTO importDTO, Long... ids) {453 Long importedId = ids[0];454 List<Long> testcaseIds = new ArrayList<>();455 testCaseService.findAllByWorkspaceVersionId(importDTO.getWorkspaceVersionId()).stream().forEach(testCase -> testcaseIds.add(testCase.getId()));456 Optional<TestStep> previous = repository.findByTestCaseIdInAndImportedId(testcaseIds, importedId);457 return previous;458 }459 public Optional<TestStep> getRecentImportedEntityForPreq(Long testcaseId, Long importedId) {460 Optional<TestStep> previous = repository.findAllByTestCaseIdAndImportedId(testcaseId, importedId);461 return previous;462 }463 public Optional<TestStep> findImportedEntityHavingSameName(Optional<TestStep> previous, TestStep current, BackupDTO importDTO) {464 return previous;465 }466 public boolean hasImportedId(Optional<TestStep> previous) {467 return previous.isPresent() && previous.get().getImportedId() != null;468 }469 public boolean isEntityAlreadyImported(Optional<TestStep> previous, TestStep current) {470 return previous.isPresent() && previous.get().getImportedId() != null && previous.get().getImportedId().equals(current.getId());471 }472 public List<TestStep> findAllByTestCaseIdIn(List<Long> testCaseIds) {473 return this.repository.findAllByTestCaseIdInOrderByPositionAsc(testCaseIds);474 }475 private List<ActionTestDataMap> getMapsList(){476 List<ActionTestDataMap> actionsMap = new ArrayList<>();477 actionsMap.add(new ActionTestDataMap(WorkspaceType.WebApplication, 1080, DeprecatedActionMapper.getWebWaitMap()));478 actionsMap.add(new ActionTestDataMap(WorkspaceType.MobileWeb, 10192, DeprecatedActionMapper.getMobileWebWaitMap()));479 actionsMap.add(new ActionTestDataMap(WorkspaceType.AndroidNative, 20153, DeprecatedActionMapper.getAndroidWaitMap()));480 actionsMap.add(new ActionTestDataMap(WorkspaceType.IOSNative, 30147, DeprecatedActionMapper.getIOSWaitMap()));481 actionsMap.add(new ActionTestDataMap(WorkspaceType.WebApplication, 1079, DeprecatedActionMapper.getWebVerifyMap()));482 actionsMap.add(new ActionTestDataMap(WorkspaceType.MobileWeb, 10191, DeprecatedActionMapper.getMobileWebVerifyMap()));483 actionsMap.add(new ActionTestDataMap(WorkspaceType.AndroidNative, 20152, DeprecatedActionMapper.getAndroidVerifyMap()));484 actionsMap.add(new ActionTestDataMap(WorkspaceType.IOSNative, 30146, DeprecatedActionMapper.getIOSVerifyMap()));485 actionsMap.add(new ActionTestDataMap(WorkspaceType.MobileWeb, 10196, DeprecatedActionMapper.getMobileWebTapOnAlertMap()));486 actionsMap.add(new ActionTestDataMap(WorkspaceType.AndroidNative, 20156, DeprecatedActionMapper.getAndroidTapOnAlertMap()));487 actionsMap.add(new ActionTestDataMap(WorkspaceType.IOSNative, 30151, DeprecatedActionMapper.getIOSTapOnAlertMap()));488 actionsMap.add(new ActionTestDataMap(WorkspaceType.MobileWeb, 10190, DeprecatedActionMapper.getMobileWebSwipeMap()));489 actionsMap.add(new ActionTestDataMap(WorkspaceType.AndroidNative, 20150, DeprecatedActionMapper.getAndroidSwipeFromMap()));490 actionsMap.add(new ActionTestDataMap(WorkspaceType.IOSNative, 30144, DeprecatedActionMapper.getIOSSwipeFromMap()));491 actionsMap.add(new ActionTestDataMap(WorkspaceType.AndroidNative, 20151, DeprecatedActionMapper.getAndroidSwipeToMap()));492 actionsMap.add(new ActionTestDataMap(WorkspaceType.IOSNative, 30145, DeprecatedActionMapper.getIOSSwipeToMap()));493 actionsMap.add(new ActionTestDataMap(WorkspaceType.AndroidNative, 20154, DeprecatedActionMapper.getAndroidEnableSwitchMap()));494 actionsMap.add(new ActionTestDataMap(WorkspaceType.IOSNative, 30148, DeprecatedActionMapper.getIOSEnableSwitchMap()));495 actionsMap.add(new ActionTestDataMap(WorkspaceType.MobileWeb, 10195, DeprecatedActionMapper.getMobileWebTapOnKeyMap()));496 actionsMap.add(new ActionTestDataMap(WorkspaceType.AndroidNative, 20155, DeprecatedActionMapper.getAndroidTapOnKeyMap()));497 actionsMap.add(new ActionTestDataMap(WorkspaceType.IOSNative, 30150, DeprecatedActionMapper.getIOSTapOnKeyMap()));498 actionsMap.add(new ActionTestDataMap(WorkspaceType.WebApplication, 1082, DeprecatedActionMapper.getMobileWebScrollInsideElementMap()));499 actionsMap.add(new ActionTestDataMap(WorkspaceType.MobileWeb, 10194, DeprecatedActionMapper.getMobileWebScrollInsideElementMap()));500 actionsMap.add(new ActionTestDataMap(WorkspaceType.WebApplication, 1081, DeprecatedActionMapper.getWebScrollToElementMap()));501 actionsMap.add(new ActionTestDataMap(WorkspaceType.MobileWeb, 10193, DeprecatedActionMapper.getMobileWebScrollToElementMap()));502 actionsMap.add(new ActionTestDataMap(WorkspaceType.WebApplication, 1083, DeprecatedActionMapper.getWebClickOnButtonMap()));503 actionsMap.add(new ActionTestDataMap(WorkspaceType.MobileWeb, 10197, DeprecatedActionMapper.getMobileWebTapOnButtonMap()));504 actionsMap.add(new ActionTestDataMap(WorkspaceType.IOSNative, 30149, DeprecatedActionMapper.getIOSWIFISwitchMap()));505 return actionsMap;506 }507}508@Data509@AllArgsConstructor510class ActionTestDataMap {511 WorkspaceType workspaceType;512 Integer optimizedActionId;513 HashMap<Integer, String> testDataHash;514}...

Full Screen

Full Screen

Source:DeprecatedActionMapper.java Github

copy

Full Screen

1package com.testsigma.util;2import java.util.ArrayList;3import java.util.HashMap;4import java.util.List;5public class DeprecatedActionMapper {6 public static HashMap<Integer, String> getWebWaitMap(){7 HashMap<Integer, String> map = new HashMap<Integer, String>();8 map.put(7, "visible");9 map.put(8, "selected");10 map.put(10, "not selected");11 map.put(11, "enabled");12 map.put(12, "disabled");13 map.put(13, "clickable");14 map.put(18, "not visible");15 return map;16 }17 public static HashMap<Integer, String> getWebVerifyMap(){18 HashMap<Integer, String> map = new HashMap<Integer, String>();19 map.put(54, "checked");...

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1package com.testsigma.util;2import com.opensymphony.xwork2.ActionInvocation;3import com.opensymphony.xwork2.ActionProxy;4import com.opensymphony.xwork2.config.entities.ActionConfig;5import com.opensymphony.xwork2.config.entities.ResultConfig;6import com.opensymphony.xwork2.config.entities.ResultTypeConfig;7import com.opensymphony.xwork2.config.entities.ResultTypeConfig.Builder;8import com.opensymphony.xwork2.config.entities.ResultTypeConfig.ParamConfig;9import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;10import com.opensymphony.xwork2.inject.Container;11import com.opensymphony.xwork2.inject.Inject;12import com.opensymphony.xwork2.util.location.LocatableProperties;13import com.opensymphony.xwork2.util.location.Location;14import com.opensymphony.xwork2.util.location.LocationUtils;15import com.opensymphony.xwork2.util.location.UnknownLocation;16import com.opensymphony.xwork2.util.reflection.ReflectionContextState;17import com.opensymphony.xwork2.util.reflection.ReflectionException;18import com.opensymphony.xwork2.util.reflection.ReflectionProvider;19import com.opensymphony.xwork2.util.reflection.ReflectionProviderException;20import com.opensymphony.xwork2.util.reflection.ReflectionUtils;21import com.opensymphony.xwork2.util.reflection.SunUnsafeReflectionProvider;22import com.opensymphony.xwork2.util.reflection.UnresolvablePropertyException;23import com.opensymphony.xwork2.util.reflection.UnsupportedReflectionProviderException;24import com.opensymphony.xwork2.util.reflection.XWorkConverter;25import com.opensymphony.xwork2.util.reflection.annotations.AnnotationContext;26import com.opensymphony.xwork2.util.reflection.annotation.AnnotationException;27import com.opensymphony.xwork2.util.reflection.annotation.AnnotationManager;28import com.opensymphony.xwork2.util.reflection.annotation.ClassLevelAnnotation;29import com.opensymphony.xwork2.util.reflection.annotation.ClassLevelAnnotationHandler;30import com.opensymphony.xwork2.util.reflection.annotation.MethodLevelAnnotation;31import com.opensymphony.xwork2.util.reflection.annotation.MethodLevelAnnotationHandler;32import com.opensymphony.xwork2.util.reflection.annotation.MethodLevelAnnotationHandlerFactory;33import com.opensymphony.xwork2.util.reflection.annotation.ParameterizedAnnotationHandler;34import com.opensymphony.xwork2.util.reflection.annotation.ParameterizedAnnotationHandlerFactory;35import com.opensymphony.xwork2.util

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1import com.testsigma.util.DeprecatedActionMapper;2import org.apache.struts2.dispatcher.mapper.ActionMapping;3import org.apache.struts2.dispatcher.mapper.ActionMapper;4import org.apache.struts2.dispatcher.mapper.ActionMapping;5public class ActionMapperImpl implements ActionMapper {6 private ActionMapper delegate;7 public ActionMapperImpl() {8 delegate = new DeprecatedActionMapper();9 }10 public ActionMapping getMapping(HttpServletRequest request) {11 return delegate.getMapping(request);12 }13 public void setMapping(HttpServletRequest request, ActionMapping mapping) {14 delegate.setMapping(request, mapping);15 }16 public String getUriFromActionMapping(ActionMapping mapping) {17 return delegate.getUriFromActionMapping(mapping);18 }19}20import org.apache.struts2.dispatcher.mapper.DefaultActionMapper;21import org.apache.struts2.dispatcher.mapper.ActionMapping;22import org.apache.struts2.dispatcher.mapper.ActionMapper;23import org.apache.struts2.dispatcher.mapper.ActionMapping;24public class ActionMapperImpl implements ActionMapper {25 private ActionMapper delegate;26 public ActionMapperImpl() {27 delegate = new DefaultActionMapper();28 }29 public ActionMapping getMapping(HttpServletRequest request) {30 return delegate.getMapping(request);31 }32 public void setMapping(HttpServletRequest request, ActionMapping mapping) {33 delegate.setMapping(request, mapping);34 }35 public String getUriFromActionMapping(ActionMapping mapping) {36 return delegate.getUriFromActionMapping(mapping);37 }38}39import org.apache.struts2.dispatcher.mapper.DefaultActionMapper;40import org.apache.struts2.dispatcher.mapper.ActionMapping;41import org.apache.struts2.dispatcher.mapper.ActionMapper;42import org.apache.struts2.dispatcher.mapper.ActionMapping;43public class ActionMapperImpl implements ActionMapper {44 private ActionMapper delegate;45 public ActionMapperImpl() {46 delegate = new DefaultActionMapper();47 }48 public ActionMapping getMapping(HttpServletRequest request) {49 return delegate.getMapping(request);50 }51 public void setMapping(HttpServletRequest request, ActionMapping mapping) {52 delegate.setMapping(request, mapping);53 }54 public String getUriFromActionMapping(ActionMapping mapping) {55 return delegate.getUriFromActionMapping(mapping);56 }57}58import org.apache.struts2.dispatcher.mapper.DefaultActionMapper;59import org.apache.struts2.dispatcher.mapper.ActionMapping;60import org.apache.struts2.dispatcher.mapper.ActionMapper;61import org.apache.struts2.dispatcher.mapper.ActionMapping;62public class ActionMapperImpl implements ActionMapper {

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1import com.testsigma.util.DeprecatedActionMapper;2import java.util.HashMap;3import java.util.Map;4import java.util.Scanner;5public class 2 {6 public static void main(String[] args) {7 Scanner sc = new Scanner(System.in);8 System.out.println("Enter the input string");9 String input = sc.nextLine();10 Map<String, String> actionMap = new HashMap<>();11 actionMap.put("move", "move");12 actionMap.put("move to", "moveTo");13 actionMap.put("click", "click");14 actionMap.put("click on", "clickOn");15 actionMap.put("click at", "clickAt");16 actionMap.put("double click", "doubleClick");17 actionMap.put("double click on", "doubleClickOn");18 actionMap.put("double click at", "doubleClickAt");19 actionMap.put("right click", "rightClick");20 actionMap.put("right click on", "rightClickOn");21 actionMap.put("right click at", "rightClickAt");22 actionMap.put("click and hold", "clickAndHold");23 actionMap.put("click and hold on", "clickAndHoldOn");24 actionMap.put("click and hold at", "clickAndHoldAt");25 actionMap.put("release", "release");26 actionMap.put("release on", "releaseOn");27 actionMap.put("release at", "releaseAt");28 actionMap.put("hover", "hover");29 actionMap.put("hover on", "hoverOn");30 actionMap.put("hover at", "hoverAt");31 actionMap.put("drag and drop", "dragAndDrop");32 actionMap.put("drag and drop on", "dragAndDropOn");33 actionMap.put("drag and drop at", "dragAndDropAt");34 actionMap.put("scroll", "scroll");35 actionMap.put("scroll to", "scrollTo");36 actionMap.put("scroll to element", "scrollToElement");37 actionMap.put("scroll to element by", "scrollToElementBy");38 actionMap.put("scroll to element by value", "scrollToElementByValue");39 actionMap.put("scroll to element by offset", "scrollToElementByOffset");40 actionMap.put("scroll to element by offset by", "scrollToElementByOffsetBy");41 actionMap.put("scroll to element by offset by value", "scrollTo

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1package com.testsigma.test;2import com.testsigma.util.DeprecatedActionMapper;3import com.testsigma.util.DeprecatedActionMapper.Action;4public class TestDeprecatedActionMapper {5 public static void main(String[] args) {6 DeprecatedActionMapper mapper = new DeprecatedActionMapper();7 mapper.addMapping(Action.CLICK, "click");

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1import com.testsigma.util.DeprecatedActionMapper;2import java.util.ArrayList;3import java.util.List;4public class TestDeprecatedActionMapper {5 public static void main(String[] args) {6 DeprecatedActionMapper dam = new DeprecatedActionMapper();7 dam.addDeprecatedAction("click", "clickAndWait");8 dam.addDeprecatedAction("select", "selectAndWait");9 dam.addDeprecatedAction("type", "typeAndWait");10 List<String> deprecatedActions = dam.getDeprecatedActions();11 System.out.println("List of deprecated actions: " + deprecatedActions);12 System.out.println("Is 'click' deprecated: " + dam.isDeprecated("click"));13 System.out.println("Is 'open' deprecated: " + dam.isDeprecated("open"));14 System.out.println("Equivalent action for 'click': " + dam.getEquivalentAction("click"));15 System.out.println("Equivalent action for 'select': " + dam.getEquivalentAction("select"));16 System.out.println("Equivalent action for 'type': " + dam.getEquivalentAction("type"));17 System.out.println("Equivalent action for 'open': " + dam.getEquivalentAction("open"));18 }19}20DeprecatedActionMapper.addDeprecatedAction(String, String)21DeprecatedActionMapper.getDeprecatedActions()22DeprecatedActionMapper.isDeprecated(String)23DeprecatedActionMapper.getEquivalentAction(String)

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1import com.testsigma.util.DeprecatedActionMapper;2import java.io.*;3import java.util.*;4import java.util.regex.*;5import org.apache.commons.io.*;6import org.apache.commons.io.filefilter.*;7import org.apache.commons.io.filefilter.IOFileFilter;8import org.apache.commons.io.filefilter.RegexFileFilter;9import org.apache.commons.io.filefilter.SuffixFileFilter;10import org.apache.commons.io.filefilter.TrueFileFilter;11import org.apache.commons.io.filefilter.WildcardFileFilter;12import org.apache.commons.io.filefilter.DirectoryFileFilter;13import org.apache.commons.io.filefilter.AndFileFilter;14import org.apache.commons.io.filefilter.OrFileFilter;15import org.apache.commons.io.filefilter.NotFileFilter;16import org.apache.commons.io.filefilter.EmptyFileFilter;17import org.apache.commons.io.filefilter.HiddenFileFilter;18import org.apache.commons.io.filefilter.CanReadFileFilter;19import org.apache.commons.io.filefilter.CanWriteFileFilter;20import org.apache.commons.io.filefilter.CanExecuteFileFilter;21import org.apache.commons.io.filefilter.AgeFileFilter;22import org.apache.commons.io.filefilter.SizeFileFilter;23import org.apache.commons.io.filefilter.PrefixFileFilter;24import org.apache.commons.io.filefilter.NameFileFilter;25import org.apache.commons.io.filefilter.SuffixFileFilter;26import org.apache.commons.io.filefilter.FileFileFilter;27import org.apache.commons.io.filefilter.DirectoryFileFilter;28import org.apache.commons.io.filefilter.TrueFileFilter;29import org.apache.commons.io.filefilter.FalseFileFilter;30import org.apache.commons.io.filefilter.SuffixFileFilter;31import org.apache.commons.io.filefilter.WildcardFileFilter;32import org.apache.commons.io.filefilter.IOFileFilter;33import org.apache.commons.io.filefilter.RegexFileFilter;34import org.apache.commons.io.filefilter.TrueFileFilter;35import org.apache.commons.io.filefilter.FalseFileFilter;36import org.apache.commons.io.filefilter.SuffixFileFilter;37import org.apache.commons.io.filefilter.WildcardFileFilter;38import org.apache.commons.io.filefilter.IOFileFilter;39import org.apache.commons.io.filefilter.RegexFileFilter;40import org.apache.commons.io.filefilter.TrueFileFilter;41import org.apache.commons.io.filefilter.FalseFileFilter;42import org.apache.commons.io.filefilter.SuffixFileFilter;43import org.apache.commons.io.filefilter.WildcardFileFilter;44import org.apache.commons.io.filefilter.IOFileFilter;45import org.apache.commons.io.filefilter.RegexFileFilter;46import org.apache.commons.io.filefilter.TrueFileFilter;

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1import com.testsigma.util.DeprecatedActionMapper;2import com.testsigma.util.DeprecatedActionMapperException;3import com.testsigma.util.DeprecatedActionMapperException;4public class DeprecatedActionMapperTest {5public static void main(String[] args) {6DeprecatedActionMapper deprecatedActionMapper = new DeprecatedActionMapper();7try {8} catch (DeprecatedActionMapperException e) {9e.printStackTrace();10}11}12}13import com.testsigma.util.DeprecatedActionMapper;14import com.testsigma.util.DeprecatedActionMapperException;15public class DeprecatedActionMapperTest {16public static void main(String[] args) {17DeprecatedActionMapper deprecatedActionMapper = new DeprecatedActionMapper();18}19}20import com.testsigma.util.DeprecatedActionMapper;21import com.testsigma.util.DeprecatedActionMapperException;22public class DeprecatedActionMapperTest {23public static void main(String[] args) {24DeprecatedActionMapper deprecatedActionMapper = new DeprecatedActionMapper();25}26}27import com.testsigma.util.DeprecatedActionMapper;28import com.testsigma.util.DeprecatedActionMapperException;29public class DeprecatedActionMapperTest {30public static void main(String[] args) {31DeprecatedActionMapper deprecatedActionMapper = new DeprecatedActionMapper();32}33}34import com.testsigma.util.DeprecatedActionMapper;35import com.testsigma.util.DeprecatedActionMapperException;36public class DeprecatedActionMapperTest {37public static void main(String[] args) {38DeprecatedActionMapper deprecatedActionMapper = new DeprecatedActionMapper();39}40}41import com.testsigma.util.DeprecatedActionMapper;42import com.testsigma.util.DeprecatedActionMapperException;43public class DeprecatedActionMapperTest {44public static void main(String[] args) {45DeprecatedActionMapper deprecatedActionMapper = new DeprecatedActionMapper();

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1import com.testsigma.util.DeprecatedActionMapper;2import com.testsigma.util.ActionMapper;3import com.testsigma.util.ActionMapperInterface;4public class TestActionMapper {5 public static void main(String[] args) {6 DeprecatedActionMapper obj = new DeprecatedActionMapper();7 obj.doAction("click");8 ActionMapper obj2 = new ActionMapper();9 obj2.doAction("click");10 ActionMapperInterface obj3 = new ActionMapper();11 obj3.doAction("click");12 }13}

Full Screen

Full Screen

DeprecatedActionMapper

Using AI Code Generation

copy

Full Screen

1import com.testsigma.util.DeprecatedActionMapper;2public class TestDeprecatedActionMapper{3 public static void main(String args[]){4 DeprecatedActionMapper dam = new DeprecatedActionMapper();5 dam.setFileName("testfile");6 dam.setSheetName("testsheet");7 dam.setRowNumber(1);8 dam.setColNumber(1);9 dam.setBrowser("firefox");10 dam.setBrowserVersion("3.5");11 dam.setPlatform("winXP");12 dam.setTestName("test");13 dam.setTestSuite("testsuite");14 dam.setTestType("testtype");15 dam.setTestDescription("testdescription");16 dam.setTestStatus("pass");17 dam.setTestPriority("high");18 dam.setTestOwner("testowner");19 dam.setTestBrowser("firefox");20 dam.setTestBrowserVersion("3.5");21 dam.setTestPlatform("winXP");22 dam.setTestStart("2009-01-01 00:00:00");23 dam.setTestEnd("2009-01-01 00:00:00");24 dam.setTestDuration(100);25 dam.setTestMessage("testmessage");26 dam.setTestException("testexception");27 dam.setTestScreenShot("testscreen");28 dam.setTestFileName("testfilename");29 dam.setTestSheetName("testsheetname");30 dam.setTestRowNumber(1);31 dam.setTestColNumber(1);32 dam.setTestIteration(1);33 dam.setTestIterationCount(1);34 dam.setTestIterationStart("2009-01-01 00:00:00");35 dam.setTestIterationEnd("2009-01-01 00:00:00");36 dam.setTestIterationDuration(100);37 dam.setTestIterationMessage("testiterationmessage");38 dam.setTestIterationException("testiterationexception");39 dam.setTestIterationScreenShot("testiterationscreenshot");40 dam.setTestIterationFileName("testiterationfilename");41 dam.setTestIterationSheetName("testiterationsheetname");42 dam.setTestIterationRowNumber(1);43 dam.setTestIterationColNumber(1);44 dam.setTestIterationStep(1);45 dam.setTestIterationStepCount(1);46 dam.setTestIterationStepStart("2009-01-01 00:00:00");47 dam.setTestIterationStepEnd("

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful