001/*
002 * (C) Copyright 2014 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-2.1.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 *     <a href="mailto:glefevre@nuxeo.com">Gildas</a>
016 */
017package org.nuxeo.functionaltests.pages.forms;
018
019import org.nuxeo.functionaltests.forms.RichEditorElement;
020import org.nuxeo.functionaltests.pages.NoteDocumentBasePage;
021import org.openqa.selenium.WebDriver;
022
023/**
024 * Form to create a new Note document.
025 *
026 * @since 5.9.4
027 */
028public class NoteCreationFormPage extends DublinCoreCreationDocumentFormPage {
029
030    /**
031     * @param driver
032     */
033    public NoteCreationFormPage(WebDriver driver) {
034        super(driver);
035    }
036
037    public NoteDocumentBasePage createNoteDocument(String title, String description, boolean defineNote,
038            String noteContent) {
039        titleTextInput.sendKeys(title);
040        descriptionTextInput.sendKeys(description);
041
042        if (defineNote) {
043            RichEditorElement editor = new RichEditorElement(driver, "document_create:nxl_note:nxw_note_editor");
044            editor.setInputValue(noteContent);
045        }
046
047        create();
048        return asPage(NoteDocumentBasePage.class);
049    }
050}