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

no-jira: selenium to test the landing page set in user preferences

parent 67662e03
No related branches found
No related tags found
No related merge requests found
......@@ -244,6 +244,7 @@ class SpecialPrefsForm extends FormBasicController {
}
landingPageEl = uifactory.addTextElement("landingpages", "landing.pages", 256, "", formLayout);
landingPageEl.setElementCssClass("o_sel_home_settings_landing_page");
update();
......
......@@ -45,6 +45,7 @@ import org.olat.selenium.page.User;
import org.olat.selenium.page.course.CoursePageFragment;
import org.olat.selenium.page.graphene.OOGraphene;
import org.olat.selenium.page.group.GroupsPage;
import org.olat.selenium.page.repository.AuthoringEnvPage;
import org.olat.selenium.page.user.ImportUserPage;
import org.olat.selenium.page.user.PortalPage;
import org.olat.selenium.page.user.UserAdminPage;
......@@ -226,6 +227,45 @@ public class UserTest {
loginPage.assertLoggedIn(user);
}
/**
* An user configures its landing page, log out
* and try it.
*
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void loginInHomeWithLandingPage(@InitialPage LoginPage loginPage)
throws IOException, URISyntaxException {
//create a random user
UserRestClient userClient = new UserRestClient(deploymentUrl);
UserVO user = userClient.createAuthor();
loginPage
.assertOnLoginPage()
.loginAs(user.getLogin(), user.getPassword());
userTools
.openUserToolsMenu()
.openMySettings()
.openPreferences()
.setResume(ResumeOption.none)
.setLandingPage("/RepositorySite/0/Search/0");
userTools.logout();
loginPage
.assertOnLoginPage()
.loginAs(user.getLogin(), user.getPassword());
new AuthoringEnvPage(browser)
.assertOnGenericSearch();
}
/**
* Jump to notifications in home, go to the courses and return
* to home's notification with a REST url.
......
......@@ -51,6 +51,19 @@ public class AuthoringEnvPage {
this.browser = browser;
}
/**
* Check that the segment for the "Search" in author environment is selected.
*
* @return
*/
public AuthoringEnvPage assertOnGenericSearch() {
By genericSearchBy = By.xpath("//div[contains(@class,'o_segments')]//a[contains(@class,'btn-primary')][contains(@onclick,'search.generic')]");
OOGraphene.waitElement(genericSearchBy, 5, browser);
WebElement genericSearchSegment = browser.findElement(genericSearchBy);
Assert.assertTrue(genericSearchSegment.isDisplayed());
return this;
}
public RepositoryEditDescriptionPage createCP(String title) {
return openCreateDropDown()
.clickCreate(ResourceType.cp)
......
......@@ -94,6 +94,21 @@ public class UserPreferencesPageFragment {
WebElement saveButton = browser.findElement(saveSystemSettingsButton);
saveButton.click();
OOGraphene.waitBusy(browser);
OOGraphene.waitAndCloseBlueMessageWindow(browser);
return this;
}
/**
* Set the landing page
* @param businessPath
* @return
*/
public UserPreferencesPageFragment setLandingPage(String businessPath) {
By landingPageBy = By.cssSelector("div.o_sel_home_settings_landing_page input[type='text']");
browser.findElement(landingPageBy).sendKeys(businessPath);
browser.findElement(saveSystemSettingsButton).click();
OOGraphene.waitBusy(browser);
OOGraphene.waitAndCloseBlueMessageWindow(browser);
return this;
}
......
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