How to use normalizeEnums method of com.testsigma.specification.ElementSpecificationsBuilder class

Best Testsigma code snippet using com.testsigma.specification.ElementSpecificationsBuilder.normalizeEnums

Source:ElementSpecificationsBuilder.java Github

copy

Full Screen

...38 for (SearchCriteria criteria : criteriaList) {39 normalizeDate(criteria);40 normalizeAppVersion(criteria, version);41 normalizeOperation(criteria);42 normalizeEnums(criteria);43 normalizeBoolean(criteria);44 result = Specification.where(result).and(new ElementSpecification(criteria));45 }46 return result;47 }48 private void normalizeDate(SearchCriteria criteria) {49 if (criteria.getKey().equals("createdDate") || criteria.getKey().equals("updatedDate")) {50 criteria.setValue(criteria.getValue());51 }52 }53 private void normalizeOperation(SearchCriteria criteria) {54 if (criteria.getValue().getClass().equals(TextNode.class)) {55 if (((TextNode) criteria.getValue()).asText().endsWith("*") && ((TextNode) criteria.getValue()).asText().startsWith("*")) {56 criteria.setOperation(SearchOperation.CONTAINS);57 criteria.setValue(((TextNode) criteria.getValue()).asText().substring(1, ((TextNode) criteria.getValue()).asText().length() - 1));58 }59 } else {60 if (criteria.getValue().toString().endsWith("*") && criteria.getValue().toString().startsWith("*")) {61 criteria.setOperation(SearchOperation.CONTAINS);62 criteria.setValue(criteria.getValue().toString().substring(1, criteria.getValue().toString().length() - 1));63 }64 }65 }66 private void normalizeEnums(SearchCriteria criteria) {67 if (criteria.getKey().equals("locatorType")) {68 Object[] values = ((ArrayList) criteria.getValue()).toArray();69 ArrayList<LocatorType> normalizedList = new ArrayList<>();70 for (int index = 0; index < values.length; index++) {71 normalizedList.add(LocatorType.valueOf(values[index].toString()));72 }73 criteria.setValue(normalizedList);74 }75 }76 private void normalizeAppVersion(SearchCriteria criteria, WorkspaceVersion version) {77 if (criteria.getKey().equals("workspaceVersionId") && criteria.getOperation().equals(SearchOperation.EQUALITY)) {78 if (criteria.getValue().toString().equals("-1")) {79 criteria.setValue(version.getId());80 } else {...

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.

Run Testsigma automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful