3 namespace Drupal\Tests\video_embed_field\FunctionalJavascript;
5 use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
6 use Drupal\Tests\video_embed_field\Functional\EntityDisplaySetupTrait;
9 * Test the colorbox formatter.
11 * @group video_embed_field
13 class ColorboxFormatterTest extends JavascriptTestBase {
15 use EntityDisplaySetupTrait;
20 public static $modules = [
24 'colorbox_library_test',
25 'video_embed_field_mock_provider',
29 * How long it takes for colorbox to open.
31 const COLORBOX_LAUNCH_TIME = 250;
36 protected function setUp() {
38 $this->setupEntityDisplays();
42 * Test the colorbox formatter.
44 public function testColorboxFormatter() {
45 $this->setDisplayComponentSettings('video_embed_field_colorbox', [
49 $node = $this->createVideoNode('https://example.com/mock_video');
50 $this->drupalGet('node/' . $node->id());
51 $this->click('.video-embed-field-launch-modal');
52 $this->getSession()->wait(static::COLORBOX_LAUNCH_TIME);
53 $this->assertSession()->elementExists('css', '#colorbox .video-embed-field-responsive-video');
54 // Make sure the right library files are loaded on the page.
55 $this->assertSession()->elementContains('css', 'style', 'colorbox/styles/default/colorbox_style.css');
56 $this->assertSession()->elementContains('css', 'style', 'video_embed_field/css/video_embed_field.responsive-video.css');