Skip to content

Test brand loading and the gauge colors - #801

Merged
ilicfilip merged 2 commits into
developfrom
filip/branding-gauge-tests
Nov 9, 2026
Merged

ilicfilip merged 2 commits into
developfrom
filip/branding-gauge-tests

Conversation

@ilicfilip

Copy link
Copy Markdown
Collaborator

Adds tests for two branding areas that had none (from the 2026-11-09 branding check). Tests only; no plugin code changes.

PHPUnit: tests/phpunit/test-class-branding.php

The branding server is mocked with pre_http_request (no request reaches branding.your.online). Branded cases use the pp_branding_id preview param as an administrator.

  • Unbranded site: plugin defaults (menu name, Ravi, no CSS, submenu position) and no request at all.
  • Branded site: menu and submenu names, assistant name, widget titles and widget list, links, SEO recommendation, logo and CSS all come from the brand document. All from one cached request.
  • Brand CSS is attached once per style handle (enqueue_inline_css is idempotent).
  • Unusable document: server down, HTTP 404, invalid JSON and an unknown format all fall back to the defaults, with no inline CSS.

Playwright: tests/e2e/specs/gauges.spec.ts

Renders prpl-gauge and prpl-badge-progress-bar on the dashboard with test colors and checks the computed gradients:

  • no --prpl-color-gradient-start → solid fill;
  • with it → from that color to the gauge color, reaching the gauge color exactly where the fill ends (half fill, full fill);
  • the gradient-start attribute (used by the score gauge) wins over the brand's variable;
  • the missed-badge bar follows the same rule.

Checked

  • Gauge spec: passes against a local site (5/5). It fails 5/5 on the gauge code from before Fade badge gauges from a brand's gradient-start color #799, so it catches a regression there. I ran it with Playwright 1.57, because this repo's pinned browser build isn't installed locally. CI runs it with the repo's version, in the parallel project.
  • PHPUnit: not run locally (no test database here); this PR's CI runs it on all 7 PHP/WP combinations. phpcs, phpstan and lint passed (pre-commit).

🤖 Generated with Claude Code

PHPUnit (tests/phpunit/test-class-branding.php), with the branding server
mocked through pre_http_request:
- an unbranded site uses the plugin defaults and requests nothing;
- a branded site reads its menu names, assistant name, widget titles and
  list, links, SEO recommendation, logo and CSS from one cached request;
- the brand CSS is attached once per style handle;
- server down, HTTP 404, invalid JSON and an unknown format all fall back
  to the defaults with no inline CSS.

Playwright (tests/e2e/specs/gauges.spec.ts) renders the gauge and the
missed-badge progress bar with test colors: solid without
--prpl-color-gradient-start, a gradient from it to the gauge color over
the filled part when set, and the gradient-start attribute (used by the
score gauge) winning over the brand. These fail on the gauge code from
before #799.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Test merged PR on Playground
Test this pull request on the Playground
or download the zip

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

✅ Code Coverage Report

Metric Value
Total Coverage 34.49% 📉
Base Coverage 34.27%
Difference 📈 0.22%

⚠️ Coverage below recommended 40% threshold

🎉 Great job maintaining/improving code coverage!

📊 File-level Coverage Changes (1 files)

📈 Coverage Improved

Class Before After Change
Progress_Planner\UI\Branding 64.71% 85.88% +21.17%
ℹ️ About this report
  • All tests run in a single job with Xdebug coverage
  • Security tests excluded from coverage to prevent output issues
  • Coverage calculated from line coverage percentages

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
10 0 10

⚠️ Warnings (10)

📁 classes/suggested-tasks/data-collector/class-unpublished-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
103 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/suggested-tasks/providers/class-content-review.php (4 warnings)
📍 Line 🔖 Check 💬 Message
232 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
377 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
381 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
388 WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in Using exclusionary parameters, like post__not_in, in calls to get_posts() should be done with caution, see https://docs.wpvip.com/databases/optimize-queries/using-post__not_in/ for more information.
📁 classes/activities/class-query.php (2 warnings)
📍 Line 🔖 Check 💬 Message
71 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $table_name used in $wpdb->query()\n$table_name assigned unsafely at line 58.
163 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $where_args used in $wpdb->get_results()\n$where_args assigned unsafely at line 153.
📁 classes/suggested-tasks/data-collector/class-terms-without-description.php (1 warning)
📍 Line 🔖 Check 💬 Message
108 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 106.
📁 classes/suggested-tasks/data-collector/class-yoast-orphaned-content.php (1 warning)
📍 Line 🔖 Check 💬 Message
111 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_row()\n$query assigned unsafely at line 98.
📁 classes/suggested-tasks/data-collector/class-terms-without-posts.php (1 warning)
📍 Line 🔖 Check 💬 Message
120 PluginCheck.Security.DirectDB.UnescapedDBParameter Unescaped parameter $query used in $wpdb->get_results()\n$query assigned unsafely at line 118.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

The Chromium in CI serializes resolved gradient angles as calc(90deg),
newer versions as 90deg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ilicfilip
ilicfilip merged commit e568ba8 into develop Nov 9, 2026
22 checks passed
@ilicfilip
ilicfilip deleted the filip/branding-gauge-tests branch November 9, 2026 11:48
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