001/*
002 * (C) Copyright 2011 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 *     Sun Seng David TAN <stan@nuxeo.com>
018 *     Antoine Taillefer
019 */
020package org.nuxeo.functionaltests.pages.forms;
021
022import org.nuxeo.functionaltests.Required;
023import org.nuxeo.functionaltests.pages.AbstractPage;
024import org.nuxeo.functionaltests.pages.DocumentBasePage;
025import org.openqa.selenium.WebDriver;
026import org.openqa.selenium.WebElement;
027import org.openqa.selenium.support.FindBy;
028
029/**
030 * @author Sun Seng David TAN <stan@nuxeo.com>
031 * @since 8.3
032 */
033public class WorkspaceCreationFormPage extends AbstractPage {
034
035    @Required
036    @FindBy(id = "document_create:nxl_heading:nxw_title")
037    WebElement titleTextInput;
038
039    @Required
040    @FindBy(id = "document_create:nxl_heading:nxw_description")
041    WebElement descriptionTextInput;
042
043    @Required
044    @FindBy(id = "document_create:nxw_documentCreateButtons_CREATE_WORKSPACE")
045    WebElement createButton;
046
047    public WorkspaceCreationFormPage(WebDriver driver) {
048        super(driver);
049    }
050
051    public DocumentBasePage createNewWorkspace(String workspaceTitle, String workspaceDescription) {
052        titleTextInput.sendKeys(workspaceTitle);
053        descriptionTextInput.sendKeys(workspaceDescription);
054        createButton.click();
055
056        return asPage(DocumentBasePage.class);
057    }
058
059}