From d77706e37eb6ae5c70f61892cde83cd3897ca41d Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Tue, 3 Nov 2015 10:16:14 +0100 Subject: [PATCH] OO-1740: fix selenium tests --- .../page/course/GroupTaskToCoachPage.java | 28 +++++++++++++------ .../selenium/page/graphene/OOGraphene.java | 4 +++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/olat/selenium/page/course/GroupTaskToCoachPage.java b/src/test/java/org/olat/selenium/page/course/GroupTaskToCoachPage.java index 772d3d9bf13..934e95dae6a 100644 --- a/src/test/java/org/olat/selenium/page/course/GroupTaskToCoachPage.java +++ b/src/test/java/org/olat/selenium/page/course/GroupTaskToCoachPage.java @@ -22,7 +22,6 @@ package org.olat.selenium.page.course; import java.io.File; import java.util.List; -import org.jboss.arquillian.drone.api.annotation.Drone; import org.junit.Assert; import org.olat.selenium.page.graphene.OOGraphene; import org.olat.user.restapi.UserVO; @@ -40,13 +39,8 @@ import org.openqa.selenium.WebElement; */ public class GroupTaskToCoachPage { - @Drone private WebDriver browser; - public GroupTaskToCoachPage() { - // - } - public GroupTaskToCoachPage(WebDriver browser) { this.browser = browser; } @@ -134,7 +128,16 @@ public class GroupTaskToCoachPage { public GroupTaskToCoachPage openIndividualAssessment() { By assessmentButtonBy = By.cssSelector("#o_step_grading_content .o_sel_course_gta_assessment_button"); - browser.findElement(assessmentButtonBy).click(); + List<WebElement> buttons = browser.findElements(assessmentButtonBy); + if(buttons.isEmpty() || !buttons.get(0).isDisplayed()) { + //open grading tab + By collpaseBy = By.xpath("//a[@href='#o_step_grading_content']"); + browser.findElement(collpaseBy).click(); + OOGraphene.waitElement(assessmentButtonBy, browser); + browser.findElement(assessmentButtonBy).click(); + } else { + buttons.get(0).click(); + } OOGraphene.waitBusy(browser); return this; } @@ -158,7 +161,16 @@ public class GroupTaskToCoachPage { public GroupTaskToCoachPage openGroupAssessment() { By assessmentButtonBy = By.cssSelector("#o_step_grading_content .o_sel_course_gta_assessment_button"); - browser.findElement(assessmentButtonBy).click(); + List<WebElement> buttons = browser.findElements(assessmentButtonBy); + if(buttons.isEmpty() || !buttons.get(0).isDisplayed()) { + //open grading tab + By collpaseBy = By.xpath("//a[@href='#o_step_grading_content']"); + browser.findElement(collpaseBy).click(); + OOGraphene.waitElement(assessmentButtonBy, browser); + browser.findElement(assessmentButtonBy).click(); + } else { + buttons.get(0).click(); + } OOGraphene.waitBusy(browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java b/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java index 39d1fdfb1ab..ea13a8d1b19 100644 --- a/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java +++ b/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java @@ -136,6 +136,10 @@ public class OOGraphene { return Locale.ENGLISH; } + /** + * Wait the end of the transition of the user's tools bar. + * @param browser + */ public static final void waitingTransition(WebDriver browser) { Graphene.waitModel(browser).pollingEvery(poolingDuration, TimeUnit.MILLISECONDS).until(new TransitionPredicate()); waitingALittleBit(); -- GitLab