001/*
002 * (C) Copyright 2015 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 *     Nelson Silva
016 */
017package org.nuxeo.functionaltests.pages.admincenter.usermanagement;
018
019import org.nuxeo.functionaltests.Required;
020import org.openqa.selenium.Alert;
021import org.openqa.selenium.By;
022import org.openqa.selenium.WebDriver;
023import org.openqa.selenium.WebElement;
024import org.openqa.selenium.support.FindBy;
025
026import static org.junit.Assert.assertEquals;
027
028/**
029 * View group details
030 *
031 * @since 7.2
032 */
033public class GroupViewTabSubPage extends UsersGroupsBasePage {
034
035    @Required
036    @FindBy(linkText = "View")
037    WebElement viewGroupTab;
038
039    @FindBy(linkText = "Delete")
040    WebElement deleteGroupLink;
041
042    @FindBy(linkText = "Edit")
043    WebElement editLink;
044
045    public GroupViewTabSubPage(WebDriver driver) {
046        super(driver);
047    }
048
049    public GroupsTabSubPage deleteGroup() {
050        deleteGroupLink.click();
051        Alert alert = driver.switchTo().alert();
052        assertEquals("Delete group?", alert.getText());
053        alert.accept();
054        return asPage(GroupsTabSubPage.class);
055    }
056
057    public GroupEditFormPage getEditGroupTab() {
058        editLink.click();
059        return asPage(GroupEditFormPage.class);
060    }
061
062    public GroupsTabSubPage backToTheList() {
063        findElementWaitUntilEnabledAndClick(By.linkText("Back to the list"));
064        return asPage(GroupsTabSubPage.class);
065    }
066}