001/*
002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nelson Silva
018 */
019package org.nuxeo.functionaltests.pages.admincenter.usermanagement;
020
021import org.nuxeo.functionaltests.Required;
022import org.openqa.selenium.Alert;
023import org.openqa.selenium.By;
024import org.openqa.selenium.WebDriver;
025import org.openqa.selenium.WebElement;
026import org.openqa.selenium.support.FindBy;
027
028import static org.junit.Assert.assertEquals;
029
030/**
031 * View group details
032 *
033 * @since 7.2
034 */
035public class GroupViewTabSubPage extends UsersGroupsBasePage {
036
037    @Required
038    @FindBy(linkText = "View")
039    WebElement viewGroupTab;
040
041    @FindBy(linkText = "Delete")
042    WebElement deleteGroupLink;
043
044    @FindBy(linkText = "Edit")
045    WebElement editLink;
046
047    public GroupViewTabSubPage(WebDriver driver) {
048        super(driver);
049    }
050
051    public GroupsTabSubPage deleteGroup() {
052        deleteGroupLink.click();
053        Alert alert = driver.switchTo().alert();
054        assertEquals("Delete group?", alert.getText());
055        alert.accept();
056        return asPage(GroupsTabSubPage.class);
057    }
058
059    public GroupEditFormPage getEditGroupTab() {
060        editLink.click();
061        return asPage(GroupEditFormPage.class);
062    }
063
064    public GroupsTabSubPage backToTheList() {
065        findElementWaitUntilEnabledAndClick(By.linkText("Back to the list"));
066        return asPage(GroupsTabSubPage.class);
067    }
068}