Search in sources :

Example 1 with AdvancedSearchPane

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());
}
Also used : ExtensionAdministrationPage(org.xwiki.extension.test.po.ExtensionAdministrationPage) SearchResultsPane(org.xwiki.extension.test.po.SearchResultsPane) SimpleSearchPane(org.xwiki.extension.test.po.SimpleSearchPane) ExtensionPane(org.xwiki.extension.test.po.ExtensionPane) AdvancedSearchPane(org.xwiki.extension.test.po.AdvancedSearchPane) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 AdvancedSearchPane (org.xwiki.extension.test.po.AdvancedSearchPane)1 ExtensionAdministrationPage (org.xwiki.extension.test.po.ExtensionAdministrationPage)1 ExtensionPane (org.xwiki.extension.test.po.ExtensionPane)1 SearchResultsPane (org.xwiki.extension.test.po.SearchResultsPane)1 SimpleSearchPane (org.xwiki.extension.test.po.SimpleSearchPane)1