Skip to content

Conversation

@Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Dec 16, 2025

Description

Fixes #7925
This pull request improves the user interface for the Rocket Insights feature by providing clearer feedback when a user tries to test a page that is still in draft status. Now, when a page is a draft, the "Test the page" button is disabled and accompanied by a tooltip explaining why the action is unavailable.

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

What was tested

Screenshot 2025-12-16 at 01 40 42

How to test

Just load the page list with draft pages, put your mouse on the Test the page text, tooltip should appear.

Affected Features & Quality Assurance Scope

Page/post list with RI column.

Technical description

Documentation

Enhancements to draft page handling:

  • When a page is a draft, the "Test the page" button is wrapped in a tooltip container, the button is disabled, and a tooltip message ("This page is a draft and cannot be tested.") is shown to inform users why the action is unavailable. (views/settings/partials/rocket-insights/rocket-insights-column.php)
  • Logic for button classes and the disabled attribute is updated to be more consistent and readable, ensuring the UI accurately reflects the draft status. (views/settings/partials/rocket-insights/rocket-insights-column.php)

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

- Wrap disabled button with tooltip when post is a draft
- Display message: 'This page is a draft and cannot be tested.'
- Use existing .wpr-btn-with-tool-tip pattern
- Avoid if-else by conditionally wrapping button

Fixes #7925
- Add assertions for tooltip markup and message
- Verify wpr-btn-with-tool-tip and wpr-tooltip classes
- Check for draft tooltip message in output

Related to #7925
@Miraeld Miraeld requested a review from a team December 16, 2025 00:45
@Miraeld Miraeld self-assigned this Dec 16, 2025
Copilot AI review requested due to automatic review settings December 16, 2025 00:45
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 enhances the user experience for the Rocket Insights feature by providing clearer feedback when users attempt to test draft pages. When a page has draft status, the "Test the page" button is now disabled and displays a tooltip explaining why testing is unavailable.

Key Changes:

  • Added tooltip wrapper and message for disabled "Test the page" button on draft posts
  • Refactored conditional logic for button classes and disabled attribute to be more readable
  • Updated test fixtures to verify new tooltip elements are rendered

Reviewed changes

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

File Description
views/settings/partials/rocket-insights/rocket-insights-column.php Added tooltip container wrapping disabled button for draft pages with explanatory message; simplified conditional logic for button state
tests/Fixtures/inc/Engine/Admin/RocketInsights/Render/GetRocketInsightsColumn.php Added test assertions for new tooltip CSS classes and message text

@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 9e90f2b1 (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (9e90f2b) Report Missing Report Missing Report Missing
Head commit (8738e27) 41879 18886 45.10%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7959) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Copy link
Contributor

@jeawhanlee jeawhanlee left a comment

Choose a reason for hiding this comment

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

LGTM from code perspective.
@piotrbak will need to assert that the text and tooltip placement is correct.

@piotrbak
Copy link
Contributor

@jeawhanlee The placement is correct.

I'll ask @valentinaor for confirmation about the wording, as it looks good from my side. @valentinaor what do you think?

When a page is a draft, the "Test the page" button is wrapped in a tooltip container, the button is disabled, and a tooltip message ("This page is a draft and cannot be tested.") is shown to inform users why the action is unavailable. 

@valentinaor
Copy link

@piotrbak The copy looks good to me too

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.

Display a tooltip when 'Test the page' is inactive

5 participants