Skip to content

Fix apiVersion number mismatch#4061

Merged
acicovic merged 7 commits into
developfrom
fix/api-version-number-mismatch
Mar 25, 2026
Merged

Fix apiVersion number mismatch#4061
acicovic merged 7 commits into
developfrom
fix/api-version-number-mismatch

Conversation

@acicovic

@acicovic acicovic commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

Description

With this PR, we're fixing the mismatch between apiVersion in our blocks/recommendations/edit.tsx and blocks/recommendations/block.json files, which were 2 and 3 respectively. We update this to 3.

Motivation and context

We shouldn't have mismatching apiVersion numbers. Having them out of sync is a bug waiting to surface and should be fixed.

How has this been tested?

Existing tests pass.

Summary by CodeRabbit

  • Chores
    • Updated recommendations block configuration to align with current WordPress standards and improve platform compatibility.
  • Tests
    • End-to-end tests updated to interact with the editor canvas for more accurate validation of recommendation block behavior.

@acicovic acicovic added this to the 3.22.1 milestone Mar 11, 2026
@acicovic acicovic self-assigned this Mar 11, 2026
@acicovic acicovic requested a review from a team as a code owner March 11, 2026 15:00
@coderabbitai

coderabbitai Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Updated the ParselyRecommendations block registration apiVersion to 3 and adjusted end-to-end tests to target the editor canvas FrameLocator instead of the Playwright Page for locating block content and assertions.

Changes

Cohort / File(s) Summary
WordPress Block Configuration
src/blocks/recommendations/edit.tsx
Changed block registration apiVersion from 2 to 3. No other logic changes.
E2E: Recommendations - errors
tests/e2e/specs/blocks/recommendations/errors.spec.ts
Switched assertions to use admin.editor.canvas.getByText(...) instead of page.getByText(...) for error message visibility checks.
E2E: Recommendations - settings
tests/e2e/specs/blocks/recommendations/settings.spec.ts, tests/e2e/.../utils*
Updated test utilities and assertions to accept/use a FrameLocator (editor canvas) instead of Page; moved image/link locators and initial/default-value assertions to editor.canvas.locator(...) while keeping sidebar interactions on page.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Feature: Recommendations Block, Maintenance

Suggested reviewers

  • vaurdan
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change—fixing the apiVersion mismatch from 2 to 3 in the Recommendations block.
Description check ✅ Passed The description covers all required sections: clear explanation of the change, motivation for fixing the mismatch, and confirmation that existing tests pass.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/api-version-number-mismatch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@acicovic acicovic added the Changelog: Fixed PR to be added under the changelog's "Fixed" section label Mar 11, 2026
@acicovic

Copy link
Copy Markdown
Collaborator Author

@copilot, can you understand why E2E tests fail here, and propose a fix? It shouldn't break any functionality, and the tests should pass without compromising their quality.

Copilot AI commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

@acicovic I've opened a new pull request, #4088, to work on those changes. Once the pull request is ready, I'll request review from you.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/e2e/specs/blocks/recommendations/settings.spec.ts`:
- Around line 48-49: The test currently asserts on the Locator object itself
using
expect(editor.canvas.locator('.parsely-recommendations-image')).toBeTruthy(),
which is ineffective; replace this with a Playwright locator assertion that
checks DOM presence/visibility (for example, await
expect(editor.canvas.locator('.parsely-recommendations-image')).toBeVisible() or
toHaveCount(1)) and ensure the expect call is awaited so the assertion queries
the page rather than the Locator object.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fa42a4e6-102c-4b60-8c68-8f62f857eca4

📥 Commits

Reviewing files that changed from the base of the PR and between 4bd514b and 4c62d95.

⛔ Files ignored due to path filters (2)
  • build/blocks/recommendations/edit.asset.php is excluded by !build/**
  • build/blocks/recommendations/edit.js is excluded by !build/**
📒 Files selected for processing (2)
  • tests/e2e/specs/blocks/recommendations/errors.spec.ts
  • tests/e2e/specs/blocks/recommendations/settings.spec.ts

Comment thread tests/e2e/specs/blocks/recommendations/settings.spec.ts
@acicovic acicovic merged commit dcaef65 into develop Mar 25, 2026
21 checks passed
@acicovic acicovic deleted the fix/api-version-number-mismatch branch March 25, 2026 11:45
github-actions Bot added a commit that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: Fixed PR to be added under the changelog's "Fixed" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants