Skip to content

Refactor snackbar locators#860

Merged
dkotter merged 2 commits into
WordPress:developfrom
Infinite-Null:refactor/snackbar-e2e-locators
Jul 13, 2026
Merged

Refactor snackbar locators#860
dkotter merged 2 commits into
WordPress:developfrom
Infinite-Null:refactor/snackbar-e2e-locators

Conversation

@Infinite-Null

@Infinite-Null Infinite-Null commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What?

Part of: #778

This PR standardizes the way we locate snackbar components in our E2E tests by migrating from CSS class selectors to the component's built-in data-test-id.

Why?

The Gutenberg snackbar component already provides data-test-id="snackbar", but we weren't utilizing it consistently. Previously, we were querying .components-snackbar__content. Moving to getByTestId aligns with our testing best practices.
Screenshot 2026-07-13 at 3 44 29 PM

How?

  • Replaced instances of page.locator( '.components-snackbar__content' ) with page.getByTestId( 'snackbar' ).
  • Updated assertions in settings.spec.js to correctly filter and verify the snackbar visibility using the new test ID.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Sonnet 4.6
Used for: Code review, PR description

Testing Instructions

Verify that CI passes, or run the updated E2E test locally:

npm run test:e2e tests/e2e/specs/admin/settings.spec.js

Changelog Entry

Developer - Standardize E2E snackbar locators to use data-test-id.

Open WordPress Playground Preview

@Infinite-Null
Infinite-Null requested a review from a team July 13, 2026 10:42
@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: Infinite-Null <ankitkumarshah@git.wordpress.org>

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

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.04%. Comparing base (f006132) to head (1ba23c3).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #860   +/-   ##
==========================================
  Coverage      77.04%   77.04%           
  Complexity      2231     2231           
==========================================
  Files            103      103           
  Lines           9214     9214           
==========================================
  Hits            7099     7099           
  Misses          2115     2115           
Flag Coverage Δ
unit 77.04% <ø> (ø)

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.

@dkotter dkotter added this to the 1.2.0 milestone Jul 13, 2026
@dkotter
dkotter merged commit 70a535a into WordPress:develop Jul 13, 2026
26 checks passed
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.

3 participants