$block_url = 'admin/structure/block/add/field_block_test%3Auser%3Auser%3Afield_date/starterkit_theme';
$assert_session->
linkByHrefExists($block_url);
$this->
drupalGet($block_url);
$page->
fillField('region', 'content'
);
// Assert the default formatter configuration.
$assert_session->
fieldValueEquals('settings[formatter][type]', 'datetime_default'
);
$assert_session->
fieldValueEquals('settings[formatter][settings][format_type]', 'medium'
);
// Change the formatter.
$page->
selectFieldOption('settings[formatter][type]', 'datetime_time_ago'
);
$assert_session->
assertWaitOnAjaxRequest();
// Changing the formatter removes the old settings and introduces new ones.
$assert_session->
fieldNotExists('settings[formatter][settings][format_type]'
);
$assert_session->
fieldExists('settings[formatter][settings][granularity]'
);
$page->
pressButton('Save block'
);
$this->
assertTrue($assert_session->
waitForText('The block configuration has been saved.'
));
// Configure the block and change the formatter again.
$this->
clickLink('Configure'
);
$page->
selectFieldOption('settings[formatter][type]', 'datetime_default'
);
$assert_session->
assertWaitOnAjaxRequest();