You are here

public function EntityDisplayTest::testExtraFields in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testExtraFields()
  2. 9 core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php \Drupal\Tests\field_ui\FunctionalJavascript\EntityDisplayTest::testExtraFields()

Tests extra fields.

File

core/modules/field_ui/tests/src/FunctionalJavascript/EntityDisplayTest.php, line 100

Class

EntityDisplayTest
Tests the UI for entity displays.

Namespace

Drupal\Tests\field_ui\FunctionalJavascript

Code

public function testExtraFields() {
  entity_test_create_bundle('bundle_with_extra_fields');
  $this
    ->drupalGet('entity_test/structure/bundle_with_extra_fields/display');
  $this
    ->assertSession()
    ->waitForElement('css', '.tabledrag-handle');
  $id = $this
    ->getSession()
    ->getPage()
    ->find('css', '[name="form_build_id"]')
    ->getValue();
  $extra_field_row = $this
    ->getSession()
    ->getPage()
    ->find('css', '#display-extra-field');
  $disabled_region_row = $this
    ->getSession()
    ->getPage()
    ->find('css', '.region-hidden-title');
  $extra_field_row
    ->find('css', '.handle')
    ->dragTo($disabled_region_row);
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->assertSession()
    ->waitForElement('css', "[name='form_build_id']:not([value='{$id}'])");
  $this
    ->submitForm([], 'Save');
  $this
    ->assertSession()
    ->pageTextContains('Your settings have been saved.');
}