public function MediaBrowserWidgetDisambiguationTest::testEmbed in Lightning Media 8.3
Tests that select is shown when media bundle is ambiguous.
File
- tests/
src/ FunctionalJavascript/ MediaBrowserWidgetDisambiguationTest.php, line 155
Class
- MediaBrowserWidgetDisambiguationTest
- Tests media type disambiguation in the media browser.
Namespace
Drupal\Tests\lightning_media\FunctionalJavascriptCode
public function testEmbed() {
$assert_session = $this
->assertSession();
$session = $this
->getSession();
$page = $session
->getPage();
$assert_session
->waitForLink('Create embed')
->click();
$video_url = 'https://www.youtube.com/watch?v=zQ1_IbFFbzA';
$assert_session
->waitForField('input')
->setValue($video_url);
$assert_session
->waitForField('Bundle')
->selectOption('Advertisement');
$assert_session
->waitForField('Video Url');
$page
->fillField('Name', 'Bar');
$page
->pressButton('Place');
$this
->waitForEntityBrowserToClose();
$assert_session
->waitForButton('Remove');
$page
->pressButton('Save');
// Assert the correct entities are created.
$node = Node::load(1);
$this
->assertInstanceOf(Node::class, $node);
$this
->assertSame('Foo', $node
->getTitle());
$this
->assertSame('advertisement', $node->field_media->entity
->bundle());
$this
->assertSame('Bar', $node->field_media->entity
->label());
$this
->assertSame($video_url, $node->field_media->entity->field_media_video_embed_field->value);
}