Skip to content

Conversation

@jrhone
Copy link
Contributor

@jrhone jrhone commented Aug 26, 2019

Standardize cypress viewport across all tests

Additional fixes and changes

  • fix a test in empty_dataframes.py, that was old and needed updating
  • 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%
  • fix reuse_label.py test because we run in headless mode on circleci but not locally
  • 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.. fixes 918
  • remove spinner e2e test and core example.. replaced with #5
  • fix audio.py test by increasing the timeout because we're fetching an external file
  • fix disabled.py test because the slider api changed
  • preload viz.js when running yarn start.. fixes 884

Issue

@jrhone jrhone changed the title Cypress fixes Standardize cypress viewport across all tests and fixes Aug 26, 2019
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.
Copy link
Contributor

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?

Copy link
Contributor Author

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.

w1 = st.button('label')
elif st.test_run_count == 1:
w1 = st.slider('label', 25, 0, 100, 1)
if config.get_option('server.headless'):
Copy link
Contributor

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.

elif st.test_run_count == 1:
w1 = st.slider('label', 0, 100, 25, 1)
else:
w1 = st.selectbox('label', ('m', 'f'), 1)
Copy link
Contributor

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?)

Copy link
Contributor Author

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

@jrhone jrhone merged commit 712c2cd into streamlit:develop Aug 28, 2019
tconkling added a commit to tconkling/streamlit that referenced this pull request Sep 4, 2019
# 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
tconkling added a commit that referenced this pull request Sep 4, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants