MediaJavascriptTestBase.php in Drupal 10
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;
protected 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 = 'div[aria-label="Status message"] a';
$link = $assert_session
->elementExists('css', $selector);
$assert_session
->elementAttributeExists('css', $selector, 'href');
return $link
->getAttribute('href');
}
}