diff --git a/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java b/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java index 2bdbbb4c140725a1fd5e6b981415e97c64a54829..75d0a24bda6981ed7681aec411d138f76dabc04a 100644 --- a/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java +++ b/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java @@ -383,7 +383,7 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController private void initRole() { rolesDropdown = new Dropdown("toolbox.roles", "role.switch", false, getTranslator()); - rolesDropdown.setElementCssClass("o_with_labeled"); + rolesDropdown.setElementCssClass("o_sel_switch_role o_with_labeled"); rolesDropdown.setIconCSS("o_icon " + getCurrentRoleIcon()); rolesDropdown.setInnerText(translate("role." + reSecurity.getCurrentRole())); rolesDropdown.setInnerCSS("o_labeled"); diff --git a/src/test/java/org/olat/selenium/AssessmentTest.java b/src/test/java/org/olat/selenium/AssessmentTest.java index 7c2c403bc2bc45dffa5d3a4a8e90066bd7955860..25440e41db1be851cfcb650f0634097fdf77c941 100644 --- a/src/test/java/org/olat/selenium/AssessmentTest.java +++ b/src/test/java/org/olat/selenium/AssessmentTest.java @@ -34,6 +34,7 @@ import org.jboss.arquillian.test.api.ArquillianResource; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.olat.repository.model.SingleRoleRepositoryEntrySecurity.Role; import org.olat.selenium.page.LoginPage; import org.olat.selenium.page.NavigationPage; import org.olat.selenium.page.Participant; @@ -148,6 +149,7 @@ public class AssessmentTest extends Deployments { .selectResource(courseTitle); course + .switchRole(Role.participant) .clickTree() .selectWithTitle(testNodeTitle); diff --git a/src/test/java/org/olat/selenium/CourseTest.java b/src/test/java/org/olat/selenium/CourseTest.java index d2254ee4651ce3523daa0e2c0e6d054f025c2d72..4407396348715120592df4129811b82b72cdd2af 100644 --- a/src/test/java/org/olat/selenium/CourseTest.java +++ b/src/test/java/org/olat/selenium/CourseTest.java @@ -247,6 +247,13 @@ public class CourseTest extends Deployments { .nextCatalog() .finish(); OOGraphene.closeBlueMessageWindow(browser); + + RepositorySettingsPage settings = new RepositorySettingsPage(browser); + //from description editor, back to details and launch the course + settings + .assertOnInfos(); + settings + .back(); //open course editor CoursePageFragment course = CoursePageFragment.getCourse(browser); diff --git a/src/test/java/org/olat/selenium/ImsQTI21Test.java b/src/test/java/org/olat/selenium/ImsQTI21Test.java index 7c87f92ca21fe62f395549b5567507b39e776e47..aac8c62a4cc7f20c3e74b8d44ff56f50f667303f 100644 --- a/src/test/java/org/olat/selenium/ImsQTI21Test.java +++ b/src/test/java/org/olat/selenium/ImsQTI21Test.java @@ -33,6 +33,7 @@ import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.olat.ims.qti21.QTI21AssessmentResultsOptions; +import org.olat.repository.model.SingleRoleRepositoryEntrySecurity.Role; import org.olat.selenium.page.LoginPage; import org.olat.selenium.page.NavigationPage; import org.olat.selenium.page.User; @@ -610,6 +611,7 @@ public class ImsQTI21Test extends Deployments { .selectResource(courseTitle); course + .switchRole(Role.participant) .clickTree() .selectWithTitle(testNodeTitle); @@ -716,6 +718,7 @@ public class ImsQTI21Test extends Deployments { .selectResource(courseTitle); course + .switchRole(Role.participant) .clickTree() .selectWithTitle(testNodeTitle); @@ -831,15 +834,16 @@ public class ImsQTI21Test extends Deployments { .selectResource(courseTitle); course + .switchRole(Role.participant) .clickTree() .selectWithTitle(testNodeTitle); //check that the title of the start page of test is correct WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2")); Assert.assertEquals(testNodeTitle, testH2.getText().trim()); - + QTI21Page qtiPage = QTI21Page - .getQTI21Page(browser); + .getQTI21Page(browser); qtiPage .assertOnStart() .start() @@ -856,6 +860,10 @@ public class ImsQTI21Test extends Deployments { authorLoginPage .loginAs(author.getLogin(), author.getPassword()) .resume(); + + course + .switchRole(Role.participant); + //resume the course, resume the test qtiPage = QTI21Page .getQTI21Page(browser); diff --git a/src/test/java/org/olat/selenium/page/course/CoursePageFragment.java b/src/test/java/org/olat/selenium/page/course/CoursePageFragment.java index 3589a5ec0179567d77a7b2e74085f952dc535f3c..a45dcb328a4caecbaa66d7fb248c016065f900c7 100644 --- a/src/test/java/org/olat/selenium/page/course/CoursePageFragment.java +++ b/src/test/java/org/olat/selenium/page/course/CoursePageFragment.java @@ -24,6 +24,7 @@ import java.util.List; import org.junit.Assert; import org.olat.repository.RepositoryEntryStatusEnum; +import org.olat.repository.model.SingleRoleRepositoryEntrySecurity.Role; import org.olat.restapi.support.vo.CourseVO; import org.olat.selenium.page.core.BookingPage; import org.olat.selenium.page.core.MenuTreePageFragment; @@ -297,6 +298,31 @@ public class CoursePageFragment { return this; } + public CoursePageFragment switchRole(Role role) { + String cssRole; + switch(role) { + case participant: cssRole = "o_icon_user"; break; + case coach: cssRole = "o_icon_coach"; break; + case owner: cssRole = "o_icon_owner"; break; + default: cssRole = "o_icon_unkown"; break; + } + + By statusMenuBy = By.cssSelector("ul.o_sel_switch_role"); + if(!browser.findElement(statusMenuBy).isDisplayed()) { + By statusMenuCaret = By.cssSelector("a.o_sel_switch_role"); + browser.findElement(statusMenuCaret).click(); + OOGraphene.waitElement(statusMenuBy, browser); + } + + By statusBy = By.cssSelector("ul.o_sel_switch_role>li>a>i." + cssRole); + browser.findElement(statusBy).click(); + OOGraphene.waitBusy(browser); + + By statusViewBy = By.xpath("//li[contains(@class,'o_tool_dropdown')]/a[contains(@class,'o_sel_switch_role')]/span/i[contains(@class,'" + cssRole + "')]"); + OOGraphene.waitElement(statusViewBy, browser); + return this; + } + /** * Close the course