Stabilize course tests against catalog changes
This commit is contained in:
@@ -69,6 +69,28 @@ public class CatalogPage {
|
||||
return new CoursePage(driver);
|
||||
}
|
||||
|
||||
public CoursePage clickFirstCourse() {
|
||||
PageUtils.removeBottomBanner(driver);
|
||||
|
||||
final WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(15));
|
||||
wait.until((ExpectedCondition<Boolean>) drv -> !drv.findElements(courseLinks).isEmpty());
|
||||
|
||||
final WebElement course = driver.findElements(courseLinks).stream()
|
||||
.filter(e -> !e.getText().isBlank())
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new NoSuchElementException("No course links found in catalog"));
|
||||
|
||||
((JavascriptExecutor) driver)
|
||||
.executeScript("arguments[0].scrollIntoView({block:'center'});", course);
|
||||
|
||||
new Actions(driver)
|
||||
.moveToElement(course)
|
||||
.perform();
|
||||
course.click();
|
||||
|
||||
return new CoursePage(driver);
|
||||
}
|
||||
|
||||
public List<CourseCard> getAllCourseCards() {
|
||||
final WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20));
|
||||
wait.until((ExpectedCondition<Boolean>) drv -> !drv.findElements(courseCards).isEmpty());
|
||||
|
||||
Reference in New Issue
Block a user