You are here

public function ConditionalFieldsUserTest::testUserEntity in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 tests/src/FunctionalJavascript/Entity/ConditionalFieldsUserTest.php \Drupal\Tests\conditional_fields\FunctionalJavascript\Entity\ConditionalFieldsUserTest::testUserEntity()

Test CF for User CT.

File

tests/src/FunctionalJavascript/Entity/ConditionalFieldsUserTest.php, line 103

Class

ConditionalFieldsUserTest
Test Conditional Fields check User entity.

Namespace

Drupal\Tests\conditional_fields\FunctionalJavascript\Entity

Code

public function testUserEntity() {
  $this
    ->baseTestSteps();
  $this
    ->createCondition($this->dependent, $this->dependee, 'visible', 'checked');

  // Check that configuration is saved.
  $this
    ->drupalGet('admin/structure/conditional_fields/user/user');
  $this
    ->createScreenshot($this->screenshotPath . '01-config-was-added.png');
  $this
    ->assertSession()
    ->pageTextContains($this->dependent . ' ' . $this->dependee . ' visible checked');

  // Visit user register form to check that conditions are applied.
  $this
    ->drupalGet('admin/people/create');
  $this
    ->createScreenshot($this->screenshotPath . '02-mail-not-visible.png');
  $this
    ->waitUntilHidden('.field--name-field-dependent', 50, 'Dependent field is not visible');
  $this
    ->changeSelect('#edit-field-dependee-value', TRUE);
  $this
    ->createScreenshot($this->screenshotPath . '03-mail-visible.png');
  $this
    ->waitUntilVisible('.field--name-field-dependent', 50, 'Dependent field is visible');
}