Skip to content
Snippets Groups Projects
Commit bdf06159 authored by srosse's avatar srosse
Browse files

OO-1949: selenium test for membership confirmation of a group with jump in url

parent d7387979
No related branches found
No related tags found
No related merge requests found
...@@ -371,7 +371,13 @@ public class BusinessGroupTest { ...@@ -371,7 +371,13 @@ public class BusinessGroupTest {
* *
* A standard user create a group and add a participant. * A standard user create a group and add a participant.
* The participant log-in and confirm its membership and * The participant log-in and confirm its membership and
* visit the group. * 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 * @param loginPage
* @throws IOException * @throws IOException
...@@ -381,9 +387,11 @@ public class BusinessGroupTest { ...@@ -381,9 +387,11 @@ public class BusinessGroupTest {
@RunAsClient @RunAsClient
public void confirmMembershipByGroup(@InitialPage LoginPage loginPage, public void confirmMembershipByGroup(@InitialPage LoginPage loginPage,
@Drone @User WebDriver ryomouBrowser, @Drone @User WebDriver ryomouBrowser,
@Drone @Participant WebDriver participantBrowser) @Drone @Participant WebDriver participantBrowser,
@Drone @Student WebDriver reiBrowser)
throws IOException, URISyntaxException { throws IOException, URISyntaxException {
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou"); UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser(); UserVO participant = new UserRestClient(deploymentUrl).createRandomUser();
//admin make the confirmation of membership mandatory //admin make the confirmation of membership mandatory
...@@ -409,12 +417,20 @@ public class BusinessGroupTest { ...@@ -409,12 +417,20 @@ public class BusinessGroupTest {
.openGroups(ryomouBrowser) .openGroups(ryomouBrowser)
.createGroup(groupName, "Confirmation group"); .createGroup(groupName, "Confirmation group");
MembersWizardPage members = group String groupUrl = group
.openAdministration() .openAdministration()
.openAdminMembers() .getGroupURL();
.addMember();
group.openAdminMembers()
members.searchMember(participant, false) .addMember()
.searchMember(participant, false)
.next()
.next()
.next()
.finish();
group.addMember()
.searchMember(rei, false)
.next() .next()
.next() .next()
.next() .next()
...@@ -432,6 +448,18 @@ public class BusinessGroupTest { ...@@ -432,6 +448,18 @@ public class BusinessGroupTest {
.selectGroup(groupName) .selectGroup(groupName)
.assertOnInfosPage(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 //reset the settings
administration.setGroupConfirmationForUser(false); administration.setGroupConfirmationForUser(false);
} }
......
...@@ -62,11 +62,18 @@ public class LoginPage { ...@@ -62,11 +62,18 @@ public class LoginPage {
private WebDriver browser; private WebDriver browser;
public static LoginPage getLoginPage(WebDriver browser, URL deployemntUrl) { public static LoginPage getLoginPage(WebDriver browser, URL deployemntUrl) {
LoginPage page = new LoginPage(); LoginPage page = new LoginPage(browser);
page.browser = browser; browser.navigate().to(deployemntUrl);
page.browser.navigate().to(deployemntUrl);
return page; return page;
} }
public LoginPage() {
//
}
public LoginPage(WebDriver browser) {
this.browser = browser;
}
public LoginPage assertOnLoginPage() { public LoginPage assertOnLoginPage() {
Assert.assertTrue(browser.findElement(loginFormBy).isDisplayed()); Assert.assertTrue(browser.findElement(loginFormBy).isDisplayed());
......
...@@ -180,6 +180,18 @@ public class GroupPage { ...@@ -180,6 +180,18 @@ public class GroupPage {
return this; return this;
} }
/**
* Grap the REST url of the group (only, you need
* to be in administration > description changes.
* @return
*/
public String getGroupURL() {
By urlBy = By.cssSelector("p.o_sel_group_url");
WebElement urlEl = browser.findElement(urlBy);
String url = urlEl.getText();
return url;
}
public void close() { public void close() {
By closeBy = By.cssSelector("a i.o_icon_close_tool"); By closeBy = By.cssSelector("a i.o_icon_close_tool");
browser.findElement(closeBy).click(); browser.findElement(closeBy).click();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment