Created
April 30, 2018 20:46
-
-
Save lennyferguson/644dd213ddb22608a0c22708d7567044 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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