-
-
Notifications
You must be signed in to change notification settings - Fork 143
Issue479 - Fix Vertical Slider regression #481
Conversation
src/components/Slider.react.js
Outdated
| data-dash-is-loading={ | ||
| (loading_state && loading_state.is_loading) || undefined | ||
| } | ||
| style={{display: 'initial'}} |
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.
overrides browser default styling display: block for default div behavior -- this allows the child to have the correct size
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.
🤔 IE11? https://developer.mozilla.org/en-US/docs/Web/CSS/initial#Browser_compatibility
A little fiddling indicates that for display, initial means inline? Can we use that?
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.
Oh.. did not realize IE11 did not support initial. Thanks for checking it out.
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.
Shouldn't the display be inline-block anyway, like here?
| display: 'inline-block', |
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.
So.. realizing that maybe just doing style={vertical ? { height: '100%' } : {}} on the wrapper div might be just as effective. This mimics the nested slider's styling.
test/IntegrationTests.py
Outdated
| # store the very last timestamp | ||
| self.last_timestamp = last_timestamp | ||
|
|
||
| return filtered |
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.
To be called once per test (at least once in the teardown phase) to get the test-related browser errors
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 really like this solution - much cleaner than the window.tests hack, and (cc @valentijnnieman) it will catch errors during page load as well, presumably.
I'm curious though, why a separate class, rather than just a method of IntegrationTests?
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.
No specific reason. Found it while looking for the capabilities finer points in Python and liked it. Did not stop to consider if it made more or less sense to have it standalone. I can imagine wanting to make this richer and keeping it in a class sort of marginally makes sense in that context.
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.
Looks good :-) I think it would make more sense to me to have it as a method if IntegrationTests instead of a separate class - just to keep everything in one place.
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.
Sure. I can move this into IntegrationTests
| options.binary_location = os.environ['DASH_TEST_CHROMEPATH'] | ||
|
|
||
| cls.driver = webdriver.Chrome(chrome_options=options) | ||
| cls.driver = webdriver.Chrome(options=options, desired_capabilities=capabilities) |
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.
Settings to get browser errors
| v_slider.click() | ||
|
|
||
| for entry in self.log_facade.get_log(): | ||
| raise Exception('browser error logged during test', entry) |
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.
If there's a message here, something went wrong. Not doing this for all tests as lots of tests have issues at the moment..
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.
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'm wondering if this test shouldn't be in the test_gallery test, since that's where most of the snapshots of components are taken. Although, I would rather see the test_gallery test eventually be broken up into specific tests per component, so I guess this is a good start! :-)
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 think the gallery snapshot approach is a bad idea in general. When I see a diff I want that diff to be isolated and linked to as little dependencies as possible. If the vertical slider breaks, it's obvious. And no wondering if there's multiple issues in the single diff.
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.
Agreed - so many times I've had to look at a diff where something was added in the middle of a long page... and percy has no idea that it's all the same content just shifted down, so I have to try and do that diffing in my head. Much better to break these up into single-purpose images, and not worry about making a huge total number of images.
|
|
||
| options = Options() | ||
| capabilities = DesiredCapabilities.CHROME | ||
| capabilities['loggingPrefs'] = {'browser': 'SEVERE'} |
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 tried in vain to find docs for this, did you? If this config does what's needed here that's fine for this PR, I'm just curious if we might like other settings in other cases, to get messages that don't quite rise to the level of SEVERE ![]()
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.
https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#loggingpreferences-json-object
Available values for most loggers are "OFF", "SEVERE", "WARNING", "INFO", "CONFIG", "FINE", "FINER", "FINEST", "ALL".
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.
mmm yeah, I saw that one, but it also says
See the documentation of each driver for what browser specific logging components are available.
Which I was hoping existed somewhere and would tell us something about what kind of messages are included in each level... oh well, trial and error I guess.
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.
Haven't run the new test on my machine, just looked at the code and commented here and there. If other reviews are 👍 then I'm fine with it too!
src/components/Slider.react.js
Outdated
| data-dash-is-loading={ | ||
| (loading_state && loading_state.is_loading) || undefined | ||
| } | ||
| style={{display: 'initial'}} |
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.
Shouldn't the display be inline-block anyway, like here?
| display: 'inline-block', |
test/IntegrationTests.py
Outdated
| # store the very last timestamp | ||
| self.last_timestamp = last_timestamp | ||
|
|
||
| return filtered |
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.
Looks good :-) I think it would make more sense to me to have it as a method if IntegrationTests instead of a separate class - just to keep everything in one place.
| v_slider.click() | ||
|
|
||
| for entry in self.log_facade.get_log(): | ||
| raise Exception('browser error logged during test', entry) |
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'm wondering if this test shouldn't be in the test_gallery test, since that's where most of the snapshots of components are taken. Although, I would rather see the test_gallery test eventually be broken up into specific tests per component, so I guess this is a good start! :-)
…ly/dash-core-components into issue479-vertical-slider-regression
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.
💃
Fixes #479
The test fails without the fix: https://circleci.com/gh/plotly/dash-core-components/3577