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 * Antoine Taillefer 017 */ 018package org.nuxeo.functionaltests.pages.admincenter.usermanagement; 019 020import static org.junit.Assert.assertEquals; 021 022import org.nuxeo.functionaltests.Required; 023import org.openqa.selenium.Alert; 024import org.openqa.selenium.By; 025import org.openqa.selenium.WebDriver; 026import org.openqa.selenium.WebElement; 027import org.openqa.selenium.support.FindBy; 028 029/** 030 * View user details (New one in the admin center) 031 * 032 * @since 5.4.2 033 */ 034public class UserViewTabSubPage extends UsersGroupsBasePage { 035 036 @Required 037 @FindBy(linkText = "View") 038 WebElement viewUserTab; 039 040 @FindBy(linkText = "Delete") 041 WebElement deleteUserLink; 042 043 @FindBy(linkText = "Edit") 044 WebElement editLink; 045 046 @FindBy(linkText = "Change Password") 047 WebElement changePasswordLink; 048 049 @FindBy(xpath = "//div[@id='nxw_userCenterSubTabs_tab_content']//h1") 050 WebElement currentUserName; 051 052 public UserViewTabSubPage(WebDriver driver) { 053 super(driver); 054 } 055 056 public UsersTabSubPage deleteUser() { 057 deleteUserLink.click(); 058 Alert alert = driver.switchTo().alert(); 059 assertEquals("Delete user?", alert.getText()); 060 alert.accept(); 061 return asPage(UsersTabSubPage.class); 062 } 063 064 public UserEditFormPage getEditUserTab() { 065 editLink.click(); 066 return asPage(UserEditFormPage.class); 067 } 068 069 public UserChangePasswordFormPage getChangePasswordUserTab() { 070 changePasswordLink.click(); 071 return asPage(UserChangePasswordFormPage.class); 072 } 073 074 public UsersTabSubPage backToTheList() { 075 findElementWaitUntilEnabledAndClick(By.linkText("Back to the List")); 076 return asPage(UsersTabSubPage.class); 077 } 078 079 /** 080 * @since 6.0 081 */ 082 public void checkUserName(String expectedName) { 083 assertEquals(expectedName, getCurrentUserName().getText()); 084 } 085 086 /** 087 * @since 6.0 088 */ 089 public WebElement getCurrentUserName() { 090 return currentUserName; 091 } 092}