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 Renard</a>
018 *
019 */
020
021package org.nuxeo.functionaltests.pages.workflow;
022
023import java.util.List;
024
025import org.nuxeo.functionaltests.Required;
026import org.nuxeo.functionaltests.pages.AbstractPage;
027import org.openqa.selenium.By;
028import org.openqa.selenium.WebDriver;
029import org.openqa.selenium.WebElement;
030import org.openqa.selenium.support.FindBy;
031
032/**
033 * @since 7.1
034 */
035public class WorkflowGraph extends AbstractPage {
036
037    @Required
038    @FindBy(id = "nxw_TAB_DOCUMENT_ROUTE_ELEMENTS_tab_content_graphView_box")
039    protected WebElement element;
040
041    @Required
042    @FindBy(name = "graphInitDone")
043    protected WebElement graphInitDone;
044
045    public WorkflowGraph(WebDriver driver) {
046        super(driver);
047    }
048
049    protected static final String END_NODE_CSS_CLASS = "workflow_end_node";
050
051    protected static final String START_NODE_CSS_CLASS = "workflow_start_node";
052
053    public List<WebElement> getWorkflowEndNodes() {
054        return element.findElements(By.cssSelector("." + END_NODE_CSS_CLASS));
055    }
056
057    public List<WebElement> getWorkflowStartNodes() {
058        return element.findElements(By.cssSelector("." + START_NODE_CSS_CLASS));
059    }
060
061}