protected function MediaJavascriptTestBase::assertLinkToCreatedMedia in Drupal 10
Same name and namespace in other branches
- 8 core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php \Drupal\Tests\media\FunctionalJavascript\MediaJavascriptTestBase::assertLinkToCreatedMedia()
- 9 core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php \Drupal\Tests\media\FunctionalJavascript\MediaJavascriptTestBase::assertLinkToCreatedMedia()
Asserts that a link to a new media item is displayed in the messages area.
Return value
string The link URL.
File
- core/
modules/ media/ tests/ src/ FunctionalJavascript/ MediaJavascriptTestBase.php, line 52
Class
- MediaJavascriptTestBase
- Base class for Media functional JavaScript tests.
Namespace
Drupal\Tests\media\FunctionalJavascriptCode
protected function assertLinkToCreatedMedia() {
$assert_session = $this
->assertSession();
$selector = 'div[aria-label="Status message"] a';
// Get the canonical media entity URL from the creation message.
$link = $assert_session
->elementExists('css', $selector);
$assert_session
->elementAttributeExists('css', $selector, 'href');
return $link
->getAttribute('href');
}