Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / node / tests / src / FunctionalJavascript / TestSettingSummariesContentType.php
1 <?php
2
3 namespace Drupal\Tests\node\FunctionalJavascript;
4
5 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
6
7 /**
8  * Tests the JavaScript updating of summaries on content type form.
9  *
10  * @group node
11  */
12 class TestSettingSummariesContentType extends WebDriverTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   public static $modules = ['node'];
18
19   /**
20    * {@inheritdoc}
21    */
22   public function setUp() {
23     parent::setUp();
24
25     $admin_user = $this->drupalCreateUser(['administer content types']);
26     $this->drupalLogin($admin_user);
27     $this->drupalCreateContentType(['type' => 'test']);
28   }
29
30   /**
31    * Test a vertical tab 'Workflow' summary.
32    */
33   public function testWorkflowSummary() {
34     $this->drupalGet('admin/structure/types/manage/test');
35     $page = $this->getSession()->getPage();
36     $page->find('css', 'a[href="#edit-workflow"]')->click();
37     $this->assertSession()->waitForElementVisible('css', '[name="options[status]"]');
38     $page->findField('options[status]')->uncheck();
39     $page->findField('options[sticky]')->check();
40     $page->findField('options[promote]')->check();
41     $page->findField('options[revision]')->check();
42     $locator = '[href="#edit-workflow"] .vertical-tabs__menu-item-summary';
43     $page->waitFor(10, function () use ($page, $locator) {
44       $summary = $page->find('css', $locator)->getText();
45       return strpos('Not published', $summary) !== FALSE;
46     });
47     $summary = $page->find('css', $locator)->getText();
48     $this->assertEquals('Not published, Promoted to front page, Sticky at top of lists, Create new revision', $summary);
49   }
50
51 }