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 * Thierry Delprat 018 */ 019package org.nuxeo.functionaltests.pages.wizard; 020 021import org.nuxeo.functionaltests.pages.LoginPage; 022import org.openqa.selenium.By; 023import org.openqa.selenium.NoSuchElementException; 024import org.openqa.selenium.WebDriver; 025import org.openqa.selenium.WebElement; 026 027public class SummaryWizardPage extends WizardPage { 028 029 private static final int RESTART_TIMEOUT_MINUTES = 10; 030 031 public SummaryWizardPage(WebDriver driver) { 032 super(driver); 033 } 034 035 public LoginPage restart() { 036 nav(WizardPage.class, "Start Nuxeo"); 037 try { 038 findElementWithTimeout(By.id("username"), RESTART_TIMEOUT_MINUTES * 60 * 1000); 039 return asPage(LoginPage.class); 040 } catch (NoSuchElementException e) { 041 String currentUrl = driver.getCurrentUrl(); 042 throw new NoSuchElementException( 043 String.format("Unable to find login screen after %s minutes, currentUrl=%s", 044 RESTART_TIMEOUT_MINUTES, currentUrl), e); 045 } 046 } 047 048 public String getRegistration() { 049 WebElement el = findElementWithTimeout(By.id("CLID")); 050 if (el != null) { 051 return el.getText(); 052 } 053 return null; 054 } 055 056}