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.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.