summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxjm2017-11-05 17:35:17 -0600
committerxjm2017-11-05 17:35:17 -0600
commit113c6dc25827ec24dcaa5171d47c1c3929d5dff6 (patch)
treeb6bccae1d07b1f64f842b8be6d5d71222de3f031
parentc74c39e13327809f442a0b309b7a995da8a9c6fa (diff)
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
-rw-r--r--core/modules/node/tests/src/Functional/NodeTranslationUITest.php6
-rw-r--r--core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php3
-rw-r--r--core/modules/system/src/Tests/Installer/StandardInstallerTest.php7
-rw-r--r--core/profiles/standard/standard.info.yml1
-rw-r--r--core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php62
5 files changed, 72 insertions, 7 deletions
diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
index a44bea1..fa0ad13 100644
--- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
+++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
@@ -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',
];
/**
diff --git a/core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php b/core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php
index 5f84a34..48861f9 100644
--- a/core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php
+++ b/core/modules/page_cache/tests/src/Functional/PageCacheTagsIntegrationTest.php
@@ -76,6 +76,9 @@ class PageCacheTagsIntegrationTest extends BrowserTestBase {
// 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.
diff --git a/core/modules/system/src/Tests/Installer/StandardInstallerTest.php b/core/modules/system/src/Tests/Installer/StandardInstallerTest.php
index b0ceef9..3132be2 100644
--- a/core/modules/system/src/Tests/Installer/StandardInstallerTest.php
+++ b/core/modules/system/src/Tests/Installer/StandardInstallerTest.php
@@ -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.');
}
/**
diff --git a/core/profiles/standard/standard.info.yml b/core/profiles/standard/standard.info.yml
index 82af32e..7fbaec6 100644
--- a/core/profiles/standard/standard.info.yml
+++ b/core/profiles/standard/standard.info.yml
@@ -26,6 +26,7 @@ dependencies:
- path
- page_cache
- dynamic_page_cache
+ - big_pipe
- taxonomy
- dblog
- search
diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php
new file mode 100644
index 0000000..81cc148
--- /dev/null
+++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php
@@ -0,0 +1,62 @@
+<?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]'));
+ }
+
+}