New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Elements within "expandables" containers are not visible in ElementTree #8089
Comments
thanks, @Asaurus1 for opening this issue! @AnOctopus I think for the current version elements inside expendables are not reachable, and it is an expected behavior, is that correct? |
I'm going to close this as fixed --- it seems to work just fine if I actually write my tests properly, e.g. def test_status():
from streamlit.testing.v1 import AppTest
at = AppTest.from_string("import streamlit as st\nst.status(label='WITH PROPER ARGUMENTS FOR THE FUNCTION CALLS').error('foo')")
at.run()
assert at.error[0].value == "foo" |
@AnOctopus Re-opening since I have determined a more specific bug. It seems that calling ".update()" on a status element clears it's contents. Parse_tree_from_messages probably just needs a a special case to handle these update messages without replacing the element entirely. I'll update the first post when I'm back on a keyboard. I'm also not sure if #7923 fixes this or not, I will have to do some testing To reproduce: def test_status():
from streamlit.testing.v1 import AppTest
at = AppTest.from_string("import streamlit as st\nsts=st.status('bar')\nsts.error('foo')\nsts.update(state='complete')")
at.run()
assert at.error[0].value == "foo" |
It seems like #7923 does fix this. |
Checklist
Summary
AppTest does not seem to capture elements created inside of expandables like
st.status
orst.expander
. As mentioned in #7719, there's currently no public API for expander or status elements inAppTest
but, even when accessed viaAppTest.get('expandables')[0]
there are no elements captured inside of the expandable element.Reproducible Code Example
also
Steps To Reproduce
Run the function in streamlit 1.30.0+
Expected Behavior
Should behave like the following and raise no exception.
Current Behavior
IndexError
onat.error[0]
Even if you change the final line to
at.get('expandables')[0].error[0]
you still get anIndexError
on.error[0]
. There doesn't seem to be any work-around for getting elements drawn inside expanders at theAppTest
interface.Is this a regression?
Debug info
Additional Information
No response
The text was updated successfully, but these errors were encountered: