Skip to content

Commit

Permalink
Merge branch 'main' into dev/update-icons-script
Browse files Browse the repository at this point in the history
  • Loading branch information
huong-li-nguyen committed Jan 29, 2025
2 parents 9161d3d + b6add57 commit bdb5cd5
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 14 deletions.
5 changes: 4 additions & 1 deletion vizro-ai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ filterwarnings = [
# Ignore deprecation warning until this is solved: https://github.com/plotly/dash/issues/2590:
"ignore:HTTPResponse.getheader():DeprecationWarning",
# Happens during dash_duo teardown in vizro_ai_ui tests. Not affecting functionality:
"ignore:Exception in thread"
"ignore:Exception in thread",
# Ignore deprecation warning as it comes from the plotly default template. In our templates `vizro_dark` and
# `vizro_light`, we do not use mapbox anymore, see: https://github.com/mckinsey/vizro/pull/974
"ignore:.*scattermapbox.*is deprecated.*Use.*scattermap.*instead:DeprecationWarning"
]
pythonpath = ["../tools/tests"]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!--
A new scriv changelog fragment.
Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Highlights ✨
- A bullet item for the Highlights ✨ category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Removed
- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Added
- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Changed
- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Deprecated
- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Fixed
- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
<!--
### Security
- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX. ([#1](https://github.com/mckinsey/vizro/pull/1))
-->
5 changes: 4 additions & 1 deletion vizro-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ filterwarnings = [
# Ignore warning for Pydantic v1 API and Python 3.13:
"ignore:Failing to pass a value to the 'type_params' parameter of 'typing.ForwardRef._evaluate' is deprecated:DeprecationWarning",
# Ignore deprecation warning until this is solved: https://github.com/plotly/dash/issues/2590:
"ignore:HTTPResponse.getheader():DeprecationWarning"
"ignore:HTTPResponse.getheader():DeprecationWarning",
# Ignore deprecation warning as it comes from the plotly default template. In our templates `vizro_dark` and
# `vizro_light`, we do not use mapbox anymore, see: https://github.com/mckinsey/vizro/pull/974
"ignore:.*scattermapbox.*is deprecated.*Use.*scattermap.*instead:DeprecationWarning"
]
norecursedirs = ["tests/tests_utils", "tests/js"]
pythonpath = ["tests/tests_utils"]
Expand Down
1 change: 0 additions & 1 deletion vizro-core/src/vizro/_themes/generate_plotly_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def generate_json_template(extracted_values: dict[str, str]) -> go.layout.Templa
ternary_baxis_linecolor=AXIS_COLOR,
ternary_caxis_gridcolor=GRID_COLOR,
ternary_caxis_linecolor=AXIS_COLOR,
mapbox_style="carto-darkmatter",
coloraxis_colorbar_tickcolor=AXIS_COLOR,
coloraxis_colorbar_tickfont_color=FONT_COLOR_SECONDARY,
coloraxis_colorbar_title_font_color=FONT_COLOR_SECONDARY,
Expand Down
3 changes: 0 additions & 3 deletions vizro-core/src/vizro/_themes/vizro_dark.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@
"gridcolor": "rgba(255, 255, 255, 0.1019607843)",
"linecolor": "rgba(255, 255, 255, 0.3019607843)"
}
},
"mapbox": {
"style": "carto-darkmatter"
}
},
"data": {
Expand Down
3 changes: 0 additions & 3 deletions vizro-core/src/vizro/_themes/vizro_light.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@
"gridcolor": "rgba(20, 23, 33, 0.1019607843)",
"linecolor": "rgba(20, 23, 33, 0.3019607843)"
}
},
"mapbox": {
"style": "carto-darkmatter"
}
},
"data": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 15 additions & 2 deletions vizro-core/tests/e2e/test_component_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
value_column="Actual",
title="KPI with aggregation",
agg_func="median",
icon="folder_check_2",
),
kpi_card(
data_frame=df_kpi,
Expand Down Expand Up @@ -82,8 +83,20 @@ def test_kpi_card_component_library(dash_duo, request):
]
)
dash_duo.start_server(app)
dash_duo.wait_for_page(timeout=20)
dash_duo.wait_for_element("div[class='card-kpi card']")
dash_duo.wait_for_text_to_equal(
"div[class='vstack gap-4'] div:nth-of-type(1) div:nth-of-type(2) p[class='material-symbols-outlined']",
"folder_check_2",
)
dash_duo.wait_for_text_to_equal(
"div[class='vstack gap-4'] div:nth-of-type(1) div:nth-of-type(2) div[class='card-body']", "200.0"
)
dash_duo.wait_for_text_to_equal(
"div[class='vstack gap-4'] div:nth-of-type(2) div:nth-of-type(4) p[class='material-symbols-outlined']",
"shopping_cart",
)
dash_duo.wait_for_text_to_equal(
"div[class='vstack gap-4'] div:nth-of-type(2) div:nth-of-type(4) div[class='card-body']", "1000"
)
result_image_path, expected_image_path = make_screenshot_and_paths(dash_duo.driver, request.node.name)
assert_image_equal(result_image_path, expected_image_path)
assert dash_duo.get_logs() == [], "browser console should contain no error"
6 changes: 3 additions & 3 deletions vizro-core/tests/tests_utils/e2e_asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def _create_image_difference(expected_image, result_image):
# Calculate bounding rectangles around detected contour
(x, y, width, height) = cv2.boundingRect(contour)
# Draw red rectangle around difference area
cv2.rectangle(result_image, (x, y), (x + width, y + height), (0, 0, 255), 2)
return result_image
cv2.rectangle(expected_image, (x, y), (x + width, y + height), (0, 0, 255), 2)
return expected_image


def make_screenshot_and_paths(browserdriver, request_node_name):
Expand All @@ -54,7 +54,7 @@ def assert_image_equal(result_image_path, expected_image_path):
expected_image_name = Path(expected_image_path).name
result_image = cv2.imread(result_image_path)
try:
_compare_images(expected_image, result_image)
_compare_images(expected_image=expected_image, result_image=result_image)
# Deleting created branch image to leave only failed for github artifacts
Path(result_image_path).unlink()
except AssertionError as exc:
Expand Down

0 comments on commit bdb5cd5

Please sign in to comment.