You are here

protected function ProductLayoutBuilderIntegrationTest::configureDefaultLayout in Commerce Core 8.2

Configures a default layout for a product type.

Parameters

string $bundle: The bundle to configure.

5 calls to ProductLayoutBuilderIntegrationTest::configureDefaultLayout()
ProductLayoutBuilderIntegrationTest::testConfiguringDefaultLayout in modules/product/tests/src/FunctionalJavascript/ProductLayoutBuilderIntegrationTest.php
Tests configuring the default layout for a product type.
ProductLayoutBuilderIntegrationTest::testConfiguringOverrideLayout in modules/product/tests/src/FunctionalJavascript/ProductLayoutBuilderIntegrationTest.php
Tests configuring a layout override for a product.
ProductLayoutBuilderIntegrationTest::testFieldInjectionOverAjax in modules/product/tests/src/FunctionalJavascript/ProductLayoutBuilderIntegrationTest.php
Test field injection on a Layout Builder enabled product.
ProductLayoutBuilderIntegrationTest::testProductWithoutVariationsDoesNotCrash in modules/product/tests/src/FunctionalJavascript/ProductLayoutBuilderIntegrationTest.php
Make sure products without a variation do not crash.
ProductLayoutBuilderIntegrationTest::testSampleValuesGeneratedImages in modules/product/tests/src/FunctionalJavascript/ProductLayoutBuilderIntegrationTest.php
Tests that configuring the default layout doesn't generate multiple images.

File

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

Class

ProductLayoutBuilderIntegrationTest
@group commerce

Namespace

Drupal\Tests\commerce_product\FunctionalJavascript

Code

protected function configureDefaultLayout($bundle) {
  $this
    ->drupalGet(Url::fromRoute('entity.entity_view_display.commerce_product.default', [
    'commerce_product_type' => $bundle,
  ]));
  $this
    ->getSession()
    ->getPage()
    ->clickLink('Manage layout');
  $this
    ->assertSession()
    ->pageTextNotContains('$9.99');
  $this
    ->addBlockToLayout('Price', function () {
    $this
      ->assertSession()
      ->pageTextContainsOnce('Currency display');
    $this
      ->getSession()
      ->getPage()
      ->checkField('Strip trailing zeroes after the decimal point.');
  });
  $this
    ->assertSession()
    ->pageTextContainsOnce('$9.99');
  $this
    ->addBlockToLayout('Variations', function () {
    $this
      ->getSession()
      ->getPage()
      ->selectFieldOption('Label', '- Hidden -');
    $this
      ->getSession()
      ->getPage()
      ->selectFieldOption('Formatter', 'Add to cart form');
  });
  $save_layout = $this
    ->getSession()
    ->getPage()
    ->findButton('Save layout');
  $save_layout
    ->focus();
  $save_layout
    ->click();
  $this
    ->assertSession()
    ->pageTextContains('The layout has been saved.');
}