Search in sources :

Example 1 with LoginPage

use of org.olat.selenium.page.LoginPage in project OpenOLAT by OpenOLAT.

the class UserTest method importExistingUsers.

/**
 * Import 1 new user and 1 existing, change the password and the last name
 * of the existing user.
 *
 * @param loginPage
 * @param existingUserBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void importExistingUsers(@InitialPage LoginPage loginPage, @Drone @User WebDriver existingUserBrowser, @Drone @Student WebDriver newUserBrowser) throws IOException, URISyntaxException {
    UserVO user1 = new UserRestClient(deploymentUrl).createRandomUser("tsukune");
    // login
    loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
    UserAdminPage userAdminPage = navBar.openUserManagement().openImportUsers();
    // start import wizard
    ImportUserPage importWizard = userAdminPage.startImport();
    String uuid = UUID.randomUUID().toString();
    String username1 = "moka-" + uuid;
    StringBuilder csv = new StringBuilder();
    UserVO newUser = importWizard.append(username1, "rosario02", "Moka", "Akashiya", csv);
    user1 = importWizard.append(user1, "Aono", "openolat2", csv);
    importWizard.fill(csv.toString()).nextData().assertGreen(1).assertWarn(1).updatePasswords().updateUsers().nextOverview().nextGroups().finish();
    OOGraphene.waitAndCloseBlueMessageWindow(browser);
    // existing user log in with its new password and check if its name was updated
    LoginPage userLoginPage = LoginPage.getLoginPage(existingUserBrowser, deploymentUrl);
    // tools
    userLoginPage.loginAs(user1.getLogin(), "openolat2").resume().assertLoggedInByLastName("Aono");
    // new user log in
    LoginPage newLoginPage = LoginPage.getLoginPage(newUserBrowser, deploymentUrl);
    // tools
    newLoginPage.loginAs(newUser.getLogin(), "rosario02").resume().assertLoggedInByLastName("Akashiya");
}
Also used : UserVO(org.olat.user.restapi.UserVO) UserAdminPage(org.olat.selenium.page.user.UserAdminPage) ImportUserPage(org.olat.selenium.page.user.ImportUserPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with LoginPage

use of org.olat.selenium.page.LoginPage in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method createGroupWithWaitingList.

/**
 * An author creates a group, it opens the tab groups and then "My groups". It
 * creates a group, enters a number of participants "1", enable the waiting
 * list. In members visibility, it see coaches, participants and waiting
 * list visible to members.<br>
 * A participant and than a student come, book the group. The first enters
 * the group, the second the waiting list.<br>
 * The author go in the members list to check if it's in the coach list,
 * the participant in the participants list and the student in the waiting
 * list.
 *
 * Should show group starting page, with menu items Administration and Bookings visible
 *
 * @param loginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createGroupWithWaitingList(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver studentBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createRandomUser("Selena");
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO student = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // go to groups
    String groupName = "Group-1-" + UUID.randomUUID();
    GroupPage group = navBar.openGroups(browser).createGroup(groupName, "A group with a waiting list").openAdministration().openEditDetails().setMaxNumberOfParticipants(1).setWaitingList().saveDetails();
    // add booking ( token one )
    String token = "secret";
    String description = "The password is secret";
    group.openBookingConfig().openAddDropMenu().addTokenMethod().configureTokenMethod(token, description).assertOnToken(token);
    // members see members
    group = GroupPage.getGroup(browser).openAdminMembers().setVisibility(true, true, true).openMembers();
    // participant search published groups
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    // tools
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
    // groups
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openGroups(participantBrowser).publishedGroups().bookGroup(groupName).bookToken(token);
    // are we that we are in the right group?
    GroupPage.getGroup(participantBrowser).assertOnInfosPage(groupName);
    // student search published groups
    LoginPage studentLoginPage = LoginPage.getLoginPage(studentBrowser, deploymentUrl);
    // tools
    studentLoginPage.loginAs(student.getLogin(), student.getPassword()).resume();
    // groups
    NavigationPage studentNavBar = new NavigationPage(studentBrowser);
    studentNavBar.openGroups(studentBrowser).publishedGroups().bookGroup(groupName).bookToken(token);
    // are we that we are in the right group?
    GroupPage.getGroup(studentBrowser).assertOnWaitingList(groupName);
    group = GroupPage.getGroup(browser).openMembers().assertMembersInOwnerList(author).assertMembersInParticipantList(participant).assertMembersInWaitingList(student);
}
Also used : UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) GroupPage(org.olat.selenium.page.group.GroupPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 3 with LoginPage

use of org.olat.selenium.page.LoginPage in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method groupChat.

/**
 * An author create a group, set the visibility to true for owners
 * and participants, enable the tools and add 2 users to it. The 2
 * users joins the chat. All three send some messages and read them.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void groupChat(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver kanuBrowser, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // go to groups
    String groupName = "Group-Chat-1-" + UUID.randomUUID();
    GroupPage group = navBar.openGroups(browser).createGroup(groupName, "A very little group to chat");
    group.openAdministration().openAdminTools().enableTools().openAdminMembers().setVisibility(true, true, false);
    // add Kanu to the group
    group.openAdminMembers().addMember().searchMember(kanu, true).nextUsers().nextOverview().nextPermissions().finish();
    // add Ryomou
    group.addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
    // Kanu open the group
    LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
    kanuLoginPage.loginAs(kanu.getLogin(), kanu.getPassword()).resume();
    NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
    GroupPage kanuGroup = kanuNavBar.openGroups(kanuBrowser).selectGroup(groupName);
    // Ryomou open the group
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    IMPage ryomouIM = ryomouNavBar.openGroups(ryomouBrowser).selectGroup(groupName).openChat().openGroupChat();
    // Author send a message to Kanu
    String msg1 = "Hello Kanu " + UUID.randomUUID();
    IMPage authorIM = group.openChat().openGroupChat().sendMessage(msg1).assertOnMessage(msg1);
    String msg2 = "Hello dear author " + UUID.randomUUID();
    // Kanu opens her chat window
    IMPage kanuIM = kanuGroup.openChat().openGroupChat().assertOnMessage(msg1).sendMessage(msg2);
    String msg3 = "Hello Kanu and author " + UUID.randomUUID();
    // Ryomou reads her messages
    ryomouIM.sendMessage(msg3).assertOnMessage(msg1).assertOnMessage(msg2);
    // Kanu reads her message
    kanuIM.assertOnMessage(msg3);
    // Author reads too
    authorIM.assertOnMessage(msg2).assertOnMessage(msg3);
}
Also used : UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) GroupPage(org.olat.selenium.page.group.GroupPage) IMPage(org.olat.selenium.page.core.IMPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 4 with LoginPage

use of org.olat.selenium.page.LoginPage in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method groupMembersVisibility.

/**
 * An author create a group, set the visibility to
 * show owners and participants. Add a member to the
 * group.
 *
 * The participant log in, search the group and open it.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void groupMembersVisibility(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createRandomUser("Selena");
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Aoi");
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // go to groups
    String groupName = "Group-1-" + UUID.randomUUID();
    GroupPage group = navBar.openGroups(browser).createGroup(groupName, "A very little group");
    MembersWizardPage members = group.openAdministration().openAdminMembers().setVisibility(true, true, false).addMember();
    members.searchMember(participant, false).nextUsers().nextOverview().nextPermissions().finish();
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    // tools
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openGroups(participantBrowser).selectGroup(groupName);
    WebElement contentEl = participantBrowser.findElement(By.id("o_main_center_content_inner"));
    String content = contentEl.getText();
    Assert.assertTrue(content.contains(groupName));
}
Also used : MembersWizardPage(org.olat.selenium.page.group.MembersWizardPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) GroupPage(org.olat.selenium.page.group.GroupPage) WebElement(org.openqa.selenium.WebElement) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 5 with LoginPage

use of org.olat.selenium.page.LoginPage in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method confirmMembershipByGroup.

/**
 * First, an administrator make in administration part
 * the confirmation of group's membership mandatory if
 * the group is created by a standard user.<br>
 *
 * A standard user create a group and add a participant.
 * The participant log-in and confirm its membership and
 * visit the group.<br>
 *
 * A first user log in, confirm the membership and search
 * the group.<br>
 *
 * A second user log in but with a rest url to the group
 * and jump to the group after confirming the membership.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void confirmMembershipByGroup(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser();
    // admin make the confirmation of membership mandatory
    // for groups created by standard users.
    loginPage.loginAs("administrator", "openolat").resume();
    AdministrationPage administration = new NavigationPage(browser).openAdministration().openGroupSettings().setGroupConfirmationForUser(true);
    // a standard user create a group
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    // go to groups
    String groupName = "Group-1-" + UUID.randomUUID();
    NavigationPage rymouNavBar = new NavigationPage(ryomouBrowser);
    GroupPage group = rymouNavBar.openGroups(ryomouBrowser).createGroup(groupName, "Confirmation group");
    String groupUrl = group.openAdministration().getGroupURL();
    group.openAdminMembers().addMember().searchMember(participant, false).nextUsers().nextOverview().nextPermissions().finish();
    group.addMember().searchMember(rei, false).nextUsers().nextOverview().nextPermissions().finish();
    // participant login
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openGroups(participantBrowser).selectGroup(groupName).assertOnInfosPage(groupName);
    // second participant log in with rest url
    reiBrowser.get(groupUrl);
    new LoginPage(reiBrowser).loginAs(rei.getLogin(), rei.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openGroups(reiBrowser).selectGroup(groupName).assertOnInfosPage(groupName);
    // reset the settings
    administration.setGroupConfirmationForUser(false);
}
Also used : AdministrationPage(org.olat.selenium.page.core.AdministrationPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) GroupPage(org.olat.selenium.page.group.GroupPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)116 Test (org.junit.Test)116 LoginPage (org.olat.selenium.page.LoginPage)116 UserVO (org.olat.user.restapi.UserVO)114 UserRestClient (org.olat.test.rest.UserRestClient)108 NavigationPage (org.olat.selenium.page.NavigationPage)100 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)54 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)40 QTI21Page (org.olat.selenium.page.qti.QTI21Page)40 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)38 URL (java.net.URL)32 File (java.io.File)30 MembersPage (org.olat.selenium.page.course.MembersPage)28 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)24 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)18 WebElement (org.openqa.selenium.WebElement)12 GroupPage (org.olat.selenium.page.group.GroupPage)10 QTI21MatchEditorPage (org.olat.selenium.page.qti.QTI21MatchEditorPage)10 By (org.openqa.selenium.By)10 Calendar (java.util.Calendar)8