InlineFormErrorsIntegrationTest.php in Drupal 10
File
core/modules/quickedit/tests/src/FunctionalJavascript/InlineFormErrorsIntegrationTest.php
View source
<?php
namespace Drupal\Tests\quickedit\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\node\Entity\NodeType;
class InlineFormErrorsIntegrationTest extends WebDriverTestBase {
protected static $modules = [
'quickedit',
'node',
'inline_form_errors',
];
protected $defaultTheme = 'classy';
protected $editorUser;
protected function setUp() : void {
parent::setUp();
NodeType::create([
'type' => 'page',
'name' => 'page',
])
->save();
$permissions = [
'access content',
'create page content',
'edit any page content',
'access contextual links',
'access in-place editing',
];
$this->editorUser = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($this->editorUser);
}
public function testDisabledInlineFormErrors() {
$session = $this
->getSession();
$web_assert = $this
->assertSession();
$node = $this
->drupalCreateNode();
$this
->drupalGet('node/' . $node
->id());
$web_assert
->waitForElement('css', '.quickedit > a');
$session
->executeScript("jQuery('article.node').find('.quickedit > a').click()");
$web_assert
->waitForElement('css', '.quickedit-toolbar');
$session
->executeScript("jQuery('.field--name-title').text('').trigger('keyup')");
$save_button = $web_assert
->waitForElement('css', '.action-save.quickedit-button');
$save_button
->click();
$web_assert
->assertWaitOnAjaxRequest();
$web_assert
->elementTextNotContains('css', '.quickedit-validation-errors', '1 error has been found');
$web_assert
->elementTextContains('css', '.quickedit-validation-errors', 'Title field is required.');
}
}