public function SectionSelectionTest::testBypassSectionConfiguration in Layout Builder UX 8
Same name in this branch
- 8 tests/src/Functional/SectionSelectionTest.php \Drupal\Tests\lb_ux\Functional\SectionSelectionTest::testBypassSectionConfiguration()
- 8 tests/src/FunctionalJavascript/SectionSelectionTest.php \Drupal\Tests\lb_ux\FunctionalJavascript\SectionSelectionTest::testBypassSectionConfiguration()
@covers \Drupal\lb_ux\Controller\ConfigureSectionController::build
File
- tests/
src/ Functional/ SectionSelectionTest.php, line 52
Class
- SectionSelectionTest
- Tests the section selection UI.
Namespace
Drupal\Tests\lb_ux\FunctionalCode
public function testBypassSectionConfiguration() {
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
// On initial page load, neither of the test layouts are present.
$this
->drupalGet('admin/structure/types/manage/bundle_with_section_field/display/default/layout');
$assert_session
->elementNotExists('css', '.layout--lb-ux-test-form-no-validation');
$assert_session
->elementNotExists('css', '.layout--lb-ux-test-form-with-validation');
// Add a layout with no failing validation, bypassing the config form.
$page
->clickLink('Add section');
$page
->clickLink('LB UX form no validation');
$assert_session
->elementExists('css', '.layout--lb-ux-test-form-no-validation');
$assert_session
->pageTextNotContains('Check 1 2');
$page
->clickLink('Configure Section 1');
$assert_session
->pageTextContains('Check 1 2');
$page
->pressButton('Update');
// Add a layout with failing validation.
$page
->clickLink('Add section');
$page
->clickLink('LB UX form with validation');
$assert_session
->elementNotExists('css', '.layout--lb-ux-test-form-with-validation');
// The error message from the failed validation is not visible.
$assert_session
->pageTextNotContains("That's not the magic word!");
// Subsequent failed form validation does show the error message.
$page
->pressButton('Add section');
$assert_session
->elementNotExists('css', '.layout--lb-ux-test-form-with-validation');
$assert_session
->pageTextContains("That's not the magic word!");
// Fixing the validation error allows the form to be submitted.
$page
->fillField('label', 'Abracadabra');
$page
->pressButton('Add section');
$assert_session
->elementExists('css', '.layout--lb-ux-test-form-with-validation');
$assert_session
->pageTextNotContains("That's not the magic word!");
}