use of com.github.mvysny.kaributesting.v8.LocatorJ._get in project ANNIS by korpling.
the class FlatQueryBuilderTest method regularExpressionScope.
@Test
void regularExpressionScope() {
initQueryBuilder(0);
// Add a token
queryBuilder.addLinguisticSequenceBox("tok");
_get(queryBuilder, SearchBox.class).setValue("Feigenblatt");
// Add a scope and add a regular expression as value
queryBuilder.addSpanBox("Sent");
SpanBox spanBox = _get(queryBuilder, SpanBox.class);
// Set first to regex mode (so the value is not escaped)
_get(spanBox, CheckBox.class).setValue(true);
spanBox.setValue(".*");
// Create the AQL query
_click(_get(queryBuilder, Button.class, spec -> spec.withCaption("Create AQL Query")));
assertEquals("tok=/Feigenblatt/\n& Sent = /.*/\n& #2_i_#1", ui.getQueryState().getAql().getValue());
}
use of com.github.mvysny.kaributesting.v8.LocatorJ._get in project ANNIS by korpling.
the class AnnisUITest method searchPccDocumentMatches.
@Test
void searchPccDocumentMatches() throws Exception {
selectCorpus("pcc2");
// Set the query and submit query
_get(AqlCodeEditor.class).getPropertyDataSource().setValue("Genre");
MockVaadin.INSTANCE.clientRoundtrip();
awaitCondition(5, () -> "Genre".equals(ui.getQueryState().getAql().getValue()));
awaitCondition(5, () -> "Valid query, click on \"Search\" to start searching.".equals(ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus()));
Button searchButton = _get(Button.class, spec -> spec.withCaption("Search"));
_click(searchButton);
// Wait until the count is displayed
String expectedStatus = "2 matches\nin 2 documents";
awaitCondition(60, () -> expectedStatus.equals(ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus()), () -> "Waited for status \"" + expectedStatus + "\" but was \"" + ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus() + "\"");
// Test that the special corpus result panel visualizer is shown
awaitCondition(30, () -> _find(SingleCorpusResultPanel.class).size() == 2);
List<SingleCorpusResultPanel> results = _find(SingleCorpusResultPanel.class);
assertNotNull(_get(results.get(0), Label.class, spec -> spec.withValue("Path: pcc2 > 11299")));
assertNotNull(_get(results.get(0), Button.class, spec -> spec.withPredicate(b -> b.getIcon() == VaadinIcons.INFO_CIRCLE)));
// The standard SingleResult panel should not be visible
assertEquals(0, _find(SingleResultPanel.class).size());
}
use of com.github.mvysny.kaributesting.v8.LocatorJ._get in project ANNIS by korpling.
the class AnnisUITest method showDocumentRawText.
@Test
void showDocumentRawText() throws Exception {
UI.getCurrent().getNavigator().navigateTo("");
ui.getSearchView().getDocBrowserController().openDocBrowser("pcc2");
DocBrowserPanel panel = _get(DocBrowserPanel.class);
awaitCondition(120, () -> !_find(panel, DocBrowserTable.class).isEmpty());
DocBrowserTable docBrowserTable = _get(panel, DocBrowserTable.class);
List<Button> fullTextButtons = _find(docBrowserTable, Button.class, spec -> spec.withCaption("full text"));
assertEquals(2, fullTextButtons.size());
// Filter by the document name to reduce the number of buttons we can press
TextField textFilter = _get(panel, TextField.class);
_setValue(textFilter, "11299");
// Wait until filter is applied
awaitCondition(30, () -> _find(docBrowserTable, Button.class, spec -> spec.withCaption("full text")).size() == 1);
// Click on the button to open the full text visualization for the first document
_click(_get(docBrowserTable, Button.class, spec -> spec.withCaption("full text")));
Component rawTextPanel = ui.getSearchView().getTabSheet().getSelectedTab();
Tab selectedTab = ui.getSearchView().getTabSheet().getTab(rawTextPanel);
assertEquals("pcc2 > 11299 - ...", selectedTab.getCaption());
// Wait for label to appear
awaitCondition(20, () -> !_find(rawTextPanel, Label.class).isEmpty());
Label rawTextLabel = _get(rawTextPanel, Label.class);
assertTrue(rawTextLabel.getValue().startsWith("Feigenblatt Die Jugendlichen in Zossen wollen ein Musikcafé ."));
assertTrue(rawTextLabel.getValue().endsWith("Die glänzten diesmal noch mit Abwesenheit ."));
}
use of com.github.mvysny.kaributesting.v8.LocatorJ._get in project ANNIS by korpling.
the class AnnisUITest method searchPcc2InverseOrder.
@Test
void searchPcc2InverseOrder() throws Exception {
selectCorpus("pcc2");
// Set inverse order in search options
TabSheet optionTabSheet = _get(_get(ControlPanel.class), TabSheet.class);
optionTabSheet.setSelectedTab(_get(SearchOptionsPanel.class));
awaitCondition(10, () -> !_find(optionTabSheet, ComboBox.class, spec -> spec.withCaption("Order")).isEmpty());
@SuppressWarnings("unchecked") ComboBox<OrderEnum> orderComboBox = _get(optionTabSheet, ComboBox.class, spec -> spec.withCaption("Order"));
_setValue(orderComboBox, OrderEnum.INVERTED);
// Set the query and submit query
_get(AqlCodeEditor.class).getPropertyDataSource().setValue("\"Die\"");
MockVaadin.INSTANCE.clientRoundtrip();
awaitCondition(5, () -> "\"Die\"".equals(ui.getQueryState().getAql().getValue()));
awaitCondition(5, () -> "Valid query, click on \"Search\" to start searching.".equals(ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus()));
Button searchButton = _get(Button.class, spec -> spec.withCaption("Search"));
_click(searchButton);
// Wait until the count is displayed
String expectedStatus = "4 matches\nin 2 documents";
awaitCondition(60, () -> expectedStatus.equals(ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus()), () -> "Waited for status \"" + expectedStatus + "\" but was \"" + ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus() + "\"");
ResultViewPanel resultView = _get(ResultViewPanel.class);
awaitCondition(30, () -> _find(resultView, SingleResultPanel.class).size() == 4);
// Test that the cell values have the correct token value
SingleResultPanel resultPanel = _find(SingleResultPanel.class).get(0);
KWICComponent kwicVis = _get(resultPanel, KWICComponent.class);
AnnotationGrid kwicGrid = _get(kwicVis, AnnotationGrid.class);
ArrayList<Row> tokens = kwicGrid.getRowsByAnnotation().get("tok");
assertEquals(1, tokens.size());
assertEquals(Arrays.asList("fürs", "Dallgower", "Tor", "gab", ".", "Die", "Seeburger", "und", "einige", "Groß-Glienicker", "haben"), tokens.get(0).getEvents().stream().map(GridEvent::getValue).collect(Collectors.toList()));
}
use of com.github.mvysny.kaributesting.v8.LocatorJ._get in project ANNIS by korpling.
the class AnnisUITest method aboutWindow.
@Test
void aboutWindow() throws InterruptedException {
UI.getCurrent().getNavigator().navigateTo("");
_click(_get(Button.class, spec -> spec.withCaption("About ANNIS")));
// Check that the windows has opened and no error message is shown
Window window = _get(Window.class, spec -> spec.withCaption("About ANNIS"));
assertNotNull(window);
assertEquals(0, _find(ExceptionDialog.class).size());
// Close the window again
Button btClose = _get(Button.class, spec -> spec.withCaption("Close"));
assertNotNull(btClose);
_click(btClose);
// Window should be closed
assertEquals(0, _find(Window.class, spec -> spec.withCaption("About ANNIS")).size());
}
Aggregations