Skip to content

Conversation

@xurizaemon
Copy link
Contributor

@xurizaemon xurizaemon commented Jul 2, 2021

Refs #590

Summary by CodeRabbit

  • New Features

    • Added region-scoped checkbox handling capabilities enabling more precise form field operations. Users can now check and uncheck form fields within designated page regions with enhanced control and flexibility.
  • Tests

    • Introduced test scenario validating checkbox field operations performed within specific page regions.
  • Documentation

    • Fixed documentation typo in button interaction method description.

✏️ Tip: You can customize this high-level summary in your review settings.

@AlexSkrypnyk
Copy link
Collaborator

@xurizaemon
could you please re-base this PR to use the latest code from main. Thank you

@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

This change adds region-scoped checkbox handling functionality to a Drupal testing extension. Two new public methods enable checking and unchecking checkboxes within specified regions, supported by test fixtures and feature scenarios demonstrating the new capability.

Changes

Cohort / File(s) Summary
Test Feature & Fixture
features/blackbox.feature, fixtures/blackbox/index.html
Feature scenario step added to test checkbox interaction in the "navigation" region; corresponding HTML checkbox element ("extra") added to fixture
Context Implementation
src/Drupal/DrupalExtension/Context/MinkContext.php
Two new public methods introduced: assertRegionCheckBox() and assertRegionUncheckBox() for region-scoped checkbox operations; minor typo corrected in existing method documentation

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A checkbox hops within a region bright,
Two new methods make the test steps right,
Check and uncheck with scope so clear,
The rabbit's work brings testing cheer! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly references issue #590 and accurately describes the main change: adding checkbox manipulation capabilities in regions through two new public methods.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@xurizaemon
Copy link
Contributor Author

@AlexSkrypnyk done 👍🏼

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Drupal/DrupalExtension/Context/MinkContext.php (1)

445-481: Consider adding explicit checkbox validation for consistency with assertRegionPressButton.

The implementation works correctly, but unlike assertRegionPressButton (lines 417-426), these methods don't explicitly verify the checkbox exists before acting. assertRegionPressButton finds the button first and throws a custom exception with a helpful message including the region name and current URL.

If you want consistent error messages across region-based step definitions, you could add explicit validation:

♻️ Optional: Add explicit checkbox validation
     public function assertRegionCheckBox($locator, $region)
     {
         $regionObj = $this->getRegion($region);
+        $field = $regionObj->findField($locator);
+        if (empty($field)) {
+            throw new \Exception(sprintf("The checkbox '%s' was not found in the region '%s' on the page %s", $locator, $region, $this->getSession()->getCurrentUrl()));
+        }
         $regionObj->checkField($locator);
     }

Apply similar pattern to assertRegionUncheckBox.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b61482 and 5ae6c19.

📒 Files selected for processing (3)
  • features/blackbox.feature
  • fixtures/blackbox/index.html
  • src/Drupal/DrupalExtension/Context/MinkContext.php
🧰 Additional context used
🧬 Code graph analysis (1)
src/Drupal/DrupalExtension/Context/MinkContext.php (1)
src/Drupal/DrupalExtension/Context/MarkupContext.php (1)
  • getRegion (26-35)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PHP 8.3, Drupal 10
🔇 Additional comments (3)
src/Drupal/DrupalExtension/Context/MinkContext.php (1)

405-405: LGTM!

The docblock typo fix improves clarity.

fixtures/blackbox/index.html (1)

16-16: LGTM!

The test fixture correctly adds a checkbox element with proper id and label association to support the new region-scoped checkbox step definition.

features/blackbox.feature (1)

29-29: LGTM on the check step, but consider adding test coverage for uncheck.

The new step correctly tests the assertRegionCheckBox functionality within the form submission scenario.

However, assertRegionUncheckBox is not covered by any test scenario. Consider adding a step to verify the uncheck functionality as well, for example:

And I uncheck "extra" in the "navigation" region

@AlexSkrypnyk AlexSkrypnyk merged commit 3944b48 into jhedstrom:main Jan 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants