Same filename and directory in other branches
- 4.0.x modules/ajax_example/tests/src/FunctionalJavascript/SimplestTest.php
Namespace
Drupal\Tests\ajax_example\FunctionalJavascript
File
-
modules/ajax_example/tests/src/FunctionalJavascript/SimplestTest.php
View source
<?php
namespace Drupal\Tests\ajax_example\FunctionalJavascript;
use Drupal\Core\Url;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class SimplestTest extends WebDriverTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'ajax_example',
];
public function testAutotextfields() {
$this->drupalGet(Url::fromRoute('ajax_example.simplest'));
$page = $this->getSession()
->getPage();
$assert = $this->assertSession();
$description_selector = '#replace-textfield-container div.description';
$assert->elementExists('css', '#replace-textfield-container');
$assert->elementNotExists('css', $description_selector);
foreach ([
'three',
'two',
'one',
] as $value) {
$page->selectFieldOption('changethis', $value);
$assert->assertWaitOnAjaxRequest();
$assert->elementExists('css', $description_selector);
$prompt_element = $page->find('css', $description_selector);
$this->assertEquals("Say why you chose '{$value}'", $prompt_element->getText());
}
}
}
Classes
| Title |
Deprecated |
Summary |
| SimplestTest |
|
Test the user interactions for the Simplest example. |