001/*
002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Benoit Delbosc
016 */
017package org.nuxeo.functionaltests.pages.usermanagement.compat;
018
019import static org.junit.Assert.assertEquals;
020
021import org.openqa.selenium.Alert;
022import org.openqa.selenium.WebDriver;
023import org.openqa.selenium.WebElement;
024import org.openqa.selenium.support.FindBy;
025
026/**
027 * View user details
028 */
029public class UserViewTabSubPage extends UsersGroupsBasePage {
030
031    @FindBy(linkText = "Delete")
032    WebElement deleteUserLink;
033
034    @FindBy(linkText = "Edit")
035    WebElement editLink;
036
037    @FindBy(linkText = "Change password")
038    WebElement changePasswordLink;
039
040    public UserViewTabSubPage(WebDriver driver) {
041        super(driver);
042    }
043
044    public UsersTabSubPage deleteUser() {
045        deleteUserLink.click();
046        Alert alert = driver.switchTo().alert();
047        assertEquals("Delete user?", alert.getText());
048        alert.accept();
049        return asPage(UsersTabSubPage.class);
050    }
051
052    public UserEditFormPage getEditUserTab() {
053        editLink.click();
054        return asPage(UserEditFormPage.class);
055    }
056
057    public UserChangePasswordFormPage getChangePasswordUserTab() {
058        changePasswordLink.click();
059        return asPage(UserChangePasswordFormPage.class);
060    }
061
062}