function CollapsedSummariesTest::testSummaries

Same name in other branches
  1. 9 core/modules/node/tests/src/FunctionalJavascript/CollapsedSummariesTest.php \Drupal\Tests\node\FunctionalJavascript\CollapsedSummariesTest::testSummaries()
  2. 11.x core/modules/node/tests/src/FunctionalJavascript/CollapsedSummariesTest.php \Drupal\Tests\node\FunctionalJavascript\CollapsedSummariesTest::testSummaries()

Confirm that summaries are provided for node meta at all widths.

File

core/modules/node/tests/src/FunctionalJavascript/CollapsedSummariesTest.php, line 48

Class

CollapsedSummariesTest
Tests that outlines of node meta values are displayed in summaries and tabs.

Namespace

Drupal\Tests\node\FunctionalJavascript

Code

public function testSummaries() : void {
    $page = $this->getSession()
        ->getPage();
    $assert_session = $this->assertSession();
    // At a wider width, vertical tabs are used for the meta section of the node
    // form.
    $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());
    // At a narrower width, details are used for the meta section of the node
    // form.
    $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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.