CollapsedSummariesTest.php in Drupal 10
File
core/modules/node/tests/src/FunctionalJavascript/CollapsedSummariesTest.php
View source
<?php
namespace Drupal\Tests\node\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class CollapsedSummariesTest extends WebDriverTestBase {
protected static $modules = [
'node',
];
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
$this
->drupalCreateNode([
'title' => $this
->randomMachineName(),
'type' => 'page',
]);
$this
->drupalLogin($this
->createUser([
'edit any page content',
]));
}
public function testSummaries() {
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
$this
->getSession()
->resizeWindow(1200, 1200);
$this
->drupalGet('node/1/edit');
$assert_session
->waitForText("New revision");
$summary = $assert_session
->waitForElement('css', '.vertical-tabs__menu-item-summary');
$this
->assertNotNull($summary);
$this
->assertTrue($summary
->isVisible());
$this
->assertEquals('New revision', $summary
->getText());
$page
->uncheckField('revision');
$assert_session
->waitForText('No revision');
$this
->assertEquals('No revision', $summary
->getText());
$this
->getSession()
->resizeWindow(600, 1200);
$this
->drupalGet('node/1/edit');
$summary = $assert_session
->waitForElement('css', 'span.summary');
$this
->assertNotNull($summary);
$this
->assertTrue($summary
->isVisible());
$page
->uncheckField('revision');
$assert_session
->waitForText('No revision');
$this
->assertEquals('(No revision)', $summary
->getText());
}
}