Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Graphviz layout engines (#7505)
* Support Graphviz layout engines * Ensure radio option and engine match in test * Update unit test * Update snapshots * Update comment in proto to remove 'Dot language' * Update offending snapshot * Delete all chromium snapshots and regenerate * Add missing chromium snapshots * Reintroduce 'Dot language' comment in proto * Call engine in jest.mock * Use default renderer when provided only spec as string * Test if chart renders when input is a dot string * Delete obsolete e2e test * Upload last remaining snapshots
- Loading branch information
1 parent
9a7fb43
commit 31c1492
Showing
32 changed files
with
106 additions
and
48 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+12.6 KB
...shots__/linux/st_graphviz_chart_test/st_graphviz_chart_dot_string[chromium].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.55 KB
...pshots__/linux/st_graphviz_chart_test/st_graphviz_chart_dot_string[firefox].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.9 KB
...apshots__/linux/st_graphviz_chart_test/st_graphviz_chart_dot_string[webkit].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33.5 KB
...ots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-circo[chromium].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+33.1 KB
...hots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-circo[firefox].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.8 KB
...shots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-circo[webkit].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.9 KB
...shots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-dot[chromium].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.6 KB
...pshots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-dot[firefox].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+40.9 KB
...apshots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-dot[webkit].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+47.2 KB
...shots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-fdp[chromium].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34.5 KB
...pshots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-fdp[firefox].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.4 KB
...apshots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-fdp[webkit].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.2 KB
...ots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-neato[chromium].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.5 KB
...hots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-neato[firefox].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.8 KB
...shots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-neato[webkit].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.8 KB
...ots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-osage[chromium].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+32.2 KB
...hots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-osage[firefox].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.1 KB
...shots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-osage[webkit].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.25 KB
..._/linux/st_graphviz_chart_test/st_graphviz_chart_engine-patchwork[chromium].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.02 KB
...__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-patchwork[firefox].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.03 KB
...s__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-patchwork[webkit].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+50 KB
...ots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-twopi[chromium].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.5 KB
...hots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-twopi[firefox].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.6 KB
...shots__/linux/st_graphviz_chart_test/st_graphviz_chart_engine-twopi[webkit].png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from playwright.sync_api import Page, expect | ||
|
||
from e2e_playwright.conftest import ImageCompareFunction, wait_for_app_run | ||
|
||
|
||
def test_initial_setup(app: Page): | ||
"""Initial setup: ensure charts are loaded.""" | ||
|
||
wait_for_app_run(app) | ||
title_count = len(app.locator(".stGraphVizChart > svg > g > title").all()) | ||
assert title_count == 6 | ||
|
||
|
||
def test_shows_left_and_right_graph(app: Page): | ||
"""Test if it shows left and right graph.""" | ||
|
||
left_text = app.locator(".stGraphVizChart > svg > g > title").nth(3).text_content() | ||
right_text = app.locator(".stGraphVizChart > svg > g > title").nth(4).text_content() | ||
assert "Left" in left_text and "Right" in right_text | ||
|
||
|
||
def test_renders_with_specified_engines( | ||
app: Page, assert_snapshot: ImageCompareFunction | ||
): | ||
"""Test if it renders with specified engines.""" | ||
|
||
engines = ["dot", "neato", "twopi", "circo", "fdp", "osage", "patchwork"] | ||
|
||
radios = app.query_selector_all('label[data-baseweb="radio"]') | ||
|
||
for idx, engine in enumerate(engines): | ||
radios[idx].click(force=True) | ||
wait_for_app_run(app) | ||
expect(app.get_by_test_id("stMarkdown").nth(0)).to_have_text(engine) | ||
|
||
assert_snapshot( | ||
app.locator(".stGraphVizChart > svg").nth(2), | ||
name=f"st_graphviz_chart_engine-{engine}", | ||
) | ||
|
||
|
||
def test_dot_string(app: Page, assert_snapshot: ImageCompareFunction): | ||
"""Test if it renders charts when input is a string (dot language).""" | ||
|
||
title = app.locator(".stGraphVizChart > svg > g > title").nth(5) | ||
expect(title).to_have_text("Dot") | ||
|
||
assert_snapshot( | ||
app.locator(".stGraphVizChart > svg").nth(5), | ||
name="st_graphviz_chart_dot_string", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters