Search in sources :

Example 1 with Navigate

use of com.aire.ux.test.Navigate in project aire-components by aire-ux.

the class TopLevelVaadinTestCaseTest method ensureTestMethodWithViewTestGeneratesFrameEntryWithMethod.

@ViewTest
@Navigate("test")
@Routes(scanPackage = "com.aire.ux.test.vaadin.scenarios.classroutes")
void ensureTestMethodWithViewTestGeneratesFrameEntryWithMethod() {
    val method = Frames.resolveCurrentFrame().getContext().getTestMethod();
    assertTrue(method.isPresent());
}
Also used : lombok.val(lombok.val) ViewTest(com.aire.ux.test.ViewTest) Navigate(com.aire.ux.test.Navigate) Routes(com.aire.ux.test.Routes)

Example 2 with Navigate

use of com.aire.ux.test.Navigate in project aire-components by aire-ux.

the class ThemeTest method ensureThemeDecoratesButton.

@ViewTest
@Navigate("main")
void ensureThemeDecoratesButton(@Context TestContext context) {
    val result = context.selectFirst("aire-button.test-theme", TestButton.class);
    assertTrue(result.isPresent());
}
Also used : lombok.val(lombok.val) ViewTest(com.aire.ux.test.ViewTest) Navigate(com.aire.ux.test.Navigate)

Example 3 with Navigate

use of com.aire.ux.test.Navigate in project aire-components by aire-ux.

the class ExploratorySpringTest method ensureInteractingWithElementWorks.

@ViewTest
@Navigate("main")
void ensureInteractingWithElementWorks(@Autowired ApplicationContext applicationContext, @Select(".main") Element initialView, @Select(".main > vaadin-button") Button button, @Context TestContext context) {
    assertNotNull(applicationContext);
    assertEquals(0, initialView.getComponent().map(component -> (MainView) component).orElseThrow().getCount());
    button.click();
    val view = context.selectFirst(".main", MainView.class).get();
    assertEquals(view.getCount(), 1);
}
Also used : ViewTest(com.aire.ux.test.ViewTest) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Scenario1Configuration(com.aire.ux.spring.test.scenario1.Scenario1Configuration) AireTest(com.aire.ux.test.AireTest) lombok.val(lombok.val) Select(com.aire.ux.test.Select) Autowired(org.springframework.beans.factory.annotation.Autowired) EnableSpring(com.aire.ux.test.spring.EnableSpring) ApplicationContext(org.springframework.context.ApplicationContext) Context(com.aire.ux.test.Context) Inject(javax.inject.Inject) Test(org.junit.jupiter.api.Test) Navigate(com.aire.ux.test.Navigate) TestService(com.aire.ux.spring.test.scenario1.TestService) Button(com.vaadin.flow.component.button.Button) TestContext(com.aire.ux.test.TestContext) Routes(com.aire.ux.test.Routes) Element(com.vaadin.flow.dom.Element) ContextConfiguration(org.springframework.test.context.ContextConfiguration) MainView(com.aire.ux.spring.test.scenario1.MainView) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) lombok.val(lombok.val) MainView(com.aire.ux.spring.test.scenario1.MainView) ViewTest(com.aire.ux.test.ViewTest) Navigate(com.aire.ux.test.Navigate)

Example 4 with Navigate

use of com.aire.ux.test.Navigate in project aire-components by aire-ux.

the class NavigationTest method ensureRouteIsAvailable.

@Order(2)
@ViewTest
@Navigate("main")
@Routes(scanClassPackage = MainLayout.class)
void ensureRouteIsAvailable(@Context TestContext context) {
    val layout = context.selectFirst(MainLayout.class);
    assertTrue(layout.isPresent());
}
Also used : lombok.val(lombok.val) Order(org.junit.jupiter.api.Order) ViewTest(com.aire.ux.test.ViewTest) Navigate(com.aire.ux.test.Navigate) Routes(com.aire.ux.test.Routes)

Example 5 with Navigate

use of com.aire.ux.test.Navigate in project aire-components by aire-ux.

the class TopLevelVaadinTestCaseTest method ensureTestMethodGeneratesFrameWithCurrentMethod.

@ViewTest
@Navigate("test")
@Routes(scanPackage = "com.aire.ux.test.vaadin.scenarios.classroutes")
void ensureTestMethodGeneratesFrameWithCurrentMethod() throws NoSuchMethodException {
    val method = Frames.resolveCurrentFrame().getContext().getTestMethod();
    assertTrue(method.isPresent());
    val m = method.get();
    assertEquals(m, TopLevelVaadinTestCaseTest.class.getDeclaredMethod("ensureTestMethodGeneratesFrameWithCurrentMethod"));
}
Also used : lombok.val(lombok.val) ViewTest(com.aire.ux.test.ViewTest) Navigate(com.aire.ux.test.Navigate) Routes(com.aire.ux.test.Routes)

Aggregations

Navigate (com.aire.ux.test.Navigate)7 ViewTest (com.aire.ux.test.ViewTest)7 lombok.val (lombok.val)7 Routes (com.aire.ux.test.Routes)5 MainView (com.aire.ux.spring.test.scenario1.MainView)1 Scenario1Configuration (com.aire.ux.spring.test.scenario1.Scenario1Configuration)1 TestService (com.aire.ux.spring.test.scenario1.TestService)1 AireTest (com.aire.ux.test.AireTest)1 Context (com.aire.ux.test.Context)1 Select (com.aire.ux.test.Select)1 TestContext (com.aire.ux.test.TestContext)1 EnableSpring (com.aire.ux.test.spring.EnableSpring)1 ClassScenarioRouteLayout (com.aire.ux.test.vaadin.scenarios.classroutes.ClassScenarioRouteLayout)1 Button (com.vaadin.flow.component.button.Button)1 Element (com.vaadin.flow.dom.Element)1 Inject (javax.inject.Inject)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertNotNull (org.junit.jupiter.api.Assertions.assertNotNull)1 Order (org.junit.jupiter.api.Order)1 Test (org.junit.jupiter.api.Test)1