Skip to content

[docs] add exact matching and element count guidance to E2E docs#14102

Merged
sfc-gh-lwilby merged 1 commit intodevelopfrom
docs/e2e-playwright-testing-best-practices
Mar 4, 2026
Merged

[docs] add exact matching and element count guidance to E2E docs#14102
sfc-gh-lwilby merged 1 commit intodevelopfrom
docs/e2e-playwright-testing-best-practices

Conversation

@sfc-gh-lwilby
Copy link
Copy Markdown
Collaborator

Describe your changes

Adds two best practices to the E2E Playwright testing docs (AGENTS.md and mirrors):

  • Use exact=True with get_by_text() and filter(has_text=...) to prevent substring matching from causing strict mode violations when the target text is a prefix of other text on the page.
  • Check and update existing element count assertions (e.g., to_have_count(N)) when adding new elements to an existing app script.

Both patterns caused recurring CI failures across the dynamic containers callback PRs.

Testing Plan

  • Explanation of why no additional tests are needed: Documentation-only changes, no behavior modifications.

Contribution License Agreement

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

@sfc-gh-lwilby sfc-gh-lwilby added impact:internal PR changes only affect internal code change:docs PR contains documentation change labels Feb 24, 2026
@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Feb 24, 2026

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
Copy Markdown
Contributor

github-actions bot commented Feb 24, 2026

✅ PR preview is ready!

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

@sfc-gh-lwilby sfc-gh-lwilby marked this pull request as ready for review February 24, 2026 08:59
Copilot AI review requested due to automatic review settings February 24, 2026 08:59
Copy link
Copy Markdown
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

Updates Streamlit’s E2E Playwright contributor guidance to reduce CI flakiness from ambiguous locators and from stale element-count assertions, and mirrors the same advice across the repo’s documentation/instructions surfaces.

Changes:

  • Add guidance to use exact matching to avoid substring-based strict mode violations with get_by_text.
  • Add guidance to re-check existing to_have_count(N) assertions when app scripts gain new elements.
  • Mirror the same best-practice bullets across the AGENTS doc, GitHub instructions, and Cursor rules.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
e2e_playwright/AGENTS.md Adds two E2E best-practice bullets (exact matching; update count assertions).
.github/instructions/e2e_playwright.instructions.md Mirrors the same new E2E guidance for GitHub instructions.
.cursor/rules/e2e_playwright.mdc Mirrors the same new E2E guidance for Cursor editor rules.

Copy link
Copy Markdown
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-lwilby sfc-gh-lwilby merged commit 42bb1ab into develop Mar 4, 2026
81 of 84 checks passed
@sfc-gh-lwilby sfc-gh-lwilby deleted the docs/e2e-playwright-testing-best-practices branch March 4, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:docs PR contains documentation change impact:internal PR changes only affect internal code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants