WebformCardsDraftJavaScriptTest.php in Webform 8.5
File
modules/webform_cards/tests/src/FunctionalJavaScript/WebformCardsDraftJavaScriptTest.php
View source
<?php
namespace Drupal\Tests\webform_cards\FunctionalJavaScript;
use Drupal\Tests\webform\FunctionalJavascript\WebformWebDriverTestBase;
class WebformCardsDraftJavaScriptTest extends WebformWebDriverTestBase {
public static $modules = [
'webform',
'webform_cards',
'webform_cards_test',
];
public function testDraft() {
$session = $this
->getSession();
$page = $session
->getPage();
$assert_session = $this
->assertSession();
$this
->drupalGet('/webform/test_cards_draft');
$assert_session
->waitForElement('css', '.webform-card--active[data-webform-key="card_1"]');
$this
->assertElementVisible('[data-webform-key="card_1"]');
$this
->assertElementNotVisible('[data-webform-key="card_2"]');
$page
->pressButton('edit-cards-next');
$assert_session
->waitForElement('css', '.webform-card--active[data-webform-key="card_2"]');
$this
->assertElementNotVisible('[data-webform-key="card_1"]');
$this
->assertElementVisible('[data-webform-key="card_2"]');
$page
->pressButton('edit-draft');
$assert_session
->responseContains('Submission saved. You may return to this form later and it will restore the current values.');
$this
->assertElementNotVisible('[data-webform-key="card_1"]');
$this
->assertElementVisible('[data-webform-key="card_2"]');
$this
->drupalGet('/webform/test_cards_draft');
$assert_session
->waitForElement('css', '.webform-card--active[data-webform-key="card_2"]');
$this
->assertElementNotVisible('[data-webform-key="card_1"]');
$this
->assertElementVisible('[data-webform-key="card_2"]');
}
}