public function ConditionalFieldLinkFieldTest::testVisibleFilled in Conditional Fields 8
Same name and namespace in other branches
- 4.x tests/src/FunctionalJavascript/ConditionalFieldLinkFieldTest.php \Drupal\Tests\conditional_fields\FunctionalJavascript\ConditionalFieldLinkFieldTest::testVisibleFilled()
The target field is Visible when the control field is Filled.
Overrides ConditionalFieldFilledEmptyInterface::testVisibleFilled
File
- tests/
src/ FunctionalJavascript/ ConditionalFieldLinkFieldTest.php, line 444
Class
- ConditionalFieldLinkFieldTest
- Test Conditional Fields Link field plugin.
Namespace
Drupal\Tests\conditional_fields\FunctionalJavascriptCode
public function testVisibleFilled() {
$this
->baseTestSteps();
$url = 'https://drupal.org';
// Visit a ConditionalFields configuration page for Content bundles.
$this
->createCondition('body', $this->fieldName, 'visible', '!empty');
$this
->createScreenshot($this->screenshotPath . '01-testFieldLinkVisibleValueNot.png');
$this
->createScreenshot($this->screenshotPath . '02-testFieldLinkVisibleValueNot.png');
// Check if that configuration is saved.
$this
->drupalGet('admin/structure/types/manage/article/conditionals');
$this
->createScreenshot($this->screenshotPath . '03-testFieldLinkVisibleValueNot.png');
$this
->assertSession()
->pageTextContains('body ' . $this->fieldName . ' visible !empty');
// Visit Article Add form to check that conditions are applied.
$this
->drupalGet('node/add/article');
// Check that the field Body is visible.
$this
->createScreenshot($this->screenshotPath . '04-testFieldLinkVisibleValueNot.png');
$this
->waitUntilHidden('.field--name-body', 50, '01. Article Body field is visible');
// Change a link that should not show the body.
$this
->changeField($this->fieldSelector, $url);
$this
->createScreenshot($this->screenshotPath . '05-testFieldLinkVisibleValueNot.png');
$this
->waitUntilVisible('.field--name-body', 50, '02. Article Body field is not visible');
// Change a link value to show the body.
$this
->changeField($this->fieldSelector, '');
$this
->createScreenshot($this->screenshotPath . '08-testFieldLinkVisibleValueNot.png');
$this
->waitUntilHidden('.field--name-body', 50, '03. Article Body field is visible');
}