You are here

public function BrowserTestBaseTest::testAssertField in Drupal 9

Tests legacy field asserts using textfields.

@group legacy

File

core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php, line 411

Class

BrowserTestBaseTest
Tests BrowserTestBase functionality.

Namespace

Drupal\FunctionalTests

Code

public function testAssertField() {
  $this
    ->expectDeprecation('AssertLegacyTrait::assertField() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldExists() or $this->assertSession()->buttonExists() instead. See https://www.drupal.org/node/3129738');
  $this
    ->expectDeprecation('AssertLegacyTrait::assertNoField() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldNotExists() or $this->assertSession()->buttonNotExists() instead. See https://www.drupal.org/node/3129738');
  $this
    ->drupalGet('test-field-xpath');
  $this
    ->assertField('name');
  $this
    ->assertNoField('invalid_name_and_id');
}