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