Skip to content

Commit

Permalink
✅ Updated method call to get the values for a column
Browse files Browse the repository at this point in the history
  • Loading branch information
joshsadam committed Jul 29, 2020
1 parent 8225710 commit 74d225c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,26 @@ public void selectSampleNameColumn() {
}

public int getFoundCount() {
return Integer.parseInt(foundPill.findElement(By.className("badge")).getText());
return Integer.parseInt(foundPill.findElement(By.className("badge"))
.getText());
}

public int getMissingCount() {
return Integer.parseInt(missingPill.findElement(By.className("badge")).getText());
return Integer.parseInt(missingPill.findElement(By.className("badge"))
.getText());
}

public List<String> getNumberColumnValues() {
public List<String> getValuesForColumnByName(String column) {
// Get the text from the headers
List<String> headerText = headers.stream()
.map(WebElement::getText).collect(Collectors.toList());
.map(WebElement::getText)
.collect(Collectors.toList());
// Find which columns is the numbers
int index = headerText.indexOf("Numbers");
List<String> numbers = rows.stream().map(row -> row.findElements(By.tagName("td")).get(index).getText()).collect(
Collectors.toList());
return numbers;
int index = headerText.indexOf(column);
return rows.stream()
.map(row -> row.findElements(By.tagName("td"))
.get(index)
.getText())
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testGoodFileAndHeaders() {
.setScale(2, RoundingMode.HALF_UP)
.doubleValue())
.collect(Collectors.toList());
List<String> formattedNumbers = page.getNumberColumnValues();
List<String> formattedNumbers = page.getValuesForColumnByName("Numbers");
formattedNumbers.forEach(num -> assertTrue("Found " + num + " that was not formatted properly", values.contains(Double.valueOf(num))));

}
Expand Down

0 comments on commit 74d225c

Please sign in to comment.