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 org.nuxeo.functionaltests.Required;
020import org.openqa.selenium.WebDriver;
021import org.openqa.selenium.WebElement;
022import org.openqa.selenium.support.FindBy;
023
024public class UserChangePasswordFormPage extends UsersGroupsBasePage {
025
026    @Required
027    @FindBy(id = "editUser:nxl_user:nxw_firstPassword")
028    WebElement firstPasswordInput;
029
030    @Required
031    @FindBy(id = "editUser:nxl_user:nxw_secondPassword")
032    WebElement secondPasswordInput;
033
034    @Required
035    @FindBy(xpath = "//form[@id=\"editUser\"]//input[@value=\"Save\"]")
036    WebElement saveButton;
037
038    public UserChangePasswordFormPage(WebDriver driver) {
039        super(driver);
040    }
041
042    public UserViewTabSubPage changePassword(String password) {
043        firstPasswordInput.clear();
044        firstPasswordInput.sendKeys(password);
045        secondPasswordInput.clear();
046        secondPasswordInput.sendKeys(password);
047        saveButton.click();
048        return asPage(UserViewTabSubPage.class);
049    }
050
051}