Closed SebastianDietrich closed 2 years ago
Hi, unfortunately those fields are only present in the browser - those fields are not present on the server-side. I think it's even mentioned in Karibu's documentation 🤔 let me check.
Unfortunately that makes testing of the actual login process Via Karibu testing impossible. The best you can do is to invoke the login listener.
Yup, mentioned at https://github.com/mvysny/karibu-testing/tree/master/karibu-testing-v10#support-for-loginform-and-loginoverlay . Closing, please reopen if the documentation could be improved.
Thanks for that superquick answer - and sorry for not having found that documentation myself. The reason for that is that I've just checked the README.md in https://github.com/mvysny/karibu-testing and was not aware of the much more extensive README.md documentation in https://github.com/mvysny/karibu-testing/tree/master/karibu-testing-v10. Totally my fault, since it is mentioned in the main README.md.
No problem! I'll try to make the main page link more prominent; also I'll try to describe the login view issue in more detail in the documentation
The example applications have a LoginView that extends com.vaadin.flow.component.login.LoginOverlay. The LoginViewTest tests navigation to LoginView and (failed, since not logged in) navigation to another view. But it does not test the login-process (i.e. entering UN/PW) itself. Although this is not generally necessary (since it just tests a vaadin component) such a test would be nice since it shows how to acces fields of a component. I've tried
_get(TextField.class, spec -> spec.withId("vaadinLoginUsername")).setValue(username);
since this is howcom.vaadin.flow.component.login.testbench.LoginFormElement
does this. But that did not work:Now I am not sure if accessing fields of a component is even possible with karibu-testing, or if I did anything wrong.