function AdminAjaxTest::testAjaxRebuild

Same name in other branches
  1. 9 core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php \Drupal\Tests\views_ui\FunctionalJavascript\AdminAjaxTest::testAjaxRebuild()
  2. 11.x core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php \Drupal\Tests\views_ui\FunctionalJavascript\AdminAjaxTest::testAjaxRebuild()

Confirms that form_alter is triggered after AJAX rebuilds.

File

core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php, line 42

Class

AdminAjaxTest
Tests the admin UI AJAX interactions.

Namespace

Drupal\Tests\views_ui\FunctionalJavascript

Code

public function testAjaxRebuild() : void {
    \Drupal::service('theme_installer')->install([
        'views_ui_test_theme',
    ]);
    $this->config('system.theme')
        ->set('default', 'views_ui_test_theme')
        ->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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.