function TestSettingSummariesContentType::testWorkflowSummary

Test a vertical tab 'Workflow' summary.

File

core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php, line 38

Class

TestSettingSummariesContentType
Tests the JavaScript updating of summaries on content type form.

Namespace

Drupal\Tests\node\FunctionalJavascript

Code

public function testWorkflowSummary() {
    $this->drupalGet('admin/structure/types/manage/test');
    $page = $this->getSession()
        ->getPage();
    $page->find('css', 'a[href="#edit-workflow"]')
        ->click();
    $this->assertSession()
        ->waitForElementVisible('css', '[name="options[status]"]');
    $page->findField('options[status]')
        ->uncheck();
    $page->findField('options[sticky]')
        ->check();
    $page->findField('options[promote]')
        ->check();
    $page->findField('options[revision]')
        ->check();
    $locator = '[href="#edit-workflow"] .vertical-tabs__menu-item-summary';
    $page->waitFor(10, function () use ($page, $locator) {
        $summary = $page->find('css', $locator)
            ->getText();
        return strpos('Not published', $summary) !== FALSE;
    });
    $summary = $page->find('css', $locator)
        ->getText();
    $this->assertEquals('Not published, Promoted to front page, Sticky at top of lists, Create new revision', $summary);
}

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