I am using streamlit 1.36.0 and I am trying to write a test for our application.
at = AppTest.from_file(self.app_root)
at.run()
at = at.switch_page(page_file)
at.run()
I tried to render the page like so but it did not render it after the switch_page action. (I used -s on the testing run and put a print in the file and added a pdb breakpoint).
Is there a way to go into the initial run of the main script with a changed URL to force navigation to call a different page?
Main app is just navigation based on a pages dictionary (key string, value created by st.Page)
Did you find a solution to this? I seem to experience the same issue with 1.37.1 and page navigation.
Calling AppTest.from_file on the app_root correctly renders elements, but using switch_page to one of the other page files does not seem to render any elements.
For my use case, I am interested in loading the main page to set a number of session_states, and then navigate to a sub-page - very similar to the streamit example here: Beyond the basics of app testing - Streamlit Docs . Session_state is correctly set and persists, but page elements is not rendered after calling switch_page.
I am running into this now on streamlit 1.38.0. We are trying to introduce the new navigation but all of the tests fail with very similar behavior where the new page doesn’t render after switching page.
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.