function ConfigExportTest::testAjaxOnExportPage

Same name in other branches
  1. 10 core/modules/config/tests/src/FunctionalJavascript/ConfigExportTest.php \Drupal\Tests\config\FunctionalJavascript\ConfigExportTest::testAjaxOnExportPage()
  2. 11.x core/modules/config/tests/src/FunctionalJavascript/ConfigExportTest.php \Drupal\Tests\config\FunctionalJavascript\ConfigExportTest::testAjaxOnExportPage()

Tests Ajax form functionality on the config export page.

File

core/modules/config/tests/src/FunctionalJavascript/ConfigExportTest.php, line 27

Class

ConfigExportTest
Tests the config export form.

Namespace

Drupal\Tests\config\FunctionalJavascript

Code

public function testAjaxOnExportPage() {
    $this->drupalLogin($this->drupalCreateUser([
        'export configuration',
    ]));
    $page = $this->getSession()
        ->getPage();
    // Check that the export is empty on load.
    $this->drupalGet('admin/config/development/configuration/single/export');
    $this->assertSession()
        ->fieldValueEquals('export', '');
    // Check that the export is filled when selecting a config name.
    $page->selectFieldOption('config_name', 'system.site');
    $this->assertSession()
        ->assertWaitOnAjaxRequest();
    $this->assertSession()
        ->fieldValueNotEquals('export', '');
    // Check that the export is emptied again when selecting a config type.
    $page->selectFieldOption('config_type', 'Action');
    $this->assertSession()
        ->assertWaitOnAjaxRequest();
    $this->assertSession()
        ->fieldValueEquals('export', '');
}

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