Commit 113c6dc2 authored by xjm's avatar xjm

Issue #2840392 by Wim Leers, JacobSanford, Yogesh Pawar, dawehner, xjm,...

Issue #2840392 by Wim Leers, JacobSanford, Yogesh Pawar, dawehner, xjm, effulgentsia, Mixologic, Bojhan, webchick, Gábor Hojtsy, yoroy: Enable BigPipe by default in the Standard install profile
parent c74c39e1
......@@ -21,13 +21,15 @@ class NodeTranslationUITest extends ContentTranslationUITestBase {
*/
protected $defaultCacheContexts = [
'languages:language_interface',
'session',
'theme',
'route',
'timezone',
'url.path.parent',
'url.query_args:_wrapper_format',
'user'
'user.roles',
// These two cache contexts are added by BigPipe.
'cookies:big_pipe_nojs',
'session.exists',
];
/**
......
......@@ -76,6 +76,9 @@ public function testPageCacheTags() {
// condition.
'url.path',
'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT,
// These two cache contexts are added by BigPipe.
'cookies:big_pipe_nojs',
'session.exists',
];
// Full node page 1.
......
......@@ -18,11 +18,8 @@ class StandardInstallerTest extends ConfigAfterInstallerTestBase {
* Ensures that the user page is available after installation.
*/
public function testInstaller() {
// Verify that the confirmation message appears.
require_once \Drupal::root() . '/core/includes/install.inc';
$this->assertRaw(t('Congratulations, you installed @drupal!', [
'@drupal' => drupal_install_profile_distribution_name(),
]));
// Verify that the Standard install profile's default frontpage appears.
$this->assertRaw('No front page content has been created yet.');
}
/**
......
......@@ -26,6 +26,7 @@ dependencies:
- path
- page_cache
- dynamic_page_cache
- big_pipe
- taxonomy
- dblog
- search
......
<?php
namespace Drupal\Tests\standard\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
use Drupal\node\Entity\Node;
/**
* Tests Standard installation profile JavaScript expectations.
*
* @group standard
*/
class StandardJavascriptTest extends JavascriptTestBase {
/**
* {@inheritdoc}
*/
protected $profile = 'standard';
/**
* Tests BigPipe accelerates particular Standard installation profile routes.
*/
public function testBigPipe() {
$this->drupalLogin($this->drupalCreateUser([
'access content',
'post comments',
'skip comment approval',
]));
$node = Node::create(['type' => 'article'])
->setTitle($this->randomMachineName())
->setPromoted(TRUE)
->setPublished(TRUE);
$node->save();
// Front page: one placeholder, for messages.
$this->drupalGet('');
$this->assertBigPipePlaceholderReplacementCount(1);
// Node page: 3 placeholders:
// 1. messages
// 2. local tasks block
// 3. comment form
$this->drupalGet($node->toUrl());
$this->assertBigPipePlaceholderReplacementCount(3);
}
/**
* Asserts the number of BigPipe placeholders that are replaced on the page.
*
* @param int $expected_count
* The expected number of BigPipe placeholders.
*/
protected function assertBigPipePlaceholderReplacementCount($expected_count) {
$web_assert = $this->assertSession();
$web_assert->waitForElement('css', 'script[data-big-pipe-event="stop"]');
$page = $this->getSession()->getPage();
$this->assertCount($expected_count, $this->getDrupalSettings()['bigPipePlaceholderIds']);
$this->assertCount($expected_count, $page->findAll('css', 'script[data-big-pipe-replacement-for-placeholder-with-id]'));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment