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 ci failures #2006

Merged
merged 29 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3912c81
Add more Chrome browser arguments.
T4rk1n Apr 5, 2022
0af38c4
Kill all new threads.
T4rk1n Apr 6, 2022
64b1a60
Wait between clicks cbpu002
T4rk1n Apr 6, 2022
cf26a00
Fix test rdrh003
T4rk1n Apr 6, 2022
070d718
Skip test grva004 on werkzeug 2.1.0
T4rk1n Apr 6, 2022
8c6e927
Add pytest-rerunsfailures
T4rk1n Apr 7, 2022
fcd6a6d
Skip grva005 if werkzeug 2.1.0-1
T4rk1n Apr 7, 2022
04e81ba
Use xfail for flaky tests.
T4rk1n Apr 7, 2022
dc97ec6
Reruns dcc tests.
T4rk1n Apr 7, 2022
58fd024
Migrate to percy-selenium.
T4rk1n Apr 7, 2022
d0a0d47
Add delay argument to dash_duo.multiple_click
T4rk1n Apr 8, 2022
8d2b1d3
Remove percynofinalize.
T4rk1n Apr 8, 2022
1befd3c
Skip lcbc005_long_callback_caching.
T4rk1n Apr 8, 2022
12fc60a
Add `--parallel` to percy exec calls & new finalize.
T4rk1n Apr 8, 2022
63a684d
Prevent initial call in html tests.
T4rk1n Apr 8, 2022
8ec0e2e
fix html test typo and test
alexcjohnson Apr 9, 2022
5dfa6b0
:hocho: deprecated find_element(s)_by_css_selector
alexcjohnson Apr 9, 2022
4e40f20
modernize basic callback test
alexcjohnson Apr 10, 2022
c23be81
fix new percy_finalize
alexcjohnson Apr 11, 2022
3884843
cbsc001 flag percy snapshot before increase call count.
T4rk1n Apr 11, 2022
77984d1
Use dynamic port range if no port specified.
T4rk1n Apr 11, 2022
57c0ea4
Fix tests with dynamic port.
T4rk1n Apr 11, 2022
357d959
Retry table cell assertions on StaleElementReferenceException
T4rk1n Apr 11, 2022
9934ae3
extra wait in devtool error visual tests
alexcjohnson Apr 11, 2022
8e3e6c3
Revert "fix new percy_finalize"
T4rk1n Apr 12, 2022
0b5c15c
Revert "Add `--parallel` to percy exec calls & new finalize."
T4rk1n Apr 12, 2022
d2bd5aa
Revert "Remove percynofinalize."
T4rk1n Apr 12, 2022
b604777
Revert "Migrate to percy-selenium."
T4rk1n Apr 12, 2022
aea397b
noise
alexcjohnson Apr 12, 2022
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: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ jobs:
. venv/bin/activate && rm -rf components/dash-core-components/dash_core_components
cd components/dash-core-components
TESTFILES=$(circleci tests glob "tests/integration/**/test_*.py" | circleci tests split --split-by=timings)
pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml --junitprefix="components.dash-core-components" ${TESTFILES}
pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml --junitprefix="components.dash-core-components" ${TESTFILES} --reruns 3
- store_artifacts:
path: ~/dash/components/dash-core-components/test-reports
- store_test_results:
Expand Down
2 changes: 1 addition & 1 deletion components/dash-core-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"private::lint.prettier": "prettier --config .prettierrc src/**/*.js --list-different",
"prepublishOnly": "rm -rf lib && babel src --out-dir lib --copy-files && rm -rf lib/jl/ lib/*.jl",
"test": "run-s -c lint test:intg test:pyimport",
"test:intg": "pytest --nopercyfinalize --headless tests/integration",
"test:intg": "pytest --nopercyfinalize --headless tests/integration --reruns 3",
"test:pyimport": "python -m unittest tests/test_dash_import.py",
"prebuild:js": "cp node_modules/plotly.js-dist-min/plotly.min.js dash_core_components_base/plotly.min.js && cp node_modules/mathjax/es5/tex-svg.js dash_core_components_base/mathjax.js",
"build:js": "webpack --mode production",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from datetime import datetime, timedelta

import pytest
import werkzeug

from dash import Dash, Input, Output, html, dcc, no_update


