WebformCardsToggleJavaScriptTest.php in Webform 8.5
File
modules/webform_cards/tests/src/FunctionalJavaScript/WebformCardsToggleJavaScriptTest.php
View source
<?php
namespace Drupal\Tests\webform_cards\FunctionalJavaScript;
use Drupal\Tests\webform\FunctionalJavascript\WebformWebDriverTestBase;
class WebformCardsToggleJavaScriptTest extends WebformWebDriverTestBase {
public static $modules = [
'webform',
'webform_cards',
'webform_cards_test',
];
public function testToggle() {
$session = $this
->getSession();
$page = $session
->getPage();
$assert_session = $this
->assertSession();
$this
->drupalGet('/webform/test_cards_toggle');
$assert_session
->waitForElement('css', 'button.webform-cards-toggle');
$this
->assertElementVisible('[data-webform-key="card_1"]');
$this
->assertElementNotVisible('[data-webform-key="card_2"]');
$this
->assertElementVisible('#edit-cards-next');
$this
->assertElementNotVisible('#edit-submit');
$this
->assertElementVisible('.webform-progress');
$page
->pressButton('Show all');
$this
->assertElementVisible('[data-webform-key="card_1"]');
$this
->assertElementVisible('[data-webform-key="card_2"]');
$this
->assertElementNotVisible('#edit-cards-next');
$this
->assertElementVisible('#edit-submit');
$this
->assertElementNotVisible('.webform-progress');
$page
->pressButton('Hide all');
$this
->assertElementVisible('[data-webform-key="card_1"]');
$this
->assertElementNotVisible('[data-webform-key="card_2"]');
$this
->assertElementVisible('#edit-cards-next');
$this
->assertElementNotVisible('#edit-submit');
$this
->assertElementVisible('.webform-progress');
}
}