.../tests/src/Functional/NodeTranslationUITest.php | 6 ++- .../Functional/PageCacheTagsIntegrationTest.php | 3 ++ .../src/Tests/Installer/StandardInstallerTest.php | 7 +-- core/profiles/standard/standard.info.yml | 1 + .../StandardJavascriptTest.php | 62 ++++++++++++++++++++++ 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 @@ 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. 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..8dfed02 --- /dev/null +++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php @@ -0,0 +1,62 @@ +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]')); + } + +}