Skip to content

E2E[Title Generation|Editorial Notes]: Prefer user-facing attributes#773

Open
yogeshbhutkar wants to merge 3 commits into
WordPress:developfrom
yogeshbhutkar:fix-e2e/prefer-user-facing-attributes
Open

E2E[Title Generation|Editorial Notes]: Prefer user-facing attributes#773
yogeshbhutkar wants to merge 3 commits into
WordPress:developfrom
yogeshbhutkar:fix-e2e/prefer-user-facing-attributes

Conversation

@yogeshbhutkar

@yogeshbhutkar yogeshbhutkar commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What, Why, and How?

Follow-up to #762
Part of #778

Playwright recommends using user-facing locators (example, getByRole) instead of CSS classes or DOM-structure selectors wherever possible. This is because CSS classes and markup structure are implementation details that can change during design or refactoring without changing the actual user experience, which can make tests fail even though the feature still works (Docs).

This PR updates the Title Generation and Editorial Notes E2E spec to follow the Playwright best practices by replacing hard-coded page.locator(...) calls with role-based locators wherever possible. This should make the test less brittle because it now targets the UI the way a user, or assistive technology, understands it rather than depending on implementation details.

Use of AI Tools

AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5.5
Used for: Code review

Testing Instructions

CI Should be green.

Changelog Entry

Developer - Updated Title Generation and Editorial Notes E2E selectors to use Playwright user-facing attributes.

Open WordPress Playground Preview

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.50%. Comparing base (56cef56) to head (b28205b).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #773   +/-   ##
==========================================
  Coverage      76.50%   76.50%           
  Complexity      1868     1868           
==========================================
  Files             89       89           
  Lines           7985     7985           
==========================================
  Hits            6109     6109           
  Misses          1876     1876           
Flag Coverage Δ
unit 76.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yogeshbhutkar yogeshbhutkar force-pushed the fix-e2e/prefer-user-facing-attributes branch from ab31f3b to 22ac446 Compare June 26, 2026 04:05
- Added `useInstanceId` to generate a unique ID for the description element.
- Updated the button to use `aria-describedby` for improved accessibility.
- Modified tests to check for accessible descriptions instead of relying on class selectors for visibility checks.
@yogeshbhutkar yogeshbhutkar changed the title E2E[WIP]: Prefer user-facing attributes E2E[Title Generation | Editorial Notes]: Prefer user-facing attributes Jun 26, 2026
@yogeshbhutkar yogeshbhutkar changed the title E2E[Title Generation | Editorial Notes]: Prefer user-facing attributes E2E[Title Generation|Editorial Notes]: Prefer user-facing attributes Jun 26, 2026
@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review June 26, 2026 07:23
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: yogeshbhutkar <yogeshbhutkar@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant