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

File ApplicationHomePage.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

2
16
8
1
129
64
9
0.56
2
8
1.12

Classes

Class Line # Actions
ApplicationHomePage 37 16 0% 9 4
0.8461538684.6%
 

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 org.openqa.selenium.By;
23    import org.openqa.selenium.WebElement;
24    import org.openqa.selenium.support.FindBy;
25    import org.openqa.selenium.support.FindBys;
26    import org.xwiki.test.ui.po.ConfirmationPage;
27    import org.xwiki.test.ui.po.InlinePage;
28    import org.xwiki.test.ui.po.LiveTableElement;
29    import org.xwiki.test.ui.po.ViewPage;
30   
31    /**
32    * Represents the actions possible on the application home page.
33    *
34    * @version $Id: 718ac4fce8764a179b82f5c35bd7c91088639757 $
35    * @since 4.2M1
36    */
 
37    public class ApplicationHomePage extends ViewPage
38    {
39    @FindBys({@FindBy(id = "actionBox"), @FindBy(className = "add")})
40    private WebElement addEntryLink;
41   
42    @FindBys({@FindBy(id = "actionBox"), @FindBy(className = "edit")})
43    private WebElement editClassLink;
44   
45    @FindBy(css = "#actionBox .action.deleteData")
46    private WebElement deleteAllEntriesLink;
47   
48    @FindBy(css = "#actionBox .action.delete")
49    private WebElement deleteApplicationLink;
50   
51    /**
52    * The live table used to browse application data.
53    */
54    private LiveTableElement entriesLiveTable;
55   
56    /**
57    * Loads the home page of the specified application.
58    *
59    * @param appName the application name
60    * @return the application home page
61    * @since 5.1RC1
62    */
 
63  0 toggle public static ApplicationHomePage gotoPage(String appName)
64    {
65  0 getUtil().gotoPage(appName, "WebHome");
66  0 return new ApplicationHomePage();
67    }
68   
69    /**
70    * Clicks on the link to add a new application entry.
71    *
72    * @return the pane used to input the entry name
73    */
 
74  8 toggle public EntryNamePane clickAddNewEntry()
75    {
76  8 addEntryLink.click();
77  8 return new EntryNamePane();
78    }
79   
80    /**
81    * Clicks on the link that leads to the class editor.
82    *
83    * @return the page used to edit the application class
84    */
 
85  1 toggle public ApplicationClassEditPage clickEditApplication()
86    {
87  1 editClassLink.click();
88  1 return new ApplicationClassEditPage();
89    }
90   
91    /**
92    * @return the live table used to browser application data
93    */
 
94  11 toggle public LiveTableElement getEntriesLiveTable()
95    {
96  11 if (entriesLiveTable == null) {
97  11 WebElement table = getDriver().findElement(By.className("xwiki-livetable"));
98  11 entriesLiveTable = new LiveTableElement(table.getAttribute("id"));
99    }
100  11 return entriesLiveTable;
101    }
102   
103    /**
104    * @return {@code true} if the entries live table is displayed on the home page, {@code false} otherwise
105    */
 
106  1 toggle public boolean hasEntriesLiveTable()
107    {
108  1 return getDriver().findElements(By.className("xwiki-livetable")).size() > 0;
109    }
110   
 
111  1 toggle public ConfirmationPage clickDeleteAllEntries()
112    {
113  1 this.deleteAllEntriesLink.click();
114  1 return new ConfirmationPage();
115    }
116   
 
117  1 toggle public ConfirmationPage clickDeleteApplication()
118    {
119  1 this.deleteApplicationLink.click();
120  1 return new ConfirmationPage();
121    }
122   
 
123  1 toggle @SuppressWarnings("unchecked")
124    @Override
125    protected <T extends InlinePage> T createInlinePage()
126    {
127  1 return (T) new ApplicationHomeEditPage();
128    }
129    }