Skip to content

Commit 4d765fa

Browse files
committed
Cleanup code.
1 parent b6dd25a commit 4d765fa

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

ui-tests/src/main/java/io/jenkins/plugins/forensics/git/Summary.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
public class Summary extends PageObject {
2323
private static final Pattern REMOVE_DETAILS = Pattern.compile("(\\r?\\n|\\r).*");
2424

25-
private final String id;
26-
27-
private final WebElement summary;
28-
private final List<WebElement> results;
25+
private final WebElement summarySpan;
2926
private final String title;
3027
private final List<String> details;
3128

@@ -40,12 +37,9 @@ public class Summary extends PageObject {
4037
public Summary(final Build parent, final String id) {
4138
super(parent, parent.url(id));
4239

43-
this.id = id;
44-
45-
summary = getElement(By.id(id));
46-
title = REMOVE_DETAILS.matcher(summary.getText()).replaceAll("");
47-
results = summary.findElements(by.xpath("ul/li"));
48-
details = results.stream()
40+
summarySpan = getElement(By.id(id));
41+
title = REMOVE_DETAILS.matcher(summarySpan.getText()).replaceAll("");
42+
details = summarySpan.findElements(by.xpath("ul/li")).stream()
4943
.map(WebElement::getText)
5044
.map(StringUtils::normalizeSpace)
5145
.collect(Collectors.toList());
@@ -78,7 +72,7 @@ public List<String> getDetails() {
7872
* @return the URL of the page that has been opened by the link
7973
*/
8074
public String openLinkByText(final String text) {
81-
summary.findElement(By.linkText(text)).click();
75+
summarySpan.findElement(By.linkText(text)).click();
8276

8377
return driver.getCurrentUrl();
8478
}

ui-tests/src/test/java/io/jenkins/plugins/forensics/git/ForensicsPluginUiTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import java.util.List;
44

55
import org.junit.Test;
6-
import org.openqa.selenium.By;
76

87
import org.jenkinsci.test.acceptance.junit.AbstractJUnitTest;
98
import org.jenkinsci.test.acceptance.junit.WithPlugins;
@@ -24,9 +23,6 @@ public class ForensicsPluginUiTest extends AbstractJUnitTest {
2423
private static final String REPOSITORY_URL = "https://github.com/jenkinsci/git-forensics-plugin.git";
2524
private static final String SCM_KEY = "git " + REPOSITORY_URL;
2625
private static final int SCM_HASH = SCM_KEY.hashCode();
27-
private static final int GIT_SUMMARY_ROW = 2;
28-
private static final int COMMIT_RECORDER_ROW = 3;
29-
private static final int MINER_ROW = 4;
3026

3127
/**
3228
* Verifies the Git miner by running a build with the forensics plugin analyzing a commit hash of the
@@ -84,11 +80,6 @@ private WorkflowJob createJob() {
8480
return job;
8581
}
8682

87-
private String getSummaryText(final Build referenceBuild, final int row) {
88-
return referenceBuild.getElement(
89-
By.xpath("/html/body/div[4]/div[2]/table/tbody/tr[" + row + "]/td[2]")).getText();
90-
}
91-
9283
/**
9384
* asserts the headers of the table by their size and entries.
9485
*

0 commit comments

Comments
 (0)