WebformCardsValidationJavaScriptTest.php in Webform 8.5
File
modules/webform_cards/tests/src/FunctionalJavaScript/WebformCardsValidationJavaScriptTest.php
View source
<?php
namespace Drupal\Tests\webform_cards\FunctionalJavaScript;
use Drupal\Tests\webform\FunctionalJavascript\WebformWebDriverTestBase;
class WebformCardsValidationJavaScriptTest extends WebformWebDriverTestBase {
public static $modules = [
'webform',
'webform_cards',
'webform_cards_test',
];
public function testValidation() {
$session = $this
->getSession();
$page = $session
->getPage();
$assert_session = $this
->assertSession();
$this
->drupalGet('/webform/test_cards_validation_errors');
$page
->pressButton('edit-cards-next');
$page
->pressButton('edit-cards-next');
$page
->pressButton('edit-submit');
$assert_session
->waitForElement('css', '.messages.messages--error');
$this
->assertElementNotVisible('[data-webform-key="card_1"]');
$this
->assertElementVisible('[data-webform-key="card_2"]');
$this
->assertElementNotVisible('[data-webform-key="card_3"]');
$this
->assertElementNotVisible('[data-webform-key="card_1"]');
$this
->assertElementNotVisible('#edit-cards-prev');
$this
->assertElementNotVisible('#edit-cards-next');
$this
->assertElementVisible('#edit-submit');
$assert_session
->responseContains('<strong>The email address <em class="placeholder">{email_multiple not valid}</em> is not valid.</strong>');
}
}