forked from streamlit/streamlit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate st tabs to playwright (streamlit#8920)
- Loading branch information
1 parent
8c31db8
commit 6a497cd
Showing
22 changed files
with
40 additions
and
70 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+3.16 KB
...aywright/__snapshots__/linux/st_tabs_test/st_tabs-many[dark_theme-chromium].png
Loading
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
+5.01 KB
...laywright/__snapshots__/linux/st_tabs_test/st_tabs-many[dark_theme-firefox].png
Loading
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.24 KB
...playwright/__snapshots__/linux/st_tabs_test/st_tabs-many[dark_theme-webkit].png
Loading
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.06 KB
...ywright/__snapshots__/linux/st_tabs_test/st_tabs-many[light_theme-chromium].png
Loading
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
+4.61 KB
...aywright/__snapshots__/linux/st_tabs_test/st_tabs-many[light_theme-firefox].png
Loading
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.18 KB
...laywright/__snapshots__/linux/st_tabs_test/st_tabs-many[light_theme-webkit].png
Loading
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.35 KB
...right/__snapshots__/linux/st_tabs_test/st_tabs-sidebar[dark_theme-chromium].png
Loading
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.62 KB
...wright/__snapshots__/linux/st_tabs_test/st_tabs-sidebar[dark_theme-firefox].png
Loading
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.39 KB
...ywright/__snapshots__/linux/st_tabs_test/st_tabs-sidebar[dark_theme-webkit].png
Loading
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.33 KB
...ight/__snapshots__/linux/st_tabs_test/st_tabs-sidebar[light_theme-chromium].png
Loading
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.71 KB
...right/__snapshots__/linux/st_tabs_test/st_tabs-sidebar[light_theme-firefox].png
Loading
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.38 KB
...wright/__snapshots__/linux/st_tabs_test/st_tabs-sidebar[light_theme-webkit].png
Loading
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.64 KB
...ht/__snapshots__/linux/st_tabs_test/st_tabs-text_input[dark_theme-chromium].png
Loading
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
+6.15 KB
...ght/__snapshots__/linux/st_tabs_test/st_tabs-text_input[dark_theme-firefox].png
Loading
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.68 KB
...ight/__snapshots__/linux/st_tabs_test/st_tabs-text_input[dark_theme-webkit].png
Loading
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.52 KB
...t/__snapshots__/linux/st_tabs_test/st_tabs-text_input[light_theme-chromium].png
Loading
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
+6.05 KB
...ht/__snapshots__/linux/st_tabs_test/st_tabs-text_input[light_theme-firefox].png
Loading
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.57 KB
...ght/__snapshots__/linux/st_tabs_test/st_tabs-text_input[light_theme-webkit].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
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,39 @@ | ||
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024) | ||
# | ||
# 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 | ||
from e2e_playwright.shared.app_utils import get_expander | ||
|
||
|
||
def test_tabs_render_correctly(themed_app: Page, assert_snapshot: ImageCompareFunction): | ||
st_tabs = themed_app.get_by_test_id("stTabs") | ||
expect(st_tabs).to_have_count(3) | ||
|
||
assert_snapshot(st_tabs.nth(0), name="st_tabs-sidebar") | ||
assert_snapshot(st_tabs.nth(1), name="st_tabs-text_input") | ||
assert_snapshot(st_tabs.nth(2), name="st_tabs-many") | ||
|
||
|
||
def test_displays_correctly_in_sidebar(app: Page): | ||
expect(app.get_by_test_id("stSidebar").get_by_test_id("stTab")).to_have_count(2) | ||
expect(app.get_by_text("I am in the sidebar")).to_have_count(1) | ||
expect(app.get_by_text("I am in the sidebarI'm also in the sidebar")).to_have_count( | ||
1 | ||
) | ||
|
||
|
||
def test_contains_all_tabs_when_overflowing(app: Page): | ||
expect(get_expander(app, "Expander").get_by_test_id("stTab")).to_have_count(25) |
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