ColorboxFormatterTest.php in Video Embed Field 8
File
tests/src/FunctionalJavascript/ColorboxFormatterTest.php
View source
<?php
namespace Drupal\Tests\video_embed_field\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\video_embed_field\Functional\EntityDisplaySetupTrait;
class ColorboxFormatterTest extends WebDriverTestBase {
use EntityDisplaySetupTrait;
public static $modules = [
'node',
'colorbox',
'video_embed_field',
'colorbox_library_test',
'video_embed_field_mock_provider',
];
const COLORBOX_LAUNCH_TIME = 250;
protected function setUp() {
parent::setUp();
$this
->setupEntityDisplays();
}
public function testColorboxFormatter() {
$this
->setDisplayComponentSettings('video_embed_field_colorbox', [
'autoplay' => FALSE,
'responsive' => TRUE,
]);
$node = $this
->createVideoNode('https://example.com/mock_video');
$this
->drupalGet('node/' . $node
->id());
$this
->click('.video-embed-field-launch-modal');
$this
->getSession()
->wait(static::COLORBOX_LAUNCH_TIME);
$this
->assertSession()
->elementExists('css', '#colorbox .video-embed-field-responsive-video');
$this
->assertSession()
->elementExists('css', 'link[href*="colorbox_style.css"]');
$this
->assertSession()
->elementExists('css', 'link[href*="video_embed_field.responsive-video.css"]');
}
}