You are here

public function FeaturesUiAjaxTest::testActionConfigurationWithAjax in Features 8.3

Same name and namespace in other branches
  1. 8.4 modules/features_ui/tests/src/FunctionalJavascript/FeaturesUiAjaxTest.php \Drupal\Tests\features_ui\FunctionalJavascript\FeaturesUiAjaxTest::testActionConfigurationWithAjax()

Tests feature bundle creation with AJAX saves configuration.

File

modules/features_ui/tests/src/FunctionalJavascript/FeaturesUiAjaxTest.php, line 45

Class

FeaturesUiAjaxTest
Tests the creation of a features bundle using AJAX.

Namespace

Drupal\Tests\features_ui\FunctionalJavascript

Code

public function testActionConfigurationWithAjax() {
  $url = Url::fromRoute('features.export');
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->pageTextContains('You have not yet created any bundles.');
  $url = Url::fromRoute('features.assignment');
  $this
    ->drupalGet($url);
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->find('css', '[name="bundle[bundle_select]"]')
    ->setValue('new');
  $this
    ->assertSession()
    ->waitForElementVisible('css', '[name="bundle[name]"][value=""]')
    ->setValue('foo');
  $this
    ->assertSession()
    ->waitForElementVisible('css', 'button[class="link"][type="button"]')
    ->click();
  $this
    ->assertSession()
    ->waitForElementVisible('css', '[name="bundle[machine_name]"]')
    ->setValue('foo');
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->find('css', '[name="bundle[description]"]')
    ->setValue($this
    ->randomString());
  $page
    ->find('css', '[value="Save settings"]')
    ->click();
  $url = Url::fromRoute('features.export');
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->pageTextNotContains('You have not yet created any bundles.');
}