[feat] Add AppTarget class for test abstraction#13737
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d7fbba4 to
ee161af
Compare
2099055 to
e0ba6f5
Compare
ed0152b to
52e9c40
Compare
There was a problem hiding this comment.
Pull request overview
Purpose: This PR introduces a new AppTarget class to provide a unified abstraction for interacting with Streamlit apps during Playwright E2E tests, regardless of whether they're running in local mode or external/iframe-hosted mode.
Changes:
- Added
AppTargetclass and helper functions ine2e_playwright/shared/app_target.pyto abstract app interaction across different hosting modes - Enhanced
e2e_playwright/conftest.pywith newapp_targetfixture andbuild_app_urlutility function for flexible URL construction - Updated
e2e_playwright/shared/app_utils.pyto introduceLocatorContextProtocol for type-safe polymorphic locator contexts - Updated documentation in AGENTS.md, e2e_playwright.instructions.md, and e2e_playwright.mdc to reflect the new fixtures and external test mode
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| e2e_playwright/shared/app_target.py | Introduces AppTarget class for unified app interaction and moves StaticPage class here |
| e2e_playwright/shared/app_utils.py | Adds LocatorContext Protocol and updates function signatures to support the new abstraction |
| e2e_playwright/conftest.py | Adds app_target fixture, build_app_url helper, refactors URL handling for external modes |
| e2e_playwright/AGENTS.md | Documents new app_target fixture and external test mode configuration |
| .github/instructions/e2e_playwright.instructions.md | Same documentation updates for GitHub instructions |
| .cursor/rules/e2e_playwright.mdc | Same documentation updates for Cursor rules |
e0ba6f5 to
5b7e6e1
Compare
52e9c40 to
2fa0058
Compare
📈 Frontend coverage change detectedThe frontend unit test (vitest) coverage has increased by 0.0200%
✅ Coverage change is within normal range. |
8bdee90 to
eaa3de0
Compare
5b7e6e1 to
d6871d4
Compare
eaa3de0 to
83ca0ac
Compare
SummaryThis PR introduces the Code QualityOverall structure is clean and the new abstraction is well-contained. One potential pitfall:
Test CoverageNo new tests were added. Given these are E2E infrastructure changes, this is acceptable, but note that Backwards CompatibilityNo user-facing API changes; this is internal test infrastructure. Existing tests should continue to work, though Security & RiskLow risk. Changes are confined to test tooling; no production code paths modified. Recommendations
VerdictAPPROVED: Solid abstraction and fixture updates with no blocking issues; a couple of minor hardening opportunities noted above. This is an automated AI review using |
d6871d4 to
bf9998a
Compare
83ca0ac to
9bdbbc0
Compare
bf9998a to
8a999a0
Compare
9bdbbc0 to
5383b0c
Compare
Merge activity
|
5383b0c to
1392ea3
Compare

Describe your changes
Introduce an
AppTargetabstraction so Playwright E2E tests can interact with the Streamlit app consistently whether it’s loaded at the top-level (local / external-direct) or embedded in an iframe (external-host mode).AppTarget(andapp_targetfixture) to centralize "where does the app DOM live?" (page vs iframe) so tests/helpers don’t need to branch on external hosting mode.app_base_url+build_app_url(...)and standardize navigation/URL building to work for both localhost and externally hosted apps (including hash-fragmentapp_hashrouting).LocatorContextProtocol) so utilities can accept page/frame contexts (andAppTarget) without leaking iframe details into tests..cursor/rules,AGENTS.md, GitHub instructions).Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.