Expand Down Expand Up @@ -71,6 +73,11 @@ def test_dtps010_local_and_session_persistence(dash_dcc):
assert dash_dcc.get_logs() == []


@pytest.mark.xfail(
condition=werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with 204 and Transfer-Encoding",
strict=False,
)
def test_dtps011_memory_persistence(dash_dcc):
app = Dash(__name__)
app.layout = html.Div(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def update_options(search_value):
dash_dcc.start_server(app)

# Get the inner input used for search value.
dropdown = dash_dcc.find_element("#my-dynamic-dropdown")
input_ = dropdown.find_element_by_css_selector("input")
input_ = dash_dcc.find_element("#my-dynamic-dropdown input")

# Focus on the input to open the options menu
input_.send_keys("x")
Expand All @@ -36,15 +35,15 @@ def update_options(search_value):
input_.clear()
input_.send_keys("o")

options = dropdown.find_elements_by_css_selector(".VirtualizedSelectOption")
options = dash_dcc.find_elements("#my-dynamic-dropdown .VirtualizedSelectOption")

# Should show all options.
assert len(options) == 3

# Searching for `on`
input_.send_keys("n")

options = dropdown.find_elements_by_css_selector(".VirtualizedSelectOption")
options = dash_dcc.find_elements("#my-dynamic-dropdown .VirtualizedSelectOption")

assert len(options) == 1
print(options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import pytest
import time
import json

import werkzeug

from dash import Dash, Input, Output, State, dcc, html
from dash.exceptions import PreventUpdate
from selenium.webdriver.common.by import By
Expand Down Expand Up @@ -128,7 +131,7 @@ def show_relayout_data(data):

# use this opportunity to test restyleData, since there are multiple
# traces on this graph
legendToggle = dash_dcc.driver.find_element_by_css_selector(
legendToggle = dash_dcc.find_element(
"#example-graph .traces:first-child .legendtoggle"
)
legendToggle.click()
Expand All @@ -142,7 +145,7 @@ def show_relayout_data(data):
)

# and test relayoutData while we're at it
autoscale = dash_dcc.driver.find_element_by_css_selector("#example-graph .ewdrag")
autoscale = dash_dcc.find_element("#example-graph .ewdrag")
autoscale.click()
autoscale.click()
dash_dcc.wait_for_text_to_equal("#relayout-data", '{"xaxis.autorange": true}')
Expand Down Expand Up @@ -185,6 +188,10 @@ def render_content(click, prev_graph):
assert dash_dcc.get_logs() == []


@pytest.mark.skipif(
werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with no_update 204 responses get Transfer-Encoding header.",
)
@pytest.mark.parametrize("is_eager", [True, False])
def test_grva004_graph_prepend_trace(dash_dcc, is_eager):
app = Dash(__name__, eager_loading=is_eager)
Expand Down Expand Up @@ -357,6 +364,10 @@ def display_data(trigger, fig):
assert dash_dcc.get_logs() == []


@pytest.mark.skipif(
werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with no_update 204 responses get Transfer-Encoding header.",
)
@pytest.mark.parametrize("is_eager", [True, False])
def test_grva005_graph_extend_trace(dash_dcc, is_eager):
app = Dash(__name__, eager_loading=is_eager)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def extras(t):
dcc.Link(
children="Absolute Path",
id="link1",
href=dash_dcc.server.url + "/extra/eseehc",
href="/extra/eseehc",
refresh=True,
),
dcc.Location(id="url", refresh=False),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def display_page(pathname):
dash_dcc.wait_for_text_to_equal("#page-content", "You are on page /test-link")

wait.until(
lambda: test_link.get_attribute("href") == "http://localhost:8050/test-link", 3
lambda: test_link.get_attribute("href")
== "http://localhost:{}/test-link".format(dash_dcc.server.port),
3,
)
wait.until(lambda: call_count.value == 2, 3)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def update_pathname(n_clicks, current_pathname):
# Check that link updates pathname
dash_dcc.find_element("#test-link").click()
until(
lambda: dash_dcc.driver.current_url.replace("http://localhost:8050", "")
lambda: dash_dcc.driver.current_url.replace(
"http://localhost:{}".format(dash_dcc.server.port), ""
)
== "/test/pathname",
3,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import pytest
import werkzeug

import dash.testing.wait as wait


@pytest.mark.xfail(
condition=werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with 204 and Transfer-Encoding",
strict=False,
)
def test_stdl001_data_lifecycle_with_different_condition(store_app, dash_dcc):
dash_dcc.start_server(store_app)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import werkzeug

from dash import Dash, Input, Output, dcc, html
from dash.exceptions import PreventUpdate
import json
Expand Down Expand Up @@ -119,6 +121,11 @@ def render_content(tab):
assert dash_dcc.get_logs() == []


@pytest.mark.xfail(
condition=werkzeug.__version__ in ("2.1.0", "2.1.1"),
reason="Bug with 204 and Transfer-Encoding",
strict=False,
)
@pytest.mark.parametrize("is_eager", [True, False])
def test_tabs_render_without_selected(dash_dcc, is_eager):
app = Dash(__name__, eager_loading=is_eager)
Expand Down
30 changes: 18 additions & 12 deletions components/dash-html-components/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ def test_click_simple(dash_duo):
]
)

@app.callback(Output("container", "children"), Input("button", "n_clicks"))
@app.callback(
Output("container", "children"),
Input("button", "n_clicks"),
# The new percy runner loads the page, so to get consistent behavior for
# call_count we need to skip the initial call
prevent_initial_call=True,
)
def update_output(n_clicks):
call_count.value += 1
return "clicked {} times".format(n_clicks)
Expand All @@ -25,14 +31,13 @@ def update_output(n_clicks):

dash_duo.find_element("#container")

dash_duo.wait_for_text_to_equal("#container", "clicked 0 times")
assert call_count.value == 1
assert call_count.value == 0
dash_duo.percy_snapshot("html button initialization")

dash_duo.find_element("#button").click()

dash_duo.wait_for_text_to_equal("#container", "clicked 1 times")
assert call_count.value == 2
assert call_count.value == 1
dash_duo.percy_snapshot("html button click")

assert not dash_duo.get_logs()
Expand All @@ -49,7 +54,7 @@ def test_click_prev(dash_duo):
app = Dash(__name__)
app.layout = html.Div(
[
html.Div(id="container"),
html.Div("Initial", id="container"),
html.Button("Click", id="button-1", n_clicks=0, n_clicks_timestamp=-1),
html.Button("Click", id="button-2", n_clicks=0, n_clicks_timestamp=-1),
]
Expand All @@ -63,6 +68,7 @@ def test_click_prev(dash_duo):
Input("button-2", "n_clicks"),
Input("button-2", "n_clicks_timestamp"),
],
prevent_initial_call=True,
)
def update_output(*args):
print(args)
Expand All @@ -73,25 +79,25 @@ def update_output(*args):

dash_duo.start_server(app)

dash_duo.wait_for_text_to_equal("#container", "0, 0")
assert timestamp_1.value == -1
assert timestamp_2.value == -1
assert call_count.value == 1
dash_duo.wait_for_text_to_equal("#container", "Initial")
assert timestamp_1.value == -5
assert timestamp_2.value == -5
assert call_count.value == 0
dash_duo.percy_snapshot("html button initialization 1")

dash_duo.find_element("#button-1").click()
dash_duo.wait_for_text_to_equal("#container", "1, 0")
assert timestamp_1.value > ((time.time() - (24 * 60 * 60)) * 1000)
assert timestamp_2.value == -1
assert call_count.value == 2
assert call_count.value == 1
dash_duo.percy_snapshot("html button-1 click")
prev_timestamp_1 = timestamp_1.value

dash_duo.find_element("#button-2").click()
dash_duo.wait_for_text_to_equal("#container", "1, 1")
assert timestamp_1.value == prev_timestamp_1
assert timestamp_2.value > ((time.time() - 24 * 60 * 60) * 1000)
assert call_count.value == 3
assert call_count.value == 2
dash_duo.percy_snapshot("html button-2 click")
prev_timestamp_2 = timestamp_2.value

Expand All @@ -100,7 +106,7 @@ def update_output(*args):
assert timestamp_1.value == prev_timestamp_1
assert timestamp_2.value > prev_timestamp_2
assert timestamp_2.value > timestamp_1.value
assert call_count.value == 4
assert call_count.value == 3
dash_duo.percy_snapshot("html button-2 click again")

assert not dash_duo.get_logs()
Loading