$this->
drupalGet('media/' .
$media->
id());
// Verify the name is present, and its text matches what is expected. Now
// there should be markup in the h1.
$assert_session->
elementTextContains('xpath', '//h1/div/div[1]', 'Name'
);
$assert_session->
elementTextContains('xpath', '//h1/div/div[2]',
$media->
getName());
// In the standard profile, there are some pre-cooked types. Make sure the
// elements configured on their displays are the expected ones.
$this->
drupalGet('media/add/image'
);
$image_media_name = 'example_1.jpeg';
$page->
attachFileToField('files[field_media_image_0]',
$this->root . '/core/modules/media/tests/fixtures/' .
$image_media_name);
$result =
$assert_session->
waitForButton('Remove'
);
$this->
assertNotEmpty($result);
$page->
fillField('field_media_image[0][alt]', 'Image Alt Text 1'
);
$page->
pressButton('Save'
);
$image_media_id =
$this->container
->
get('entity_type.manager'
) ->
getStorage('media'
) ->
getQuery() ->
accessCheck(FALSE
) ->
sort('mid', 'DESC'
) ->
execute();
$image_media_id =
reset($image_media_id);