use of org.xwiki.extension.test.po.AdvancedSearchPane in project xwiki-platform by xwiki.
the class ExtensionIT method testAdvancedSearch.
/**
* Tests the advanced search form.
*/
@Test
public void testAdvancedSearch() {
ExtensionAdministrationPage adminPage = ExtensionAdministrationPage.gotoCoreExtensions();
SearchResultsPane searchResults = adminPage.getSearchBar().search("restlet");
String version = searchResults.getExtension(0).getVersion();
searchResults = new SimpleSearchPane().clickAdvancedSearch().search("org.restlet.jse:org.restlet", version);
assertEquals(1, searchResults.getDisplayedResultsCount());
assertNull(searchResults.getNoResultsMessage());
ExtensionPane extension = searchResults.getExtension(0);
assertEquals("core", extension.getStatus());
assertTrue(extension.getName().toLowerCase().contains("restlet"));
assertEquals(version, extension.getVersion());
searchResults = new SimpleSearchPane().clickAdvancedSearch().search("foo", "bar");
assertEquals(0, searchResults.getDisplayedResultsCount());
assertNull(searchResults.getPagination());
assertEquals("We couldn't find any extension with id 'foo' and version 'bar'. " + "Make sure you have the right extension repositories configured.", searchResults.getNoResultsMessage());
// Test cancel advanced search.
AdvancedSearchPane advancedSearchPane = new SimpleSearchPane().clickAdvancedSearch();
advancedSearchPane.getIdInput().sendKeys("id");
assertTrue(advancedSearchPane.getVersionInput().isDisplayed());
advancedSearchPane.getCancelButton().click();
assertFalse(advancedSearchPane.getVersionInput().isDisplayed());
}
Aggregations