Search in sources :

Example 16 with LocatorJ._click

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

the class AnnisUITest method tokenSearchDialog.

@Test
void tokenSearchDialog() throws Exception {
    executeTokenSearch("dialog.demo", 102, 1);
    // Test that there is a grid visualizer
    SingleResultPanel resultPanel = _find(SingleResultPanel.class).get(0);
    GridComponent gridVis = _get(resultPanel, GridComponent.class, spec -> spec.withPredicate(g -> !(g instanceof KWICComponent)));
    AnnotationGrid annoGrid = _get(gridVis, AnnotationGrid.class);
    ArrayList<Row> tokens = annoGrid.getRowsByAnnotation().get("default_ns::norm0");
    assertEquals(1, tokens.size());
    assertEquals(Arrays.asList("äh", "fang", "einfach", "mal", "an"), tokens.get(0).getEvents().stream().map(GridEvent::getValue).collect(Collectors.toList()));
    // Open the video visualizer and check that media component is loaded
    Button btOpenVisualizer = _get(resultPanel, Button.class, spec -> spec.withCaption("video"));
    _click(btOpenVisualizer);
    awaitCondition(120, () -> !_find(resultPanel, MediaElementPlayer.class).isEmpty());
    MediaElementPlayer player = _get(resultPanel, MediaElementPlayer.class, spec -> spec.withCount(1));
    assertEquals("video/webm", player.getState().getMimeType());
    assertEquals("/Binary?file=dialog.demo%2Fdialog.demo%2Fdialog.demo.webm&toplevelCorpusName=dialog.demo", player.getState().getResourceURL());
    // Close the visualizer again
    _click(btOpenVisualizer);
    awaitCondition(120, () -> _find(resultPanel, MediaElementPlayer.class).isEmpty());
}
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) GridEvent(org.corpus_tools.annis.gui.widgets.grid.GridEvent) AnnotationGrid(org.corpus_tools.annis.gui.widgets.grid.AnnotationGrid) KWICComponent(org.corpus_tools.annis.gui.visualizers.component.kwic.KWICComponent) Button(com.vaadin.ui.Button) GridComponent(org.corpus_tools.annis.gui.visualizers.component.grid.GridComponent) MediaElementPlayer(org.corpus_tools.annis.gui.components.medialement.MediaElementPlayer) Row(org.corpus_tools.annis.gui.widgets.grid.Row) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 17 with LocatorJ._click

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

the class ExportPanelTest method testCSVExport.

@Test
void testCSVExport() throws Exception {
    // Prepare query
    ui.getQueryState().setSelectedCorpora(Sets.newHashSet("pcc2"));
    ui.getQueryState().getAql().setValue("tok=\"Feigenblatt\"");
    // Click on the "More" button and then "Export"
    PopupButton moreButton = _get(PopupButton.class, spec -> spec.withCaption("More"));
    moreButton.setPopupVisible(true);
    _click(_get(Button.class, spec -> spec.withCaption("Export")));
    // Make sure the Export tab is there
    ExportPanel panel = _get(ExportPanel.class);
    // The download button should be disabled
    Button downloadButton = _get(panel, Button.class, spec -> spec.withCaption("Download"));
    assertFalse(downloadButton.isEnabled());
    // Click on "Perform Export" button, wait until export is finished and download button is
    // enabled
    _click(_get(panel, Button.class, spec -> spec.withCaption("Perform Export")));
    TestHelper.awaitCondition(30, downloadButton::isEnabled);
}
Also used : WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) BeforeEach(org.junit.jupiter.api.BeforeEach) AnnisUI(org.corpus_tools.annis.gui.AnnisUI) Autowired(org.springframework.beans.factory.annotation.Autowired) ActiveProfiles(org.springframework.test.context.ActiveProfiles) PopupButton(org.vaadin.hene.popupbutton.PopupButton) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) Sets(com.google.common.collect.Sets) Test(org.junit.jupiter.api.Test) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) Button(com.vaadin.ui.Button) AfterEach(org.junit.jupiter.api.AfterEach) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) BeanFactory(org.springframework.beans.factory.BeanFactory) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) ExportPanel(org.corpus_tools.annis.gui.ExportPanel) ExportPanel(org.corpus_tools.annis.gui.ExportPanel) PopupButton(org.vaadin.hene.popupbutton.PopupButton) PopupButton(org.vaadin.hene.popupbutton.PopupButton) Button(com.vaadin.ui.Button) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 18 with LocatorJ._click

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

the class MigrationPanelTest method showMigrationPanel.

private void showMigrationPanel() {
    _click(_get(Button.class, spec -> spec.withCaption("Administration")));
    TabSheet tab = _get(TabSheet.class);
    panel = _get(MigrationPanel.class);
    tab.setSelectedTab(panel);
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) TextField(com.vaadin.ui.TextField) TestHelper(org.corpus_tools.annis.gui.TestHelper) Date(java.util.Date) Autowired(org.springframework.beans.factory.annotation.Autowired) ActiveProfiles(org.springframework.test.context.ActiveProfiles) Algorithm(com.auth0.jwt.algorithms.Algorithm) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) CheckBox(com.vaadin.ui.CheckBox) MockWebServer(okhttp3.mockwebserver.MockWebServer) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) TextArea(com.vaadin.ui.TextArea) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) NotificationsKt(com.github.mvysny.kaributesting.v8.NotificationsKt) AnnisUI(org.corpus_tools.annis.gui.AnnisUI) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) Instant(java.time.Instant) Helper(org.corpus_tools.annis.gui.Helper) NotThreadSafe(net.jcip.annotations.NotThreadSafe) GrantedAuthority(org.springframework.security.core.GrantedAuthority) Test(org.junit.jupiter.api.Test) IOUtils(org.apache.commons.io.IOUtils) List(java.util.List) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) TabSheet(com.vaadin.ui.TabSheet) FinishedEvent(com.vaadin.ui.Upload.FinishedEvent) OAuth2User(org.springframework.security.oauth2.core.user.OAuth2User) Optional(java.util.Optional) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) MockResponse(okhttp3.mockwebserver.MockResponse) Authentication(org.springframework.security.core.Authentication) JWT(com.auth0.jwt.JWT) SimpleGrantedAuthority(org.springframework.security.core.authority.SimpleGrantedAuthority) StandardCharset(com.nimbusds.jose.util.StandardCharset) LinkedHashMap(java.util.LinkedHashMap) SingletonBeanStoreRetrievalStrategy(org.corpus_tools.annis.gui.SingletonBeanStoreRetrievalStrategy) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) OutputStream(java.io.OutputStream) OidcIdToken(org.springframework.security.oauth2.core.oidc.OidcIdToken) SecurityConfiguration(org.corpus_tools.annis.gui.security.SecurityConfiguration) Upload(com.vaadin.ui.Upload) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) DefaultOidcUser(org.springframework.security.oauth2.core.oidc.user.DefaultOidcUser) Button(com.vaadin.ui.Button) AfterEach(org.junit.jupiter.api.AfterEach) Assert.assertNull(org.junit.Assert.assertNull) ChronoUnit(java.time.temporal.ChronoUnit) BeanFactory(org.springframework.beans.factory.BeanFactory) Button(com.vaadin.ui.Button) TabSheet(com.vaadin.ui.TabSheet)

Aggregations

LocatorJ._click (com.github.mvysny.kaributesting.v8.LocatorJ._click)18 LocatorJ._get (com.github.mvysny.kaributesting.v8.LocatorJ._get)18 MockVaadin (com.github.mvysny.kaributesting.v8.MockVaadin)18 UIScopeImpl (com.vaadin.spring.internal.UIScopeImpl)18 Button (com.vaadin.ui.Button)18 AfterEach (org.junit.jupiter.api.AfterEach)18 BeforeEach (org.junit.jupiter.api.BeforeEach)18 Test (org.junit.jupiter.api.Test)18 BeanFactory (org.springframework.beans.factory.BeanFactory)18 Autowired (org.springframework.beans.factory.annotation.Autowired)18 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)18 ActiveProfiles (org.springframework.test.context.ActiveProfiles)18 WebAppConfiguration (org.springframework.test.context.web.WebAppConfiguration)18 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)17 LocatorJ._find (com.github.mvysny.kaributesting.v8.LocatorJ._find)14 ArrayList (java.util.ArrayList)14 TabSheet (com.vaadin.ui.TabSheet)13 TextField (com.vaadin.ui.TextField)12 Assertions.assertFalse (org.junit.jupiter.api.Assertions.assertFalse)12 GridKt (com.github.mvysny.kaributesting.v8.GridKt)11