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.nuxeo.functionaltests.forms.Select2WidgetElement;
021import org.openqa.selenium.WebDriver;
022import org.openqa.selenium.WebElement;
023import org.openqa.selenium.support.FindBy;
024
025/**
026 * Edit group details
027 *
028 * @since 7.2
029 */
030public class GroupEditFormPage extends UsersGroupsBasePage {
031
032    @Required
033    @FindBy(id = "viewGroupView:editGroup:nxl_group_1:nxw_group_label_1")
034    WebElement labelInput;
035
036    @Required
037    @FindBy(id = "s2id_viewGroupView:editGroup:nxl_group_1:nxw_group_members_1_select2")
038    WebElement membersSelect;
039
040    @Required
041    @FindBy(id = "s2id_viewGroupView:editGroup:nxl_group_1:nxw_group_subgroups_1_select2")
042    WebElement subgroupsSelect;
043
044    @Required
045    @FindBy(xpath = "//input[@value=\"Save\"]")
046    WebElement saveButton;
047
048    public GroupEditFormPage(WebDriver driver) {
049        super(driver);
050    }
051
052    public void setLabel(String label) {
053        labelInput.clear();
054        labelInput.sendKeys(label);
055    }
056
057    public void setMembers(String... members) {
058        new Select2WidgetElement(driver, membersSelect, true).selectValues(members);
059    }
060
061    public void setSubGroups(String... subgroups) {
062        new Select2WidgetElement(driver, subgroupsSelect, true).selectValues(subgroups);
063    }
064
065}