LibraryCachingTest.php in Drupal 10
File
core/modules/views_ui/tests/src/FunctionalJavascript/LibraryCachingTest.php
View source
<?php
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class LibraryCachingTest extends WebDriverTestBase {
protected static $modules = [
'node',
'views',
'views_ui',
];
protected $defaultTheme = 'stark';
public function testConsecutiveDialogRequests() {
$admin_user = $this
->drupalCreateUser([
'administer site configuration',
'administer views',
'administer nodes',
'access content overview',
]);
\Drupal::configFactory()
->getEditable('views.settings')
->set('ui.always_live_preview', FALSE)
->save();
$this
->drupalLogin($admin_user);
$this
->drupalGet('admin/structure/views/view/content');
$page = $this
->getSession()
->getPage();
$add_link = $page
->findById('views-add-field');
$this
->assertTrue($add_link
->isVisible(), 'Add fields button found.');
$add_link
->click();
$this
->assertJsCondition("jQuery('.ui-dialog-titlebar').length > 0");
$page
->pressButton('Close');
$add_link
->click();
$this
->assertJsCondition("jQuery('.ui-dialog-titlebar').length > 0");
$page
->pressButton('Close');
$this
->drupalGet('admin/structure/views/view/content');
$page = $this
->getSession()
->getPage();
$preview = $page
->findById('preview-submit');
$preview
->click();
$this
->assertJsCondition("jQuery('.ajax-progress').length === 0");
$preview
->click();
$this
->assertJsCondition("jQuery('.ajax-progress').length === 0");
$add_link = $page
->findById('views-add-field');
$add_link
->click();
$this
->assertJsCondition("jQuery('.ui-dialog-titlebar').length > 0");
$page
->pressButton('Close');
}
}