function ManageFieldsTest::testLabelFieldFormValidation
Tests the form validation for label field.
File
- 
              core/modules/ field_ui/ tests/ src/ FunctionalJavascript/ ManageFieldsTest.php, line 362 
Class
- ManageFieldsTest
- Tests the Field UI "Manage Fields" screens.
Namespace
Drupal\Tests\field_ui\FunctionalJavascriptCode
public function testLabelFieldFormValidation() : void {
  $this->drupalGet('/admin/structure/types/manage/article/fields/add-field');
  $page = $this->getSession()
    ->getPage();
  $page->findButton('Continue')
    ->click();
  $this->assertSession()
    ->pageTextContains('You need to select a field type.');
  $this->assertNotEmpty($boolean_field = $page->find('xpath', '//*[text() = "Boolean (overridden by alter)"]')
    ->getParent());
  $boolean_field->click();
  $page->findButton('Continue')
    ->click();
  $page->findButton('Continue')
    ->click();
  $this->assertSession()
    ->pageTextContains('Add new field: you need to provide a label.');
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
