AutoplayPermissionTest.php in Video Embed Field 8
File
tests/src/Functional/AutoplayPermissionTest.php
View source
<?php
namespace Drupal\Tests\video_embed_field\Functional;
use Drupal\Tests\BrowserTestBase;
class AutoplayPermissionTest extends BrowserTestBase {
use EntityDisplaySetupTrait;
public static $modules = [
'video_embed_field',
'node',
];
public function testAutoplay() {
$this
->setupEntityDisplays();
$node = $this
->createVideoNode('https://vimeo.com/80896303');
$this
->setDisplayComponentSettings('video_embed_field_video', [
'autoplay' => TRUE,
]);
$bypass_autoplay_user = $this
->drupalCreateUser([
'never autoplay videos',
]);
$this
->drupalLogin($bypass_autoplay_user);
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->elementAttributeContains('css', 'iframe', 'src', 'autoplay=0');
$this
->drupalLogout();
$this
->drupalGet('node/' . $node
->id());
$this
->assertSession()
->elementAttributeContains('css', 'iframe', 'src', 'autoplay=1');
}
}