MediaJavascriptTestBase.php in Drupal 8
File
core/modules/media/tests/src/FunctionalJavascript/MediaJavascriptTestBase.php
View source
<?php
namespace Drupal\Tests\media\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\Tests\media\Functional\MediaFunctionalTestTrait;
use Drupal\Tests\media\Traits\MediaTypeCreationTrait;
abstract class MediaJavascriptTestBase extends WebDriverTestBase {
use MediaFunctionalTestTrait;
use MediaTypeCreationTrait;
public static $modules = [
'system',
'node',
'field_ui',
'views_ui',
'media',
'media_test_source',
];
protected function waitUntilVisible($selector, $timeout = 1000, $message = '') {
$condition = "jQuery('" . $selector . ":visible').length > 0";
$this
->assertJsCondition($condition, $timeout, $message);
}
protected function assertLinkToCreatedMedia() {
$assert_session = $this
->assertSession();
$selector = '.messages a';
$link = $assert_session
->elementExists('css', $selector);
$assert_session
->elementAttributeExists('css', $selector, 'href');
return $link
->getAttribute('href');
}
}