// Assert the media item fields are shown and the vertical tabs are no
// longer shown.
$this->
waitForFieldExists('Alternative text'
);
$this->
assertMediaAdded();
// Press the 'Remove button' and assert the user is sent back to the media
// library.
$page->
pressButton('media-0-remove-button'
);
// Assert the remove message is shown.
$this->
waitForText("The media item
$png_image->filename has been removed."
);
// Assert the focus is shifted to the first tabbable element of the add
// form, which should be the source field.
$this->
assertNoMediaAdded();
$assert_session->
elementExists('css', '.ui-dialog-titlebar-close'
)->
click();
// Assert uploading multiple files.
$this->
openMediaLibraryForField('field_unlimited_media'
);
$this->
switchToMediaType('Three'
);
// Assert the existing items are remembered when adding and removing media.
$checkbox =
$page->
findField("Select
$existing_media_name"
);
$checkbox->
click();
// Assert we can add multiple files.
$this->
assertTrue($assert_session->
fieldExists('Add files'
)->
hasAttribute('multiple'
));
// Create a list of new files to upload.