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

File SimpleSearchPane.java

 

Coverage histogram

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

Code metrics

0
10
5
1
107
41
5
0.5
2
5
1

Classes

Class Line # Actions
SimpleSearchPane 35 10 0% 5 0
1.0100%
 

Contributing tests

This file is covered by 14 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.extension.test.po;
21   
22    import org.openqa.selenium.Keys;
23    import org.openqa.selenium.WebElement;
24    import org.openqa.selenium.support.FindBy;
25    import org.openqa.selenium.support.ui.Select;
26    import org.xwiki.test.ui.po.BaseElement;
27    import org.xwiki.test.ui.po.BasePage;
28   
29    /**
30    * Represents the simple extension search form.
31    *
32    * @version $Id: a4e28a2d6454361b7e474f8e9f33a4cf2a30f2b7 $
33    * @since 4.2M1
34    */
 
35    public class SimpleSearchPane extends BaseElement
36    {
37    /**
38    * The text input used to specify the search keywords.
39    */
40    @FindBy(id = "extensionSearchInput")
41    private WebElement searchInput;
42   
43    /**
44    * The list box used to select the extension repository to search into.
45    */
46    @FindBy(id = "extensionSearchRepositoryList")
47    private WebElement repositorySelect;
48   
49    /**
50    * The link to open the advanced search pane.
51    */
52    @FindBy(linkText = "Advanced search")
53    private WebElement advancedSearchLink;
54   
55    /**
56    * @return the text input used to specify the search keywords
57    */
 
58  4 toggle public WebElement getSearchInput()
59    {
60  4 return searchInput;
61    }
62   
63    /**
64    * @return the list box used to select the extension repository to search into
65    */
 
66  10 toggle public Select getRepositorySelect()
67    {
68  10 return new Select(repositorySelect);
69    }
70   
71    /**
72    * Selects the specified extension repository and waits for the search results to update.
73    *
74    * @param repositoryId the repository identifier
75    * @return the search results pane
76    */
 
77  5 toggle public SearchResultsPane selectRepository(String repositoryId)
78    {
79  5 getRepositorySelect().selectByValue(repositoryId);
80  5 new BasePage().waitUntilPageIsLoaded();
81  5 return new SearchResultsPane();
82    }
83   
84    /**
85    * Clicks on the 'Advanced search' link to open the advanced search pane.
86    *
87    * @return the advanced search form
88    */
 
89  13 toggle public AdvancedSearchPane clickAdvancedSearch()
90    {
91  13 advancedSearchLink.click();
92  13 return new AdvancedSearchPane();
93    }
94   
95    /**
96    * Searches for the extensions matching the given keywords.
97    *
98    * @param keywords the keywords to search for
99    * @return the search results pane
100    */
 
101  13 toggle public SearchResultsPane search(CharSequence keywords)
102    {
103  13 searchInput.clear();
104  13 searchInput.sendKeys(keywords, Keys.ENTER);
105  13 return new SearchResultsPane();
106    }
107    }