001/*
002 * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials are made
005 * available under the terms of the GNU Lesser General Public License (LGPL)
006 * 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, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012 * details.
013 *
014 * Contributors:
015 *     Sun Seng David TAN <stan@nuxeo.com>
016 *     Antoine Taillefer
017 */
018package org.nuxeo.functionaltests.pages.forms;
019
020import org.nuxeo.functionaltests.Required;
021import org.nuxeo.functionaltests.pages.AbstractPage;
022import org.nuxeo.functionaltests.pages.DocumentBasePage;
023import org.openqa.selenium.WebDriver;
024import org.openqa.selenium.WebElement;
025import org.openqa.selenium.support.FindBy;
026
027/**
028 * @author Sun Seng David TAN <stan@nuxeo.com>
029 */
030public class WorkspaceFormPage extends AbstractPage {
031
032    @Required
033    @FindBy(id = "document_create:nxl_heading:nxw_title")
034    WebElement titleTextInput;
035
036    @Required
037    @FindBy(id = "document_create:nxl_heading:nxw_description")
038    WebElement descriptionTextInput;
039
040    @Required
041    @FindBy(id = "document_create:nxw_documentCreateButtons_CREATE_WORKSPACE")
042    WebElement createButton;
043
044    public WorkspaceFormPage(WebDriver driver) {
045        super(driver);
046    }
047
048    public DocumentBasePage createNewWorkspace(String workspaceTitle, String workspaceDescription) {
049        titleTextInput.sendKeys(workspaceTitle);
050        descriptionTextInput.sendKeys(workspaceDescription);
051        createButton.click();
052
053        return asPage(DocumentBasePage.class);
054    }
055
056}