001/* 002 * (C) Copyright 2014 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 * <a href="mailto:grenard@nuxeo.com">Guillaume</a> 018 */ 019package org.nuxeo.functionaltests.pages.forms; 020 021import org.nuxeo.functionaltests.Required; 022import org.nuxeo.functionaltests.pages.AbstractPage; 023import org.nuxeo.functionaltests.pages.DocumentBasePage; 024import org.openqa.selenium.WebDriver; 025import org.openqa.selenium.WebElement; 026import org.openqa.selenium.support.FindBy; 027 028/** 029 * @since 5.9.3 030 */ 031public class DublinCoreCreationDocumentFormPage extends AbstractPage { 032 033 @Required 034 @FindBy(id = "document_create:nxl_heading:nxw_title") 035 public WebElement titleTextInput; 036 037 @FindBy(id = "document_create:nxl_heading:nxw_title_message") 038 public WebElement titleTextInputMessage; 039 040 @Required 041 @FindBy(id = "document_create:nxl_heading:nxw_description") 042 public WebElement descriptionTextInput; 043 044 @Required 045 @FindBy(id = "document_create:nxw_documentCreateButtons_CREATE_DOCUMENT") 046 public WebElement createButton; 047 048 public DublinCoreCreationDocumentFormPage(WebDriver driver) { 049 super(driver); 050 } 051 052 public void create() { 053 createButton.click(); 054 } 055 056 protected void fillDublinCoreFieldsAndCreate(String title, String description) { 057 titleTextInput.sendKeys(title); 058 descriptionTextInput.sendKeys(description); 059 create(); 060 } 061 062 public DocumentBasePage createDocument(String title, String description) { 063 fillDublinCoreFieldsAndCreate(title, description); 064 return asPage(DocumentBasePage.class); 065 } 066 067 /** 068 * @since 7.1 069 */ 070 public String getTitleMessage() { 071 return titleTextInputMessage == null ? null : titleTextInputMessage.getText(); 072 } 073 074}