Open GrazingScientist opened 1 month ago
Thanks for bringing up this example @GrazingScientist. I think it is a little bit more complicated. If you start your page with NiceGUI and type "Auto" in the browser, you must also press the "TAB" key to confirm the auto completion. So we would need to use user.find("Text").type("Auto").trigger("keydown.tab")
.
Hi @rodja ,
thanks for coming back so quickly. I eagerly tried your tip, but the result is the same. The test fails with:
AssertionError: expected to see at least one element with marker=AutoComplete or content=AutoComplete on the page
This is the code I used:
from nicegui import ui
def setup() -> None:
@ui.page("/")
def main() -> None:
options = ["AutoComplete", "NiceGUI", "Awesome"]
ui.input(label="Text", placeholder="start typing", autocomplete=options)
async def test_validation(user):
setup()
await user.open("/")
await user.should_not_see("AutoComplete")
user.find("Text").type("Auto").trigger("keydown.tab")
await user.should_see("AutoComplete")
I'm sorry. This is not implemented yet. I just wanted to clarify the API. We are pretty busy at the moment. Would you like to try creating a pull request.
I will try to dig into the code, if I have the time. Can you provide me a link to the code section, where I need to focus on?
I think you could try adding a special case for ui.input
in the trigger loop over all elements:
Similar to what we do for ui.link
and ui.select
in the click
method:
An workaround until we get this done might be to just get the element and check for the possible autocompletes by accessing the .props
dict.
Description
Hi!
I found another non-working feature in the testing framework, when I want to test that the autocomplete is working.
The test below is failing, although it should not.
I hope, you can fix it. ❤️