Problem/Motivation

The test ConfigPageTest::testRequireOnPublishEnable() fails to verify that the require_on_publish setting is saved correctly, due to two related issues:

  1. The field_tags field is created without specifying a required Vocabulary bundle. This causes a form validation error ("Vocabulary field is required.") that prevents the form from being submitted.
  2. Despite the failed submission, the test attempts to verify the setting using:
       $required = $this->getSession()->getPage()->findField('require_on_publish')->getValue();
       $this->assertEquals(1, $required);
    

In Drupal 10, this check still passed—likely because the field value persisted in the form even after the validation error. However, in Drupal 11, this assertion fails. The test environment no longer retains the field value after validation fails, resulting in a null or incorrect value, and causing the assertion to break.

Steps to reproduce

  1. Run `ConfigPageTest::testRequireOnPublishEnable()` in a Drupal 11 environment.
  2. Observe test failure with:
        WebDriver\Exception\StaleElementReference: stale element reference: element is not attached to the page document
        
  3. Investigate the form and discover the unconfigured required Vocabulary caused the form to never successfully submit.
  4. Note that in Drupal 10, the form value was still accessible despite the failed submission; this behavior no longer holds in Drupal 11.

Proposed resolution

  • Fix the test setup by creating a Vocabulary and assigning it when adding the field_tags field to the article content type. This allows the form to submit successfully.
  • Fix the verification step by reloading the FieldConfig entity after form submission and asserting the setting directly:
  $field_config = FieldConfig::load('node.article.field_tags');
  $this->assertTrue($field_config->getThirdPartySetting('require_on_publish', 'require_on_publish', FALSE));

This ensures the test reliably verifies persisted configuration rather than transient UI state.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jcandan created an issue. See original summary.

jcandan’s picture

Issue summary: View changes

jcandan’s picture

Assigned: jcandan » Unassigned
Status: Active » Fixed

  • 5eecfb45 committed on 8.x-1.x
    Issue #3538810 by jcandan: Ensure ConfigPageTest actually verifies...

  • 5eecfb45 committed on 2.0.x
    Issue #3538810 by jcandan: Ensure ConfigPageTest actually verifies...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.