Search in sources :

Example 16 with LocatorJ._find

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

the class EmbeddedVisTest method invalidRemoteSaltUrlScheme.

@Test
void invalidRemoteSaltUrlScheme() throws Exception {
    EmbeddedVisUI ui = (EmbeddedVisUI) UI.getCurrent();
    MockRequest request = MockVaadinKt.getMock(VaadinRequest.getCurrent());
    request.setParameter("embedded_salt", "file://example.com/does-not-exist.salt");
    ui.attachToPath("/embeddedvis/raw_text", VaadinRequest.getCurrent());
    awaitCondition(60, () -> !_find(Label.class, spec -> spec.withPredicate(l -> l.getContentMode() == ContentMode.HTML && l.getValue().startsWith("<h1>"))).isEmpty());
    Label labelMessage = _get(Label.class);
    assertEquals("<h1>Could not generate the visualization.</h1><div>Expected URL scheme 'http' or 'https' but was 'file'</div>", labelMessage.getValue());
}
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) Label(com.vaadin.ui.Label) MockRequest(com.github.mvysny.kaributesting.mockhttp.MockRequest) 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