AutofillTest.php in Thunder 8.5
File
tests/src/FunctionalJavascript/Integration/AutofillTest.php
View source
<?php
namespace Drupal\Tests\thunder\FunctionalJavascript\Integration;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\Tests\thunder\FunctionalJavascript\ThunderArticleTestTrait;
use Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase;
class AutofillTest extends ThunderJavascriptTestBase {
use ThunderArticleTestTrait;
use NodeCreationTrait;
public function testAutofill() {
$page = $this
->getSession()
->getPage();
$this
->drupalGet('node/add/article');
$page
->fillField('field_channel', 1);
$page
->fillField('title[0][value]', 'Autofill test title');
$this
->assertSession()
->fieldValueEquals('field_seo_title[0][value]', 'Autofill test title');
$page
->findButton('Save')
->click();
$this
->assertSession()
->elementContains('xpath', '//head/title', 'Autofill test title');
$node = $this
->getNodeByTitle('Autofill test title');
$edit_url = $node
->toUrl('edit-form');
$this
->drupalGet($edit_url);
$page
->fillField('title[0][value]', 'My adjusted autofill test title');
$this
->assertSession()
->fieldValueEquals('field_seo_title[0][value]', 'My adjusted autofill test title');
$page
->fillField('field_seo_title[0][value]', 'Override seo title');
$page
->fillField('title[0][value]', 'Change title');
$this
->assertSession()
->fieldValueEquals('field_seo_title[0][value]', 'Override seo title');
}
}