Created
December 29, 2022 20:14
-
-
Save yabetancourt/d1761cdd8cfb8294b3e40ff08c3b2b64 to your computer and use it in GitHub Desktop.
Testing visual components in vaadin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.vaadin.flow.component.button.Button; | |
import com.vaadin.flow.component.grid.Grid; | |
import com.vaadin.testbench.unit.SpringUIUnit4Test; | |
import cu.uclv.postgrade.Application; | |
import cu.uclv.postgrade.ui.view.course.program.CourseProgramListView; | |
import org.junit.Test; | |
import org.junit.jupiter.api.Assertions; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.boot.test.context.SpringBootTest; | |
@SpringBootTest(classes = {Application.class}) | |
public class CourseProgramListViewTest extends SpringUIUnit4Test { | |
@Test | |
public void test() { | |
final CourseProgramListView courseProgramListView = navigate(CourseProgramListView.class); | |
Grid grid = $view(Grid.class).first(); | |
Assertions.assertNotNull(grid.getLazyDataView().getItems()); | |
LoggerFactory.getLogger("Test").info("hay " + grid.getLazyDataView().getItemCountEstimate()); | |
} | |
@Test | |
public void test2() { | |
final CourseProgramListView courseProgramListView = navigate(CourseProgramListView.class); | |
Button button = $view(Button.class).withPropertyValue(Button::getText, "Crear") | |
.single(); | |
Assertions.assertNotNull(button); | |
} | |
@Override | |
public boolean printTree() { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment