Search in sources :

Example 1 with LocatorJ._find

use of com.github.mvysny.kaributesting.v8.LocatorJ._find in project ANNIS by korpling.

the class AnnisUITest method openSourceWindow.

@Test
void openSourceWindow() {
    UI.getCurrent().getNavigator().navigateTo("");
    _click(_get(Button.class, spec -> spec.withCaption("Help us make ANNIS better!")));
    // Check that the windows has opened
    assertNotNull(_get(Window.class, spec -> spec.withCaption("Help us make ANNIS better!")));
    // 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("Help us make ANNIS better!")).size());
}
Also used : Panel(com.vaadin.ui.Panel) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) CorpusListPanel(org.corpus_tools.annis.gui.controlpanel.CorpusListPanel) DocBrowserPanel(org.corpus_tools.annis.gui.docbrowser.DocBrowserPanel) TextField(com.vaadin.ui.TextField) Pair(kotlin.Pair) UI(com.vaadin.ui.UI) Autowired(org.springframework.beans.factory.annotation.Autowired) Window(com.vaadin.ui.Window) ExceptionDialog(org.corpus_tools.annis.gui.components.ExceptionDialog) SearchOptionsPanel(org.corpus_tools.annis.gui.controlpanel.SearchOptionsPanel) ActiveProfiles(org.springframework.test.context.ActiveProfiles) AnnotationGrid(org.corpus_tools.annis.gui.widgets.grid.AnnotationGrid) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) DocBrowserTable(org.corpus_tools.annis.gui.docbrowser.DocBrowserTable) ResultViewPanel(org.corpus_tools.annis.gui.resultview.ResultViewPanel) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) Page(com.vaadin.server.Page) OrderEnum(org.corpus_tools.annis.api.model.FindQuery.OrderEnum) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) VaadinIcons(com.vaadin.icons.VaadinIcons) GridEvent(org.corpus_tools.annis.gui.widgets.grid.GridEvent) URI(java.net.URI) GridKt(com.github.mvysny.kaributesting.v8.GridKt) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) NotificationsKt(com.github.mvysny.kaributesting.v8.NotificationsKt) KWICComponent(org.corpus_tools.annis.gui.visualizers.component.kwic.KWICComponent) Row(org.corpus_tools.annis.gui.widgets.grid.Row) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) UUID(java.util.UUID) LocatorJ._setValue(com.github.mvysny.kaributesting.v8.LocatorJ._setValue) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) List(java.util.List) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) TabSheet(com.vaadin.ui.TabSheet) URLEncodedUtils(org.apache.http.client.utils.URLEncodedUtils) Optional(java.util.Optional) NameValuePair(org.apache.http.NameValuePair) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) GridComponent(org.corpus_tools.annis.gui.visualizers.component.grid.GridComponent) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ComboBox(com.vaadin.ui.ComboBox) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) TestHelper.awaitCondition(org.corpus_tools.annis.gui.TestHelper.awaitCondition) Accordion(com.vaadin.ui.Accordion) Label(com.vaadin.ui.Label) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) SingleCorpusResultPanel(org.corpus_tools.annis.gui.resultview.SingleCorpusResultPanel) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DataProvider(com.vaadin.data.provider.DataProvider) AutoHeightIFrame(org.corpus_tools.annis.gui.widgets.AutoHeightIFrame) Tab(com.vaadin.ui.TabSheet.Tab) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ContentMode(com.vaadin.shared.ui.ContentMode) AqlCodeEditor(org.corpus_tools.annis.gui.components.codemirror.AqlCodeEditor) Assert.assertTrue(org.junit.Assert.assertTrue) ControlPanel(org.corpus_tools.annis.gui.controlpanel.ControlPanel) Button(com.vaadin.ui.Button) AfterEach(org.junit.jupiter.api.AfterEach) MediaElementPlayer(org.corpus_tools.annis.gui.components.medialement.MediaElementPlayer) TextArea(com.vaadin.v7.ui.TextArea) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) BeanFactory(org.springframework.beans.factory.BeanFactory) Annotation(org.corpus_tools.annis.api.model.Annotation) Component(com.vaadin.ui.Component) Grid(com.vaadin.ui.Grid) Window(com.vaadin.ui.Window) Button(com.vaadin.ui.Button) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with LocatorJ._find

