// Assert we can add a oEmbed video with a custom name.
$page->
fillField('Add Type Five via URL',
$youtube_url);
$page->
pressButton('Add'
);
// assertWaitOnAjaxRequest() required for input "id" attributes to
// consistently match their label's "for" attribute.
$assert_session->
assertWaitOnAjaxRequest();
$this->
waitForText('The media item has been created but has not yet been saved.'
);
// The advanced ui should show the Additional selected media.
$assert_session->
pageTextContains('Additional selected media'
);
$assert_session->
elementExists('css', '[data-drupal-selector="edit-selection"]'
);
$page->
fillField('Name', 'Custom video title'
);
$assert_session->
checkboxChecked("Select
$youtube_title",
$this->
getSelectionArea());
$this->
saveAnd('select'
);
$this->
waitForNoText('Save and select'
);
// Load the created media item.
$media_items = Media::
loadMultiple();
$added_media =
array_pop($media_items);
// Ensure the media item was saved to the library and automatically
// selected. The added media items should be in the first position of the
// add form.
$assert_session->
pageTextContains('Add or select media'
);
$assert_session->
pageTextContains('Custom video title'
);