Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Conversation

@Marc-Andre-Rivet
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Mar 7, 2019

Fixes #479

The test fails without the fix: https://circleci.com/gh/plotly/dash-core-components/3577

Exception: ('browser error logged during test', {'level': 'SEVERE', 'message': "http://localhost:8050/_dash-component-suites/dash_renderer/react-dom@15.4.2.min.js?v=0.20.0&m=1551989220 13:5540 Uncaught TypeError: Cannot read property 'toFixed' of undefined", 'source': 'javascript', 'timestamp': 1551989561259})

data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
style={{display: 'initial'}}
Copy link
Contributor Author

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

Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

@Marc-Andre-Rivet Marc-Andre-Rivet Mar 8, 2019

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.

# store the very last timestamp
self.last_timestamp = last_timestamp

return filtered
Copy link
Contributor Author

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

Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor Author

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)
Copy link
Contributor Author

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..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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! :-)

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

@Marc-Andre-Rivet Marc-Andre-Rivet marked this pull request as ready for review March 7, 2019 20:44

options = Options()
capabilities = DesiredCapabilities.CHROME
capabilities['loggingPrefs'] = {'browser': 'SEVERE'}
Copy link
Collaborator

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 :rage4:

Copy link
Contributor Author

@Marc-Andre-Rivet Marc-Andre-Rivet Mar 8, 2019

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".

Copy link
Collaborator

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.

Copy link
Contributor

@valentijnnieman valentijnnieman left a 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!

data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
style={{display: 'initial'}}
Copy link
Contributor

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?

# store the very last timestamp
self.last_timestamp = last_timestamp

return filtered
Copy link
Contributor

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)
Copy link
Contributor

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! :-)

Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃

@Marc-Andre-Rivet Marc-Andre-Rivet merged commit 77d327f into master Mar 8, 2019
@Marc-Andre-Rivet Marc-Andre-Rivet deleted the issue479-vertical-slider-regression branch March 8, 2019 19:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertical Slider has stopped working

4 participants