use of com.github.mvysny.kaributesting.v8.LocatorJ._find in project ANNIS by korpling.

the class AnnisUITest method shareSingleResult.

@Test
void shareSingleResult() throws Exception {
    executeTokenSearch("pcc2", 399, 2);
    // Activate the share window
    SingleResultPanel resultPanel = _find(SingleResultPanel.class).get(0);
    _click(_get(resultPanel, Button.class, spec -> spec.withPredicate((b) -> "Share match reference".equals(b.getDescription()))));
    // Get the window which shows all the different links
    Window shareWindow = _get(Window.class, spec -> spec.withCaption("Match reference link"));
    TextArea linkTextField = _get(shareWindow, TextArea.class, spec -> spec.withCaption("Link for publications"));
    URI shortUrl = URI.create(linkTextField.getValue());
    List<NameValuePair> paramsShortUrl = URLEncodedUtils.parse(shortUrl.getQuery(), StandardCharsets.UTF_8);
    assertEquals(1, paramsShortUrl.size());
    assertEquals("id", paramsShortUrl.get(0).getName());
    // Un-shorten the URL and examine its parts
    Optional<URI> originalUrl = ui.getUrlShortener().unshorten(UUID.fromString(paramsShortUrl.get(0).getValue()));
    assertTrue(originalUrl.isPresent());
    if (originalUrl.isPresent()) {
        List<NameValuePair> paramsOriginalUrl = URLEncodedUtils.parse(originalUrl.get().getRawQuery(), StandardCharsets.UTF_8);
        assertFalse(paramsOriginalUrl.isEmpty());
        assertTrue(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_LEFT.equals(p.getName()) && "5".equals(p.getValue())));
        assertTrue(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_RIGHT.equals(p.getName()) && "5".equals(p.getValue())));
        assertFalse(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_INSTANCE.equals(p.getName())));
        assertTrue(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_SEARCH_INTERFACE.equals(p.getName()) && p.getValue().startsWith("http://localhost:8080#_q=")));
        assertTrue(paramsOriginalUrl.stream().anyMatch(p -> EmbeddedVisUI.KEY_MATCH.equals(p.getName()) && "pcc2/11299#tok_1".equals(p.getValue())));
    }
}
Also used : Panel(com.vaadin.ui.Panel) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) CorpusListPanel(org.corpus_tools.annis.gui.controlpanel.CorpusListPanel) DocBrowserPanel(org.corpus_tools.annis.gui.docbrowser.DocBrowserPanel) TextField(com.vaadin.ui.TextField) Pair(kotlin.Pair) UI(com.vaadin.ui.UI) Autowired(org.springframework.beans.factory.annotation.Autowired) Window(com.vaadin.ui.Window) ExceptionDialog(org.corpus_tools.annis.gui.components.ExceptionDialog) SearchOptionsPanel(org.corpus_tools.annis.gui.controlpanel.SearchOptionsPanel) ActiveProfiles(org.springframework.test.context.ActiveProfiles) AnnotationGrid(org.corpus_tools.annis.gui.widgets.grid.AnnotationGrid) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) DocBrowserTable(org.corpus_tools.annis.gui.docbrowser.DocBrowserTable) ResultViewPanel(org.corpus_tools.annis.gui.resultview.ResultViewPanel) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) Page(com.vaadin.server.Page) OrderEnum(org.corpus_tools.annis.api.model.FindQuery.OrderEnum) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) VaadinIcons(com.vaadin.icons.VaadinIcons) GridEvent(org.corpus_tools.annis.gui.widgets.grid.GridEvent) URI(java.net.URI) GridKt(com.github.mvysny.kaributesting.v8.GridKt) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) NotificationsKt(com.github.mvysny.kaributesting.v8.NotificationsKt) KWICComponent(org.corpus_tools.annis.gui.visualizers.component.kwic.KWICComponent) Row(org.corpus_tools.annis.gui.widgets.grid.Row) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) UUID(java.util.UUID) LocatorJ._setValue(com.github.mvysny.kaributesting.v8.LocatorJ._setValue) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) List(java.util.List) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) TabSheet(com.vaadin.ui.TabSheet) URLEncodedUtils(org.apache.http.client.utils.URLEncodedUtils) Optional(java.util.Optional) NameValuePair(org.apache.http.NameValuePair) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) GridComponent(org.corpus_tools.annis.gui.visualizers.component.grid.GridComponent) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ComboBox(com.vaadin.ui.ComboBox) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) TestHelper.awaitCondition(org.corpus_tools.annis.gui.TestHelper.awaitCondition) Accordion(com.vaadin.ui.Accordion) Label(com.vaadin.ui.Label) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) SingleCorpusResultPanel(org.corpus_tools.annis.gui.resultview.SingleCorpusResultPanel) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DataProvider(com.vaadin.data.provider.DataProvider) AutoHeightIFrame(org.corpus_tools.annis.gui.widgets.AutoHeightIFrame) Tab(com.vaadin.ui.TabSheet.Tab) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ContentMode(com.vaadin.shared.ui.ContentMode) AqlCodeEditor(org.corpus_tools.annis.gui.components.codemirror.AqlCodeEditor) Assert.assertTrue(org.junit.Assert.assertTrue) ControlPanel(org.corpus_tools.annis.gui.controlpanel.ControlPanel) Button(com.vaadin.ui.Button) AfterEach(org.junit.jupiter.api.AfterEach) MediaElementPlayer(org.corpus_tools.annis.gui.components.medialement.MediaElementPlayer) TextArea(com.vaadin.v7.ui.TextArea) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) BeanFactory(org.springframework.beans.factory.BeanFactory) Annotation(org.corpus_tools.annis.api.model.Annotation) Component(com.vaadin.ui.Component) Grid(com.vaadin.ui.Grid) Window(com.vaadin.ui.Window) NameValuePair(org.apache.http.NameValuePair) Button(com.vaadin.ui.Button) TextArea(com.vaadin.v7.ui.TextArea) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) URI(java.net.URI) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with LocatorJ._find

