-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Migrate disconnect and disabled from cypress to playwright #8732
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1d7fa85
Attempt at migrating disconnect to playwright
willhuang1997 17dad4a
Just change the test to remove disconnect because it doesn't seem useful
willhuang1997 aa030a8
Remove this test because this is useless too
willhuang1997 a2a2fd0
Merge branch 'develop' into playwright/disconnect
willhuang1997 345eb4c
Migrate tests that use new e2e config
willhuang1997 69340f9
Remove duplicate tests
willhuang1997 709afba
File name changes
willhuang1997 34de8e8
Remove snapshots
willhuang1997 10eb80f
Fix test
willhuang1997 a963d9b
Add comment
willhuang1997 e4f7082
Merge branch 'develop' into playwright/disconnect
willhuang1997 ef5b8b4
Merge branch 'develop' into playwright/disconnect
willhuang1997 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
# 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. | ||
|
||
import pytest | ||
from playwright.sync_api import Page, expect | ||
|
||
|
||
def test_disconnecting_disables_widgets_correctly(app: Page): | ||
expect(app.get_by_test_id("stButton").locator("button")).not_to_have_attribute( | ||
"disabled", "" | ||
) | ||
expect(app.get_by_test_id("stMarkdown").first).to_contain_text("Value 1: 25") | ||
|
||
expect(app.get_by_test_id("stConnectionStatus")).not_to_be_visible() | ||
app.evaluate("window.streamlitDebug.shutdownRuntime()") | ||
expect(app.get_by_test_id("stConnectionStatus")).to_contain_text("Connecting") | ||
|
||
expect(app.get_by_test_id("stButton").locator("button")).to_have_attribute( | ||
"disabled", "" | ||
) | ||
expect(app.get_by_test_id("stCheckbox").locator("input")).to_have_attribute( | ||
"disabled", "" | ||
) | ||
expect(app.get_by_test_id("stDateInput").locator("input")).to_have_attribute( | ||
"disabled", "" | ||
) | ||
expect(app.get_by_test_id("stRadio").locator("input").first).to_have_attribute( | ||
"disabled", "" | ||
) | ||
expect(app.get_by_test_id("stSelectbox").locator("input")).to_have_attribute( | ||
"disabled", "" | ||
) | ||
expect(app.get_by_test_id("stTextArea").locator("textarea")).to_have_attribute( | ||
"disabled", "" | ||
) | ||
expect(app.get_by_test_id("stTextInput").locator("input")).to_have_attribute( | ||
"disabled", "" | ||
) | ||
expect(app.get_by_test_id("stTimeInput").locator("input")).to_have_attribute( | ||
"disabled", "" | ||
) | ||
|
||
app.get_by_test_id("stSlider").nth(0).hover() | ||
# click in middle | ||
app.mouse.down() | ||
|
||
expect(app.get_by_test_id("stMarkdown").first).to_contain_text("Value 1: 25") |
Binary file removed
BIN
-1.46 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-0.snap.png
Binary file not shown.
Binary file removed
BIN
-2.44 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-1.snap.png
Binary file not shown.
Binary file removed
BIN
-1.57 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-2.snap.png
Binary file not shown.
Binary file removed
BIN
-5.36 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-3.snap.png
Binary file not shown.
Binary file removed
BIN
-1.54 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-4.snap.png
Binary file not shown.
Binary file removed
BIN
-3.31 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-5.snap.png
Binary file not shown.
Binary file removed
BIN
-3.08 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-6.snap.png
Binary file not shown.
Binary file removed
BIN
-2.16 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-7.snap.png
Binary file not shown.
Binary file removed
BIN
-3.11 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-8.snap.png
Binary file not shown.
Binary file removed
BIN
-4.34 KB
...tend/cypress/snapshots/linux/2x/st_disabled.spec.js/disabled-widgets-9.snap.png
Binary file not shown.
Binary file removed
BIN
-1.75 KB
...end/cypress/snapshots/linux/2x/st_disconnect.spec.js/disconnected-dark.snap.png
Binary file not shown.
Binary file removed
BIN
-1.69 KB
frontend/cypress/snapshots/linux/2x/st_disconnect.spec.js/disconnected.snap.png
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe add a comment here that calling this will disconnect the WebSocket connection -> which should put all elements into
disabled
mode.