Skip to content

Instantly share code, notes, and snippets.

@lennyferguson
Created April 30, 2018 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lennyferguson/644dd213ddb22608a0c22708d7567044 to your computer and use it in GitHub Desktop.
Save lennyferguson/644dd213ddb22608a0c22708d7567044 to your computer and use it in GitHub Desktop.
/**
* Asserts that there is a row on the Student Grades Page that contains every field of each
* Grade in the students list of Grades
* @param student the argument student
* @return the invoked student grades page
*/
public StudentGradesPage assertStudentGrades(final StudentManager.SummaryStudent student) {
Assert.assertTrue(student.getStudentGrades().size() > 0);
final SelenideElement gradesBody = Util.demand($("div.panel-heading + table tbody"));
Assert.assertTrue(student.getStudentGrades().stream().allMatch(grade ->
gradesBody.$$("tr").stream()
.anyMatch(tr -> {
final List<String> rs = tr.$$("td").stream()
.map(td -> normalize(td.getText()))
.collect(Collectors.toList());
return grade.stream()
.allMatch(val -> rs.stream().anyMatch(col ->
col.contains(normalize(val)))); })));
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment