use of com.github.mvysny.kaributesting.v8.LocatorJ._click in project ANNIS by korpling.
the class AdminViewTest method setup.
@BeforeEach
void setup() throws IOException {
UIScopeImpl.setBeanStoreRetrievalStrategy(new SingletonBeanStoreRetrievalStrategy());
this.ui = beanFactory.getBean(AnnisUI.class);
MockVaadin.setup(() -> ui);
_click(_get(Button.class, spec -> spec.withCaption("Administration")));
}
use of com.github.mvysny.kaributesting.v8.LocatorJ._click in project ANNIS by korpling.
the class ReferenceLinkEditorTest method setup.
@BeforeEach
void setup() throws IOException {
UIScopeImpl.setBeanStoreRetrievalStrategy(new SingletonBeanStoreRetrievalStrategy());
this.ui = beanFactory.getBean(AnnisUI.class);
MockVaadin.setup(() -> ui);
_click(_get(Button.class, spec -> spec.withCaption("Administration")));
TabSheet tab = _get(TabSheet.class);
panel = _get(ReferenceLinkEditor.class);
tab.setSelectedTab(panel);
// Add some example entries
ui.getUrlShortener().getRepo().deleteAll();
UrlShortener urlShortener = this.ui.getUrlShortener();
entry1 = new UrlShortenerEntry();
entry1.setId(UUID.fromString("4366b0a5-6b27-40fe-ac5d-08e75c9eef51"));
entry1.setUrl(URI.create("/test1"));
urlShortener.getRepo().save(entry1);
entry2 = new UrlShortenerEntry();
entry2.setId(UUID.fromString("b1912b10-93f3-4018-84e8-6bf7572ee163"));
entry2.setUrl(URI.create("/test2"));
entry2.setTemporaryUrl(URI.create("/temp2"));
urlShortener.getRepo().save(entry2);
}
use of com.github.mvysny.kaributesting.v8.LocatorJ._click 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());
}
use of com.github.mvysny.kaributesting.v8.LocatorJ._click 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())));
}
}
use of com.github.mvysny.kaributesting.v8.LocatorJ._click 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<"));
}
Aggregations