use of com.aire.ux.test.Context 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);
}
use of com.aire.ux.test.Context in project aire-components by aire-ux.
the class ApplicationLayoutTest method ensureActionManagerCanEnableAndDisableButtons.
@ViewTest
@DirtiesContext
void ensureActionManagerCanEnableAndDisableButtons(@Autowired UserInterface ui, @Context TestContext $) {
val action = spy(Actions.create("ui.module.stop", (self) -> {
}));
ui.register(Selection.path(":main:navigation"), Extensions.create(":management-menu", (NavigationBar p) -> {
val button = new Button("hello");
action.addActionEventListener(Type.ActionEnabled, (eventType, event) -> {
button.setEnabled(true);
});
action.addActionEventListener(Type.ActionDisabled, (eventType, event) -> {
button.setEnabled(true);
});
p.add(button);
}));
action.enable();
$.flush();
assertTrue($.selectFirst("vaadin-button[enabled]", Button.class).isPresent());
action.dispose();
}
Aggregations