Skip to content

Conversation

@sfc-gh-nbellante
Copy link
Contributor

@sfc-gh-nbellante sfc-gh-nbellante commented Nov 19, 2025

Describe your changes

Refactored the st_chat_input.py test app to use query parameters for displaying specific chat inputs. This improves test isolation by allowing tests to focus on a single chat input at a time, rather than rendering all inputs simultaneously. The changes include:

  • Added a query parameter system to selectively display chat inputs
  • Renamed chat inputs with more descriptive keys (e.g., "audio_with_files" instead of "chat_input_11")
  • Updated output formatting to use consistent patterns (e.g., "key - value:" instead of "key value:")
  • Added a use_chat_input decorator and goto_chat_input helper function to simplify test navigation
  • Updated all tests to use the new navigation system

Screenshot or video (only for visual changes)

No visual changes to the component itself, only test infrastructure improvements.

Testing Plan

  • E2E Tests: All existing tests have been updated to use the new navigation system and continue to pass
  • The refactored approach improves test isolation and makes it easier to add new tests in the future
  • No manual testing needed as this is a test infrastructure improvement only

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Contributor

snyk-io bot commented Nov 19, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-13055/streamlit-1.51.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-13055.streamlit.app (☁️ Deploy here if not accessible)

v3 = st.container().chat_input(
"Chat input 3 (callback)", key="chat_input_3", on_submit=on_submit
if key is None or key == "width_300":
width_300_value = st.container().chat_input(
st.session_state["chat_input_3"],

if key is None or key == "width_stretch":
width_stretch_value = st.container().chat_input(
@sfc-gh-nbellante sfc-gh-nbellante force-pushed the 11-19-modularizing_chat_input_tests branch from 1226891 to 9be2bb9 Compare November 20, 2025 16:31
@sfc-gh-nbellante sfc-gh-nbellante added security-assessment-completed Security assessment has been completed for PR impact:internal PR changes only affect internal code change:refactor PR contains code refactoring without behavior change labels Nov 20, 2025
@sfc-gh-nbellante sfc-gh-nbellante changed the title modularizing chat input tests [refactor] Improve chat input test organization with query parameter navigation Nov 20, 2025
@sfc-gh-nbellante sfc-gh-nbellante force-pushed the 11-19-modularizing_chat_input_tests branch from 9be2bb9 to ee934a3 Compare November 20, 2025 17:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the st_chat_input E2E test infrastructure to use query parameters for selective rendering of chat inputs, improving test isolation and organization. The changes replace rendering all chat inputs simultaneously with a query parameter-based approach that displays only one chat input at a time.

Key Changes

  • Added query parameter system (?key=<chat_input_key>) for selective chat input display
  • Renamed chat input keys from generic names (e.g., chat_input_11) to descriptive names (e.g., audio_with_files)
  • Updated output formatting pattern from key value: to key - value:
  • Introduced use_chat_input() decorator and goto_chat_input() helper for streamlined test navigation
  • Updated all 40+ test functions to use the new navigation pattern

Reviewed Changes

Copilot reviewed 2 out of 150 changed files in this pull request and generated no comments.

File Description
e2e_playwright/st_chat_input.py Refactored test app to conditionally render chat inputs based on query parameter; renamed keys to be descriptive; updated output formatting
e2e_playwright/st_chat_input_test.py Added navigation utilities (use_chat_input decorator, goto_chat_input helper); updated helper functions to use new output format; applied decorator to all test functions
e2e_playwright/__snapshots__/**/*.png Updated snapshot files reflecting the new test isolation approach (all new files)

Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@sfc-gh-nbellante sfc-gh-nbellante force-pushed the 11-19-modularizing_chat_input_tests branch from b81a1f2 to c734cbd Compare November 20, 2025 22:28
@sfc-gh-nbellante sfc-gh-nbellante added the flaky-verify If applied to PR will run flaky test verification workflow label Nov 20, 2025
@sfc-gh-nbellante sfc-gh-nbellante merged commit fda51a0 into develop Nov 21, 2025
93 of 94 checks passed
@sfc-gh-nbellante sfc-gh-nbellante deleted the 11-19-modularizing_chat_input_tests branch November 21, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:refactor PR contains code refactoring without behavior change flaky-verify If applied to PR will run flaky test verification workflow impact:internal PR changes only affect internal code security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants