$this->
drupalLogin($user);
$this->
drupalGet('/admin/structure/types/manage/article/fields/add-field'
);
$page->
selectFieldOption('new_storage_type', 'field_ui:entity_reference:media'
);
$this->
assertNotNull($assert_session->
waitForField('label'
));
$page->
fillField('label', 'Shatner'
);
$this->
waitForText('field_shatner'
);
$page->
pressButton('Save and continue'
);
$page->
pressButton('Save field settings'
);
$assert_session->
pageTextNotContains('Undefined index: target_bundles'
);
$this->
waitForFieldExists('Type One'
)->
check();
$this->
assertElementExistsAfterWait('css', '[name="settings[handler_settings][target_bundles][type_one]"][checked="checked"]'
);
$page->
checkField('settings[handler_settings][target_bundles][type_two]'
);
$this->
assertElementExistsAfterWait('css', '[name="settings[handler_settings][target_bundles][type_two]"][checked="checked"]'
);
$page->
checkField('settings[handler_settings][target_bundles][type_three]'
);
$this->
assertElementExistsAfterWait('css', '[name="settings[handler_settings][target_bundles][type_three]"][checked="checked"]'
);
$page->
pressButton('Save settings'
);
$assert_session->
pageTextContains('Saved Shatner configuration.'
);
$this->
drupalGet('/admin/structure/types/manage/article/fields/node.article.field_shatner'
);
$assert_session->
checkboxNotChecked('set_default_value'
);
$page->
checkField('set_default_value'
);
$this->
assertElementExistsAfterWait('css', "#field_shatner-media-library-wrapper-default_value_input"
)