use of com.github.mvysny.kaributesting.v8.LocatorJ._find in project ANNIS by korpling.

the class AnnisUITest method openVisualizerPcc2.

@Test
void openVisualizerPcc2() throws Exception {
    executeTokenSearch("pcc2", 399, 2);
    SingleResultPanel resultPanel = _find(SingleResultPanel.class).get(0);
    _get(resultPanel, KWICComponent.class);
    // Open the coreference visualizer and check that IFrame component is loaded
    Button btOpenCorefVisualizer = _get(resultPanel, Button.class, spec -> spec.withCaption("coreference (discourse)"));
    _click(btOpenCorefVisualizer);
    awaitCondition(120, () -> !_find(resultPanel, AutoHeightIFrame.class).isEmpty());
    AutoHeightIFrame iframe = _get(resultPanel, AutoHeightIFrame.class, spec -> spec.withCount(1));
    assertTrue(iframe.getState().getUrl().startsWith("/vis-iframe-res/"));
    // Close the visualizer again
    _click(btOpenCorefVisualizer);
    awaitCondition(60, () -> _find(resultPanel, AutoHeightIFrame.class).isEmpty());
    // Open a HTML visualizer
    Button btOpenHtmlVisualizer = _get(resultPanel, Button.class, spec -> spec.withCaption("information structure (document)"));
    _click(btOpenHtmlVisualizer);
    awaitCondition(240, () -> !_find(resultPanel, Panel.class, spec -> spec.withPredicate(p -> p.getStyleName().startsWith("annis-wrapped-htmlvis-"))).isEmpty());
    Panel htmlPanel = _get(resultPanel, Panel.class, spec -> spec.withPredicate(p -> p.getStyleName().startsWith("annis-wrapped-htmlvis-")));
    Label htmlLabel = _get(htmlPanel, Label.class);
    assertEquals(ContentMode.HTML, htmlLabel.getContentMode());
    assertTrue(htmlLabel.getValue().startsWith("<span class=\"tok\"  style=\" color:\" >Feigenblatt<"));
}
Also used : Panel(com.vaadin.ui.Panel) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) CorpusListPanel(org.corpus_tools.annis.gui.controlpanel.CorpusListPanel) DocBrowserPanel(org.corpus_tools.annis.gui.docbrowser.DocBrowserPanel) TextField(com.vaadin.ui.TextField) Pair(kotlin.Pair) UI(com.vaadin.ui.UI) Autowired(org.springframework.beans.factory.annotation.Autowired) Window(com.vaadin.ui.Window) ExceptionDialog(org.corpus_tools.annis.gui.components.ExceptionDialog) SearchOptionsPanel(org.corpus_tools.annis.gui.controlpanel.SearchOptionsPanel) ActiveProfiles(org.springframework.test.context.ActiveProfiles) AnnotationGrid(org.corpus_tools.annis.gui.widgets.grid.AnnotationGrid) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) DocBrowserTable(org.corpus_tools.annis.gui.docbrowser.DocBrowserTable) ResultViewPanel(org.corpus_tools.annis.gui.resultview.ResultViewPanel) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) Page(com.vaadin.server.Page) OrderEnum(org.corpus_tools.annis.api.model.FindQuery.OrderEnum) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) VaadinIcons(com.vaadin.icons.VaadinIcons) GridEvent(org.corpus_tools.annis.gui.widgets.grid.GridEvent) URI(java.net.URI) GridKt(com.github.mvysny.kaributesting.v8.GridKt) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) NotificationsKt(com.github.mvysny.kaributesting.v8.NotificationsKt) KWICComponent(org.corpus_tools.annis.gui.visualizers.component.kwic.KWICComponent) Row(org.corpus_tools.annis.gui.widgets.grid.Row) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) UUID(java.util.UUID) LocatorJ._setValue(com.github.mvysny.kaributesting.v8.LocatorJ._setValue) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) List(java.util.List) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) TabSheet(com.vaadin.ui.TabSheet) URLEncodedUtils(org.apache.http.client.utils.URLEncodedUtils) Optional(java.util.Optional) NameValuePair(org.apache.http.NameValuePair) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) GridComponent(org.corpus_tools.annis.gui.visualizers.component.grid.GridComponent) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ComboBox(com.vaadin.ui.ComboBox) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) TestHelper.awaitCondition(org.corpus_tools.annis.gui.TestHelper.awaitCondition) Accordion(com.vaadin.ui.Accordion) Label(com.vaadin.ui.Label) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) SingleCorpusResultPanel(org.corpus_tools.annis.gui.resultview.SingleCorpusResultPanel) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DataProvider(com.vaadin.data.provider.DataProvider) AutoHeightIFrame(org.corpus_tools.annis.gui.widgets.AutoHeightIFrame) Tab(com.vaadin.ui.TabSheet.Tab) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ContentMode(com.vaadin.shared.ui.ContentMode) AqlCodeEditor(org.corpus_tools.annis.gui.components.codemirror.AqlCodeEditor) Assert.assertTrue(org.junit.Assert.assertTrue) ControlPanel(org.corpus_tools.annis.gui.controlpanel.ControlPanel) Button(com.vaadin.ui.Button) AfterEach(org.junit.jupiter.api.AfterEach) MediaElementPlayer(org.corpus_tools.annis.gui.components.medialement.MediaElementPlayer) TextArea(com.vaadin.v7.ui.TextArea) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) BeanFactory(org.springframework.beans.factory.BeanFactory) Annotation(org.corpus_tools.annis.api.model.Annotation) Component(com.vaadin.ui.Component) Grid(com.vaadin.ui.Grid) Panel(com.vaadin.ui.Panel) CorpusListPanel(org.corpus_tools.annis.gui.controlpanel.CorpusListPanel) DocBrowserPanel(org.corpus_tools.annis.gui.docbrowser.DocBrowserPanel) SearchOptionsPanel(org.corpus_tools.annis.gui.controlpanel.SearchOptionsPanel) ResultViewPanel(org.corpus_tools.annis.gui.resultview.ResultViewPanel) SingleCorpusResultPanel(org.corpus_tools.annis.gui.resultview.SingleCorpusResultPanel) ControlPanel(org.corpus_tools.annis.gui.controlpanel.ControlPanel) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) Button(com.vaadin.ui.Button) Label(com.vaadin.ui.Label) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) AutoHeightIFrame(org.corpus_tools.annis.gui.widgets.AutoHeightIFrame) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with LocatorJ._find

