From b9c9f19b285380e30afd5f734c7eb6ea5e5644f5 Mon Sep 17 00:00:00 2001 From: Adam G-H <32250-phenaproxima@users.noreply.drupalcode.org> Date: Mon, 12 Jun 2023 20:56:16 +0000 Subject: [PATCH] Issue #3366267 by phenaproxima, tedbow: Change build tests to install Standard profile --- .../src/Build/TemplateProjectTestBase.php | 2 +- tests/src/Build/CoreUpdateTest.php | 19 +++++++++---------- tests/src/Build/UpdateTestBase.php | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/package_manager/tests/src/Build/TemplateProjectTestBase.php b/package_manager/tests/src/Build/TemplateProjectTestBase.php index 1fe602e452..317a8173da 100644 --- a/package_manager/tests/src/Build/TemplateProjectTestBase.php +++ b/package_manager/tests/src/Build/TemplateProjectTestBase.php @@ -346,7 +346,7 @@ END; } // Install Drupal. - $this->installQuickStart('minimal'); + $this->installQuickStart('standard'); $this->formLogin($this->adminUsername, $this->adminPassword); // When checking for updates, we need to be able to make sub-requests, but diff --git a/tests/src/Build/CoreUpdateTest.php b/tests/src/Build/CoreUpdateTest.php index 8b3c3d4877..8bffd57934 100644 --- a/tests/src/Build/CoreUpdateTest.php +++ b/tests/src/Build/CoreUpdateTest.php @@ -172,14 +172,6 @@ class CoreUpdateTest extends UpdateTestBase { */ public function testCron(string $template): void { $this->createTestProject($template); - // Install dblog so we can check if any errors were logged during the update. - // This implies one can only retrieve log entries through the dblog UI. This - // seems non-ideal but it is the choice that requires least custom - // configuration or custom code. Using the `syslog` or `syslog_test` module - // or the `@RestResource=dblog` plugin for the `rest` module require - // more additional code than the inflexible log querying via - // `/admin/reports/dblog` below. - $this->installModules(['dblog']); $this->visit('/admin/reports/status'); $mink = $this->getMink(); @@ -192,6 +184,12 @@ class CoreUpdateTest extends UpdateTestBase { // There should be log messages, but no errors or warnings should have been // logged by Automatic Updates. + // The use of the database log here implies one can only retrieve log + // entries through the dblog UI. This seems non-ideal but it is the choice + // that requires least custom configuration or custom code. Using the + // `syslog` or `syslog_test` module or the `@RestResource=dblog` plugin for + // the `rest` module require more additional code than the inflexible log + // querying below. $this->visit('/admin/reports/dblog'); $assert_session->pageTextNotContains('No log messages available.'); $page->selectFieldOption('Type', 'automatic_updates'); @@ -205,8 +203,9 @@ class CoreUpdateTest extends UpdateTestBase { // Ensure that the update occurred. $page->selectFieldOption('Severity', 'Info'); $page->pressButton('Filter'); - $assert_session->elementsCount('css', '#admin-dblog tbody tr', 1); - $assert_session->elementTextContains('css', '#admin-dblog tr:nth-of-type(1) td:nth-of-type(4)', 'Drupal core has been updated from 9.8.0 to 9.8.1'); + // There should be a log entry about the successful update. + $log_entry = $assert_session->elementExists('named', ['link', 'Drupal core has been updated from 9.8.0 to 9.8.1']); + $this->assertStringContainsString('/admin/reports/dblog/event/', $log_entry->getAttribute('href')); $this->assertUpdateSuccessful('9.8.1'); // \Drupal\automatic_updates\Routing\RouteSubscriber::alterRoutes() sets // `_automatic_updates_status_messages: skip` on the route for the path diff --git a/tests/src/Build/UpdateTestBase.php b/tests/src/Build/UpdateTestBase.php index c507716688..7a960713f9 100644 --- a/tests/src/Build/UpdateTestBase.php +++ b/tests/src/Build/UpdateTestBase.php @@ -29,6 +29,18 @@ END; 'automatic_updates', 'automatic_updates_test_api', ]); + + // Uninstall Automated Cron, which is not supported by Automatic Updates. + // Also uninstall Big Pipe, since it may cause page elements to be rendered + // in the background and replaced with JavaScript, which isn't supported in + // build tests. + // @see \Drupal\automatic_updates\Validator\AutomatedCronDisabledValidator + $page = $this->getMink()->getSession()->getPage(); + $this->visit('/admin/modules/uninstall'); + $page->checkField("uninstall[automated_cron]"); + $page->checkField('uninstall[big_pipe]'); + $page->pressButton('Uninstall'); + $page->pressButton('Uninstall'); } /** @@ -71,7 +83,7 @@ END; $page = $mink->getSession()->getPage(); $page->clickLink('Rerun readiness checks'); - $readiness_check_summaries = $page->findAll('css', 'summary:contains("Update readiness checks")'); + $readiness_check_summaries = $page->findAll('css', '*:contains("Update readiness checks")'); // There should always either be the summary section indicating the site is // ready for automatic updates or the error or warning sections. $this->assertNotEmpty($readiness_check_summaries); @@ -83,7 +95,7 @@ END; $ready_text_found = TRUE; continue; } - $description_list = $parent_element->find('css', 'div.description ul'); + $description_list = $parent_element->find('css', 'ul'); $this->assertNotEmpty($description_list); $status_checks_text .= "\n" . $description_list->getText(); } -- GitLab