AdminAjaxTest.php in Drupal 10
File
core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php
View source
<?php
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class AdminAjaxTest extends WebDriverTestBase {
protected static $modules = [
'views_ui',
];
protected $defaultTheme = 'views_test_classy_subtheme';
protected function setUp() : void {
parent::setUp();
$this
->drupalLogin($this
->createUser([
'administer views',
]));
}
public function testAjaxRebuild() {
\Drupal::service('theme_installer')
->install([
'views_test_classy_subtheme',
]);
$this
->config('system.theme')
->set('default', 'views_test_classy_subtheme')
->save();
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
$this
->drupalGet('admin/structure/views/view/user_admin_people');
$assert_session
->pageTextContains('This is text added to the display tabs at the top');
$assert_session
->pageTextContains('This is text added to the display edit form');
$page
->clickLink('User: Name (Username)');
$assert_session
->waitForElementVisible('css', '.views-ui-dialog');
$page
->fillField('Label', 'New Title');
$page
->find('css', '.ui-dialog-buttonset button:contains("Apply")')
->press();
$assert_session
->waitForElementRemoved('css', '.views-ui-dialog');
$assert_session
->pageTextContains('This is text added to the display tabs at the top');
$assert_session
->pageTextContains('This is text added to the display edit form');
}
}