001/*
002 * (C) Copyright 2016 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 *     Gabriel Barata
018 */
019
020package org.nuxeo.functionaltests.pages.tabs;
021
022import org.nuxeo.functionaltests.pages.DocumentBasePage;
023import org.openqa.selenium.By;
024import org.openqa.selenium.WebDriver;
025
026/**
027 * @since 8.3
028 */
029public class LocalConfigSubPage extends DocumentBasePage {
030
031    public LocalConfigSubPage(WebDriver driver) {
032        super(driver);
033    }
034
035    public LocalConfigSubPage enableDocumentContentConfig() {
036        findElementWaitUntilEnabledAndClick(By.xpath("//a[contains(@id,'nxl_content_view_configuration_enable')]"));
037        return asPage(LocalConfigSubPage.class);
038    }
039
040    public LocalConfigSubPage disableDocumentContentConfig() {
041        findElementWaitUntilEnabledAndClick(By.xpath("//a[contains(@id,'nxl_content_view_configuration_disable')]"));
042        return asPage(LocalConfigSubPage.class);
043    }
044
045    public LocalConfigSubPage addDocumentContentConfig(String docType, String contentView) {
046        findElementWaitUntilEnabledAndClick(
047                By.xpath("//a[contains(@id,'nxl_content_view_configuration:nxw_content_view_selection_add')]"));
048
049        selectItemInDropDownMenu(
050                driver.findElement(By.xpath("//select[contains(@id, 'nxw_complexListItem:nxw_docType')]")), docType);
051
052        selectItemInDropDownMenu(
053                driver.findElement(By.xpath("//select[contains(@id, 'nxw_complexListItem:nxw_contentView')]")),
054                contentView);
055
056        findElementWaitUntilEnabledAndClick(By.xpath("//input[contains(@id,'nxl_content_view_configuration_save')]"));
057
058        return asPage(LocalConfigSubPage.class);
059    }
060}