use of com.github.mvysny.kaributesting.v8.LocatorJ._find in project ANNIS by korpling.

the class AnnisUITest method searchPccCorpusMatches.

@Test
void searchPccCorpusMatches() throws Exception {
    selectCorpus("pcc2");
    // Set the query and submit query
    _get(AqlCodeEditor.class).getPropertyDataSource().setValue("URL");
    MockVaadin.INSTANCE.clientRoundtrip();
    awaitCondition(5, () -> "URL".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 = "1 match\nin 1 document";
    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() == 1);
    List<SingleCorpusResultPanel> results = _find(SingleCorpusResultPanel.class);
    assertNotNull(_get(results.get(0), Label.class, spec -> spec.withValue("Path: pcc2")));
    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());
}
Also used : Panel(com.vaadin.ui.Panel) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) CorpusListPanel(org.corpus_tools.annis.gui.controlpanel.CorpusListPanel) DocBrowserPanel(org.corpus_tools.annis.gui.docbrowser.DocBrowserPanel) TextField(com.vaadin.ui.TextField) Pair(kotlin.Pair) UI(com.vaadin.ui.UI) Autowired(org.springframework.beans.factory.annotation.Autowired) Window(com.vaadin.ui.Window) ExceptionDialog(org.corpus_tools.annis.gui.components.ExceptionDialog) SearchOptionsPanel(org.corpus_tools.annis.gui.controlpanel.SearchOptionsPanel) ActiveProfiles(org.springframework.test.context.ActiveProfiles) AnnotationGrid(org.corpus_tools.annis.gui.widgets.grid.AnnotationGrid) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) DocBrowserTable(org.corpus_tools.annis.gui.docbrowser.DocBrowserTable) ResultViewPanel(org.corpus_tools.annis.gui.resultview.ResultViewPanel) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) Page(com.vaadin.server.Page) OrderEnum(org.corpus_tools.annis.api.model.FindQuery.OrderEnum) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) VaadinIcons(com.vaadin.icons.VaadinIcons) GridEvent(org.corpus_tools.annis.gui.widgets.grid.GridEvent) URI(java.net.URI) GridKt(com.github.mvysny.kaributesting.v8.GridKt) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) NotificationsKt(com.github.mvysny.kaributesting.v8.NotificationsKt) KWICComponent(org.corpus_tools.annis.gui.visualizers.component.kwic.KWICComponent) Row(org.corpus_tools.annis.gui.widgets.grid.Row) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) UUID(java.util.UUID) LocatorJ._setValue(com.github.mvysny.kaributesting.v8.LocatorJ._setValue) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) List(java.util.List) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) TabSheet(com.vaadin.ui.TabSheet) URLEncodedUtils(org.apache.http.client.utils.URLEncodedUtils) Optional(java.util.Optional) NameValuePair(org.apache.http.NameValuePair) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) GridComponent(org.corpus_tools.annis.gui.visualizers.component.grid.GridComponent) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ComboBox(com.vaadin.ui.ComboBox) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) TestHelper.awaitCondition(org.corpus_tools.annis.gui.TestHelper.awaitCondition) Accordion(com.vaadin.ui.Accordion) Label(com.vaadin.ui.Label) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) SingleCorpusResultPanel(org.corpus_tools.annis.gui.resultview.SingleCorpusResultPanel) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DataProvider(com.vaadin.data.provider.DataProvider) AutoHeightIFrame(org.corpus_tools.annis.gui.widgets.AutoHeightIFrame) Tab(com.vaadin.ui.TabSheet.Tab) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ContentMode(com.vaadin.shared.ui.ContentMode) AqlCodeEditor(org.corpus_tools.annis.gui.components.codemirror.AqlCodeEditor) Assert.assertTrue(org.junit.Assert.assertTrue) ControlPanel(org.corpus_tools.annis.gui.controlpanel.ControlPanel) Button(com.vaadin.ui.Button) AfterEach(org.junit.jupiter.api.AfterEach) MediaElementPlayer(org.corpus_tools.annis.gui.components.medialement.MediaElementPlayer) TextArea(com.vaadin.v7.ui.TextArea) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) BeanFactory(org.springframework.beans.factory.BeanFactory) Annotation(org.corpus_tools.annis.api.model.Annotation) Component(com.vaadin.ui.Component) Grid(com.vaadin.ui.Grid) Button(com.vaadin.ui.Button) SingleCorpusResultPanel(org.corpus_tools.annis.gui.resultview.SingleCorpusResultPanel) Label(com.vaadin.ui.Label) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 5 with LocatorJ._find

