address-8.x-1.x-dev/tests/src/FunctionalJavascript/ZoneTerritoryElementTest.php

tests/src/FunctionalJavascript/ZoneTerritoryElementTest.php
<?php

namespace Drupal\Tests\address\FunctionalJavascript;

use Drupal\FunctionalJavascriptTests\WebDriverTestBase;

/**
 * Tests the address_zone_territory form element.
 *
 * @group address
 */
class ZoneTerritoryElementTest extends WebDriverTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'system',
    'user',
    'field',
    'node',
    'address',
    'address_test',
  ];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * Tests the zone territory form element.
   */
  public function testZoneTerritory() {
    $this->drupalGet('/address_test/zone_territory_test_form');
    $this->getSession()->getPage()->selectFieldOption('territory[country_code]', 'US');
    $this->assertSession()->waitForField('territory[administrative_area]');
    $this->assertSession()->fieldExists('territory[administrative_area]');
    $this->assertSession()->fieldExists('territory[limit_by_postal_code]');
    $this->getSession()->getPage()->checkField('territory[limit_by_postal_code]');
    $this->assertSession()->waitForField('territory[included_postal_codes]');
    $this->assertSession()->fieldExists('territory[included_postal_codes]');
    $this->assertSession()->fieldExists('territory[excluded_postal_codes]');
    $this->submitForm([
      'territory[administrative_area]' => 'SC',
      'territory[included_postal_codes]' => '29601',
      'territory[excluded_postal_codes]' => '29602',
    ], 'Submit');
    $this->assertSession()->pageTextContains('Submitted: US / SC / 29601 / 29602.');
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc