001/* 002 * (C) Copyright 2011 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 * Sun Seng David TAN <stan@nuxeo.com> 016 * Antoine Taillefer 017 */ 018package org.nuxeo.functionaltests.pages.tabs; 019 020import org.nuxeo.functionaltests.Required; 021import org.nuxeo.functionaltests.pages.AbstractPage; 022import org.nuxeo.functionaltests.pages.DocumentBasePage; 023import org.openqa.selenium.By; 024import org.openqa.selenium.WebDriver; 025import org.openqa.selenium.WebElement; 026import org.openqa.selenium.support.FindBy; 027 028/** 029 * @author Sun Seng David TAN <stan@nuxeo.com> 030 */ 031public class EditTabSubPage extends AbstractPage { 032 033 public static final String MAJOR_VERSION_INCREMENT_VALUE = "ACTION_INCREMENT_MAJOR"; 034 035 public static final String MINOR_VERSION_INCREMENT_VALUE = "ACTION_INCREMENT_MINOR"; 036 037 @FindBy(id = "document_edit:nxl_heading:nxw_title") 038 WebElement titleInputText; 039 040 @FindBy(id = "document_edit:nxl_heading:nxw_description") 041 WebElement descriptionInputText; 042 043 @Required 044 @FindBy(id = "document_edit:nxw_documentEditButtons_EDIT_CURRENT_DOCUMENT") 045 WebElement save; 046 047 public EditTabSubPage(WebDriver driver) { 048 super(driver); 049 } 050 051 /** 052 * By default 053 * 054 * @param title 055 * @param description 056 */ 057 public DocumentBasePage edit(String title, String description, String versionIncrementLabel) { 058 059 if (title != null) { 060 titleInputText.clear(); 061 titleInputText.sendKeys(title); 062 } 063 if (description != null) { 064 descriptionInputText.clear(); 065 descriptionInputText.sendKeys(description); 066 } 067 if (versionIncrementLabel != null) { 068 WebElement versionIncrementRadio = driver.findElement(By.xpath("//input[@value=\"" + versionIncrementLabel 069 + "\"]")); 070 versionIncrementRadio.click(); 071 } 072 073 save.click(); 074 075 return asPage(DocumentBasePage.class); 076 } 077 078 /** 079 * Save the modifications. 080 * 081 * @since 5.7.3 082 */ 083 public DocumentBasePage save() { 084 save.click(); 085 return asPage(DocumentBasePage.class); 086 } 087 088}