use of com.github.mvysny.kaributesting.v8.LocatorJ._find in project ANNIS by korpling.

the class EmbeddedVisTest method regression509.

@Test
void regression509() throws Exception {
    EmbeddedVisUI ui = (EmbeddedVisUI) UI.getCurrent();
    MockRequest request = MockVaadinKt.getMock(VaadinRequest.getCurrent());
    request.setParameter("embedded_ns", "exmaralda");
    request.setParameter("embedded_instance", "");
    request.setParameter("embedded_match", "pcc2/11299#tok_1");
    request.setParameter("embedded_left", "5");
    request.setParameter("embedded_right", "5");
    request.setParameter("embedded_interface", "http://localhost:5712/#_q=dG9r&ql=aql&_c=cGNjMg&cl=5&cr=5&s=0&l=10&m=0");
    ui.attachToPath("/embeddedvis/grid", VaadinRequest.getCurrent());
    awaitCondition(30, () -> !_find(Link.class, spec -> spec.withCaption("Show in ANNIS search interface")).isEmpty());
    Link link = _get(Link.class, spec -> spec.withCaption("Show in ANNIS search interface"));
    assertEquals("dontprint", link.getStyleName());
}
Also used : WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) ContentMode(com.vaadin.shared.ui.ContentMode) BeforeEach(org.junit.jupiter.api.BeforeEach) UI(com.vaadin.ui.UI) Link(com.vaadin.ui.Link) Autowired(org.springframework.beans.factory.annotation.Autowired) ActiveProfiles(org.springframework.test.context.ActiveProfiles) VaadinRequest(com.vaadin.server.VaadinRequest) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) Test(org.junit.jupiter.api.Test) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) EmbeddedVisUI(org.corpus_tools.annis.gui.EmbeddedVisUI) AfterEach(org.junit.jupiter.api.AfterEach) MockRequest(com.github.mvysny.kaributesting.mockhttp.MockRequest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) TestHelper.awaitCondition(org.corpus_tools.annis.gui.TestHelper.awaitCondition) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Label(com.vaadin.ui.Label) BeanFactory(org.springframework.beans.factory.BeanFactory) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) MockVaadinKt(com.github.mvysny.kaributesting.v8.MockVaadinKt) EmbeddedVisUI(org.corpus_tools.annis.gui.EmbeddedVisUI) MockRequest(com.github.mvysny.kaributesting.mockhttp.MockRequest) Link(com.vaadin.ui.Link) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

