You are here

protected function ProductLayoutBuilderIntegrationTest::addBlockToLayout in Commerce Core 8.2

Adds a block to the layout.

Parameters

string $block_title: The block title which will be the link text.

callable|null $configure: A callback that is invoked to configure the block.

2 calls to ProductLayoutBuilderIntegrationTest::addBlockToLayout()
ProductLayoutBuilderIntegrationTest::configureDefaultLayout in modules/product/tests/src/FunctionalJavascript/ProductLayoutBuilderIntegrationTest.php
Configures a default layout for a product type.
ProductLayoutBuilderIntegrationTest::testConfiguringOverrideLayout in modules/product/tests/src/FunctionalJavascript/ProductLayoutBuilderIntegrationTest.php
Tests configuring a layout override for a product.

File

modules/product/tests/src/FunctionalJavascript/ProductLayoutBuilderIntegrationTest.php, line 302

Class

ProductLayoutBuilderIntegrationTest
@group commerce

Namespace

Drupal\Tests\commerce_product\FunctionalJavascript

Code

protected function addBlockToLayout($block_title, callable $configure = NULL) {
  $assert_session = $this
    ->assertSession();
  $assert_session
    ->linkExists('Add block');
  $this
    ->getSession()
    ->getPage()
    ->clickLink('Add block');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  $this
    ->assertNotEmpty($assert_session
    ->waitForElementVisible('named', [
    'link',
    $block_title,
  ]));
  $this
    ->getSession()
    ->getPage()
    ->clickLink($block_title);
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
  if ($configure !== NULL) {
    $configure();
  }
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Add block');
  $this
    ->assertSession()
    ->assertWaitOnAjaxRequest();
}