FeaturesUiAjaxTest.php in Features 8.3
File
modules/features_ui/tests/src/FunctionalJavascript/FeaturesUiAjaxTest.php
View source
<?php
namespace Drupal\Tests\features_ui\FunctionalJavascript;
use Drupal\Core\Url;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class FeaturesUiAjaxTest extends WebDriverTestBase {
protected $strictConfigSchema = FALSE;
protected static $modules = [
'features',
'features_ui',
];
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$user = $this
->drupalCreateUser([
'administer site configuration',
'export configuration',
]);
$this
->drupalLogin($user);
}
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.');
}
}