LocatorJ._find (com.github.mvysny.kaributesting.v8.LocatorJ._find)16 LocatorJ._get (com.github.mvysny.kaributesting.v8.LocatorJ._get)16 MockVaadin (com.github.mvysny.kaributesting.v8.MockVaadin)16 UIScopeImpl (com.vaadin.spring.internal.UIScopeImpl)16 AfterEach (org.junit.jupiter.api.AfterEach)16 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)16 BeforeEach (org.junit.jupiter.api.BeforeEach)16 Test (org.junit.jupiter.api.Test)16 BeanFactory (org.springframework.beans.factory.BeanFactory)16 Autowired (org.springframework.beans.factory.annotation.Autowired)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 ActiveProfiles (org.springframework.test.context.ActiveProfiles)16 WebAppConfiguration (org.springframework.test.context.web.WebAppConfiguration)16 ContentMode (com.vaadin.shared.ui.ContentMode)14 Label (com.vaadin.ui.Label)14 UI (com.vaadin.ui.UI)14 TestHelper.awaitCondition (org.corpus_tools.annis.gui.TestHelper.awaitCondition)14 LocatorJ._click (com.github.mvysny.kaributesting.v8.LocatorJ._click)12 Button (com.vaadin.ui.Button)12 ArrayList (java.util.ArrayList)12