TestSettingSummariesContentType.php 1.6 KB

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