Hi all,
I’m wondering whether there is a way to test components.
For example, the first test would be to run it with different parameters to see whether it does not break.
Secondly, I want to check that the component displays something correctly on the page.
Does anybody have any clue or hint they can direct me so that I can start checking it out?
@edsaac thanks. I saw the documentation, which is more related to testing the full applications, I wonder if there is a way to test the component integration itself.
If it interacts with normal streamlit widgets, you could also potentially use the app testing framework, but that is not designed to work with 3rd party components directly.
When I debug at the beginning of the test and I open the streamlit page from the streamlit runner in the test, the page is showed properly. However, the test cannot access some of the HTML nodes added by the component, and I feel it’s because maybe the test is too fast.
So sorry for the lack of response. The sleep(5) is there so that the app finishes loading in the browser before the tests start running. For an individual locator, you can tweak how long playwright will wait before moving on. LocatorAssertions | Playwright Python
If that doesn’t work, I find having playwright taking screenshots on failing tests to be very helpful for debugging. You can see examples of that in st_pages.