-
Notifications
You must be signed in to change notification settings - Fork 4k
Standardize cypress viewport across all tests and fixes #11
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
Conversation
…ured sporadically - increased snapshot diff threshold by .5% - fix test - increase snapshot bounding box for and - allow multiple valid width values for darwin and linux for - set to 1 when running cypress open
…into tvst/screenshots
examples/core/reuse_label.py
Outdated
| else: | ||
| w1 = st.selectbox('label', ('m', 'f'), 1) | ||
| # Starting the report takes up the first run. | ||
| # When run the test will see the slider first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand exactly what's going on here. Why is the behavior different when headless == True vs False?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When headless == False the report is opened in the browser on streamlit run causing the value of st.test_run_count to be different between the two modes, which throws the test off.
examples/core/reuse_label.py
Outdated
| w1 = st.button('label') | ||
| elif st.test_run_count == 1: | ||
| w1 = st.slider('label', 25, 0, 100, 1) | ||
| if config.get_option('server.headless'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use st.get_option(...) instead.
examples/core/reuse_label.py
Outdated
| elif st.test_run_count == 1: | ||
| w1 = st.slider('label', 0, 100, 25, 1) | ||
| else: | ||
| w1 = st.selectbox('label', ('m', 'f'), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole logic is a bit weird, but if I understand it correctly couldn't you just replace lines 19-37 with this:
if hasattr(st, 'test_run_count'):
st.test_run_count += 1
else:
st.test_run_count = -1 if config.get_option('server.headless') else 0
if st.test_run_count < 1:
w1 = st.slider('label', 0, 100, 25, 1)
else:
w1 = st.selectbox('label', ('m', 'f'), 1)(that is, the st.button is not important, right? So long as the slider becomes a selectbox?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, small tweak and works like a charm
# By Nahuel Emiliano Rosso Fandiño (4) and others # Via GitHub * develop: Fix WebsocketConnection totalTries count (streamlit#38) Adding width and height parameter to st.dataframe (streamlit#33) 403 Error message (streamlit#37) Test frontend in CircleCI (streamlit#35) Merge version 0.45.0 (streamlit#34) Hash numpy arrays. Use fixed size sample. (streamlit#16) st.image() resizing images when are bigger than the maximum (streamlit#30) Deprecating data parameter from st.deck_gl_chart() (streamlit#22) Standardize cypress viewport across all tests and fixes (streamlit#11) Adding unit tests for magic (streamlit#13) # Conflicts: # proto/streamlit/proto/ForwardMsg.proto
* Adding unit tests for magic (#13) * Adding unit tests for magic * Standardize cypress viewport across all tests and fixes (#11) - standardize cypress viewport across all tests - remove snapshot corresponding to missing `mplotlib` test - fixed issue with snapshots being cutoff or wrong element being captured sporadically - increased snapshot diff threshold by .5% - increase snapshot bounding box for `disconnect.py` and `empty_dataframes.py` - allow multiple valid width values for `vega_lite_chart.py` - set `devicePixelRatio` to 1 when running `cypress open' - remove spinner e2e test and core example - fix various cypress tests - preload `viz.js` when running `yarn start` * Deprecating data parameter from st.deck_gl_chart() (#22) * Deprecating data parameter for st.deck_gl_chart() * Basic deck_gl example setting viewport * DOCSTRING * LINT * Moving deck_gl_chart test from streamlit_test to deck_gl_test * Checking kwargs instead of a data parameter * Fixing comments from thiago * st.image() resizing images when are bigger than the maximum (#30) * Resizing image when its bigger than the maximum width * Resizing image when its bigger than the maximum width * MAXIMUM_CONTENT_WIDTH documentation * MAXIMUM_CONTENT_WIDTH documentation * Hash numpy arrays. Use fixed size sample. (#16) * Merge version 0.45.0 (#34) * Restore correct vertical spacing for report elements. * Break Block.tsx into more functions. * Tiny refactors in Block.tsx * Add "key" property to element in DocString, to avoid warnings. * Fix #1230: OSError not caught when writing cache to disk * Don't show hashing warning when user imports a module inside a cached function. * Fix #6: report should loads element by element (was broken since Sidebar PR) * Try to fix CircleCI issue: Method 'renderElementWithErrorBoundary' expected no return value * Add typing to function. * Remove unecessary dockerfiles * Fix a bunch of examples * Fix color of syntax error code in modal dialog. * Remove old style copyright from conftest.py * Remove st.warning when hashing a class. * Add astor to Python requirements * Update widget API in some e2e tests * Clean up st.foo_widget() signatures in st.help() * Lint docs/getting_started.md * Clean up widget examples in docstrings. * Add comment to slider examples in docs. * Tweak Streamlit's description in setup.py * Sort pipfile modules * Re-add scripts and Makefile rules to publish packages to conda. * Fix update_version.py to support new conda location and remove old docker folder. * Make `streamlit config show` pipeable to a file. * Update docs/ site * Remove /docs/api invalidation from Makefile * Improve docstring for st.slider * Remove st.Cache (capital C) from __init__ while we figure out what to call it. * Up version to 0.45.0 * Turn off tests for st.Cache (capital C) * Try turning off tests again * Test frontend in CircleCI (#35) * CircleCI: run frontend tests after python tests * `make jstest`: don't run non-existent 'coverage' script * Add `make jscoverage` in case we want to use it * Make sure we generate scssvars * Conditionally run our frontend tests * 403 Error message (#37) * 403 Error message * ESLint * Adding width and height parameter to st.dataframe (#33) This PR proposes to add a width and height parameter to st.dataframe. Protobuf is changed to include an ElementDimensionSpec field to carry this information. This is included as part of the forward message metadata. The message is parsed and height/width information is extracted and passed down to the Dataframe React component in Block.tsx. Width is set in Block.tsx since existing logic applies to a generic element, while height is set in the Dataframe element in some ad hoc logic. * Fix WebsocketConnection totalTries count (#38) * Fixing overlap between onload and onreadystatechange * Removing unused events
Standardize cypress viewport across all tests
Additional fixes and changes
empty_dataframes.py, that was old and needed updatingmplotlibtestreuse_label.pytest because we run in headless mode on circleci but not locallydisconnect.pyandempty_dataframes.pyvega_lite_chart.pydevicePixelRatioto 1 when runningcypress open.. fixes 918audio.pytest by increasing the timeout because we're fetching an external filedisabled.pytest because the slider api changedviz.jswhen runningyarn start.. fixes 884Issue