public function AjaxWizardTest::testWizardPreviousStepsValues in Examples for Developers 8
Same name and namespace in other branches
- 3.x modules/ajax_example/tests/src/FunctionalJavascript/AjaxWizardTest.php \Drupal\Tests\ajax_example\FunctionalJavascript\AjaxWizardTest::testWizardPreviousStepsValues()
Test that the previous values are correctly displayed.
If we move back to previous steps the already set values should be displayed.
File
- ajax_example/
tests/ src/ FunctionalJavascript/ AjaxWizardTest.php, line 93
Class
- AjaxWizardTest
- Test the user interactions for the Ajax Wizard example.
Namespace
Drupal\Tests\ajax_example\FunctionalJavascriptCode
public function testWizardPreviousStepsValues() {
// Get our Mink stuff.
$session = $this
->getSession();
$page = $session
->getPage();
$assert = $this
->assertSession();
// Get the page.
$form_url = Url::fromRoute('ajax_example.wizard');
$this
->drupalGet($form_url);
// We fill the first step and continue.
$page
->fillField('name', 'José Saramago');
$page
->pressButton('Next step');
$assert
->assertWaitOnAjaxRequest();
// We fill the second step and continue with the last step.
$page
->fillField('address', 'Rua dos Bacalhoeiros, 10');
$page
->pressButton('Next step');
$assert
->assertWaitOnAjaxRequest();
// We fill the third step and we finally submit the form.
$page
->fillField('city', 'Lisboa');
// Now we move back to previous steps and check that the values are still
// there.
$page
->pressButton('Previous step');
$assert
->assertWaitOnAjaxRequest();
$assert
->fieldValueEquals('address', 'Rua dos Bacalhoeiros, 10');
$page
->pressButton('Previous step');
$assert
->assertWaitOnAjaxRequest();
$assert
->fieldValueEquals('name', 'José Saramago');
}