EntityUsageJavascriptTestBase.php in Entity Usage 8.4
File
tests/src/FunctionalJavascript/EntityUsageJavascriptTestBase.php
View source
<?php
namespace Drupal\Tests\entity_usage\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
abstract class EntityUsageJavascriptTestBase extends WebDriverTestBase {
protected static $modules = [
'image',
'media',
'node',
'field_ui',
'system',
'text',
'path',
'entity_track',
'entity_usage',
'entity_usage_test',
];
protected $defaultTheme = 'stark';
public function setUp() {
parent::setUp();
$account = $this
->drupalCreateUser([
'administer node fields',
'administer node display',
'administer nodes',
'bypass node access',
'use text format eu_test_text_format',
]);
$this
->drupalLogin($account);
}
protected function waitForAjaxToFinish() {
$this
->assertSession()
->assertWaitOnAjaxRequest();
}
protected function waitUntilVisible($selector, $timeout = 2000, $message = '') {
$condition = "jQuery('" . $selector . ":visible').length > 0";
$this
->assertJsCondition($condition, $timeout, $message);
}
protected function saveHtmlOutput() {
$out = $this
->getSession()
->getPage()
->getContent();
$this
->refreshVariables();
if ($this->htmlOutputEnabled) {
$html_output = '<hr />Ending URL: ' . $this
->getSession()
->getCurrentUrl();
$html_output .= '<hr />' . $out;
$html_output .= $this
->getHtmlOutputHeaders();
$this
->htmlOutput($html_output);
}
}
}