Skip to content
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

Fix debugger html #2035

Merged
merged 3 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).

- [#1976](https://github.com/plotly/dash/pull/1976) Fix [#1962](https://github.com/plotly/dash/issues/1962) in which DatePickerSingle and DatePickerRange are extremely slow when provided a long list of disabled_days.

- [#2035](https://github.com/plotly/dash/pull/2035) Fix [#2033](https://github.com/plotly/dash/issues/2033) In-App error reporting does not render HTML.

### Changed

- [#2016](https://github.com/plotly/dash/pull/2016) Drop the 375px width from default percy_snapshot calls, keep only 1280px
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ function UnconnectedErrorContent({error, base}) {
</div>
)}
{/* Backend Error */}
{typeof error.html !== 'string' ? null : error.html.indexOf(
'<!DOCTYPE'
) === 0 ? (
{typeof error.html !== 'string' ? null : error.html
.split()[0]
.toLowerCase()
.startsWith('<!doctype') ? (
<div className='dash-be-error__st'>
<div className='dash-backend-error'>
{/* Embed werkzeug debugger in an iframe to prevent
Expand Down
10 changes: 7 additions & 3 deletions dash/testing/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import warnings
import percy
import requests

from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
Expand Down Expand Up @@ -188,8 +189,14 @@ def percy_snapshot(
"""
)

try:
self.percy_runner.snapshot(name=snapshot_name, widths=widths)
except requests.HTTPError as err:
# Ignore retries.
if err.request.status_code != 400:
raise err

if convert_canvases:
self.driver.execute_script(
"""
const stash = window._canvasStash;
Expand All @@ -204,9 +211,6 @@ def percy_snapshot(
"""
)

else:
self.percy_runner.snapshot(name=snapshot_name, widths=widths)

def take_snapshot(self, name):
"""Hook method to take snapshot when a selenium test fails. The
snapshot is placed under.
Expand Down