1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.appwithinminutes.test.po

File ApplicationCreatePage.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
14
10
1
144
62
10
0.71
1.4
10
1

Classes

Class Line # Actions
ApplicationCreatePage 38 14 0% 10 2
0.916666791.7%
 

Contributing tests

This file is covered by 9 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.appwithinminutes.test.po;
21   
22    import java.util.List;
23   
24    import org.openqa.selenium.By;
25    import org.openqa.selenium.WebDriver;
26    import org.openqa.selenium.WebElement;
27    import org.openqa.selenium.support.FindBy;
28    import org.openqa.selenium.support.ui.ExpectedCondition;
29    import org.xwiki.test.ui.po.DocumentPicker;
30    import org.xwiki.test.ui.po.ViewPage;
31   
32    /**
33    * Represents the actions possible on the first step of the App Within Minutes wizard.
34    *
35    * @version $Id: 230576d3d927fde3fe8e39cf10d206f5a98d0bb3 $
36    * @since 4.2M1
37    */
 
38    public class ApplicationCreatePage extends ViewPage
39    {
40    /**
41    * The widget used to select the application location.
42    */
43    private DocumentPicker locationPicker = new DocumentPicker();
44   
45    @FindBy(id = "wizard-next")
46    private WebElement nextStepButton;
47   
48    /**
49    * Loads the first step of the App Within Minutes wizard
50    *
51    * @return the page that represents the first step of the App Within Minutes wizard
52    */
 
53  6 toggle public static ApplicationCreatePage gotoPage()
54    {
55  6 getUtil().gotoPage("AppWithinMinutes", "CreateApplication");
56  6 return new ApplicationCreatePage();
57    }
58   
59    /**
60    * Types the given string into the application name input.
61    *
62    * @param appName the application name
63    */
 
64  14 toggle public void setApplicationName(String appName)
65    {
66  14 this.locationPicker.setTitle(appName);
67    }
68   
69    /**
70    * @return the text input where the application name is typed
71    */
 
72  5 toggle public WebElement getApplicationNameInput()
73    {
74  5 return this.locationPicker.getTitleInput();
75    }
76   
77    /**
78    * Waits until the preview for the currently inputed application name is displayed.
79    */
 
80  14 toggle public void waitForApplicationNamePreview()
81    {
82  14 final String appName = this.locationPicker.getTitle();
83  14 getDriver().waitUntilCondition(new ExpectedCondition<Boolean>()
84    {
 
85  28 toggle @Override
86    public Boolean apply(WebDriver driver)
87    {
88  28 List<WebElement> previews = driver.findElements(By.className("appName-preview"));
89  28 return previews.size() == 1 && previews.get(0).getText().contains(appName);
90    }
91    });
92    }
93   
94    /**
95    * Waits until the application name input has an error message.
96    */
 
97  3 toggle public void waitForApplicationNameError()
98    {
99  3 getDriver().waitUntilElementIsVisible(By.cssSelector("#appTitle.xErrorField"));
100    }
101   
102    /**
103    * Sets the location where to create the application.
104    *
105    * @param location the location where to create the application
106    * @since 7.3RC1
107    */
 
108  0 toggle public void setLocation(String location)
109    {
110  0 this.locationPicker.setParent(location);
111    }
112   
113    /**
114    * @return the application location picker
115    * @since 7.4.1
116    * @since 8.0M1
117    */
 
118  2 toggle public DocumentPicker getLocationPicker()
119    {
120  2 return this.locationPicker;
121    }
122   
123    /**
124    * Clicks on the Next Step button.
125    *
126    * @return the page that represents the next step of the App Within Minutes wizard
127    */
 
128  11 toggle public ApplicationClassEditPage clickNextStep()
129    {
130  11 clickNextStepButton();
131  11 return new ApplicationClassEditPage();
132    }
133   
134    /**
135    * Simply clicks on the Next Stept button, nothing more.
136    * <p>
137    * You should generally use {@link #clickNextStep()} instead if you are not expecting an error or something outside
138    * the normal flow.
139    */
 
140  13 toggle public void clickNextStepButton()
141    {
142  13 nextStepButton.click();
143    }
144    }