Skip to content

Commit

Permalink
Merge pull request #68 from healenium/feature/EPMHLM-334
Browse files Browse the repository at this point in the history
Feature/epmhlm 334
  • Loading branch information
Alex-Reif authored May 28, 2023
2 parents bc082ea + 628dde1 commit 9f05217
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group 'com.epam.healenium'
version '3.3.2'
version '3.3.3'

sourceCompatibility = 1.8

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import java.text.DecimalFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -110,7 +112,7 @@ private void buildReportRecords(RecordDto result, Report report) {
|| it.getClassName().contains(Constants.MULTIPLE_ELEMENTS_PROXY_CLASS_PATH)
? it.getFailedLocator().getValue()
: it.getClassName() + "." + it.getMethodName() + "()");
reportRecord.setScreenShotPath(it.getScreenShotPath());
reportRecord.setScreenShotPath(transformPath(it.getScreenShotPath()));
reportRecord.setFailedLocatorType(it.getFailedLocator().getType());
reportRecord.setFailedLocatorValue(it.getFailedLocator().getValue());
reportRecord.setHealedLocatorType(it.getHealedLocator().getType());
Expand All @@ -123,6 +125,14 @@ private void buildReportRecords(RecordDto result, Report report) {
});
}

private String transformPath(String sourcePath) {
List<String> dirs = Arrays.asList(sourcePath.split("/"));
Collections.reverse(dirs);
String name = dirs.get(0);
String uid = dirs.get(1);
return "/screenshots/".concat(uid).concat("/").concat(name);
}


/**
* Create record in report about healing
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/epam/healenium/util/Utils.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.epam.healenium.util;

import jdk.internal.joptsimple.internal.Strings;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -53,11 +53,11 @@ public String buildScreenshotName() {

public String getAddressForKey(String url, boolean urlForKey) {
try {
return urlForKey ? url : Strings.EMPTY;
return urlForKey ? url : StringUtils.EMPTY;
} catch (Exception e) {
log.warn("Error during parse url. Message: {}", e.getMessage());
}
return Strings.EMPTY;
return StringUtils.EMPTY;
}

}

0 comments on commit 9f05217

Please sign in to comment.