From c7667c636bd9cdff93fefcd6c41ccfbe24a1b490 Mon Sep 17 00:00:00 2001
From: DYdave <DYdave@467284.no-reply.drupal.org>
Date: Thu, 20 Feb 2025 12:18:10 +0100
Subject: [PATCH] Issue #3508173 by dydave: Fixed GitLab CI configuration
 causing jobs to fail and adjusted 'AdminToolbarSettingsFormTest' to be
 compatible with supported versions.

---
 .gitlab-ci.yml                                | 23 +++++++++++++++----
 .../AdminToolbarSettingsFormTest.php          |  4 ++--
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 778fe90..0b170d3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,19 +12,32 @@
 # To test a Drupal 7 project, change the first include filename from .main.yml to .main-d7.yml
 include:
   - project: $_GITLAB_TEMPLATES_REPO
-    # Keep reference on 1.5.10 to support testing against actual current versions of Drupal.
-    ref: "1.5.10"
+    ref: $_GITLAB_TEMPLATES_REF
     file:
-      - "/includes/include.drupalci.main.yml"
-      - "/includes/include.drupalci.variables.yml"
-      - "/includes/include.drupalci.workflows.yml"
+      - '/includes/include.drupalci.main.yml'
+      - '/includes/include.drupalci.variables.yml'
+      - '/includes/include.drupalci.workflows.yml'
 
 ################
 # Pipeline configuration variables are defined with default values and descriptions in the file
 # https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
 # Uncomment the lines below if you want to override any of the variables. The following is just an example.
 ################
+# variables:
+#   SKIP_ESLINT: '1'
+#   OPT_IN_TEST_NEXT_MAJOR: '1'
+#   _CURL_TEMPLATES_REF: 'main'
+
+################
+# Admin Toolbar: Pipeline configuration variables and custom jobs, mostly:
+#  - Broaden test coverage to all supported core versions and max PHP.
+#  - Require jobs to pass: PHPCS and Stylelint.
+################
+
 variables:
+  ################
+  # Opt in variables: Broaden test coverage.
+  ################
   OPT_IN_TEST_PREVIOUS_MAJOR: 1
   OPT_IN_TEST_PREVIOUS_MINOR: 1
   OPT_IN_TEST_NEXT_MINOR: 1
diff --git a/tests/src/Functional/AdminToolbarSettingsFormTest.php b/tests/src/Functional/AdminToolbarSettingsFormTest.php
index cbffcbb..31af055 100644
--- a/tests/src/Functional/AdminToolbarSettingsFormTest.php
+++ b/tests/src/Functional/AdminToolbarSettingsFormTest.php
@@ -75,8 +75,8 @@ class AdminToolbarSettingsFormTest extends BrowserTestBase {
     $assert->elementNotExists('xpath', '//div[@class="toolbar-menu-administration"]//ul[contains(@class, "toolbar-menu")]//li[contains(@class, "menu-item")]//ul[@class="toolbar-menu"]//li[contains(@class, "menu-item")]//ul[@class="toolbar-menu"]//li[@class="menu-item"]//a[contains(@href, "/admin/config/user-interface/admin-toolbar") and contains(.,"Admin Toolbar")]');
     // Check the menu item 'User interface' does not have a child 'ul'.
     $assert->elementNotExists('xpath', '//div[@class="toolbar-menu-administration"]//ul[contains(@class, "toolbar-menu")]//li[contains(@class, "menu-item")]//ul[@class="toolbar-menu"]//li[contains(@class, "menu-item")]//ul');
-    // Check the menu item 'User interface' contains a link but not a menu item.
-    $assert->elementExists('xpath', '//div[@class="toolbar-menu-administration"]//ul[contains(@class, "toolbar-menu")]//li[contains(@class, "menu-item")]//ul[@class="toolbar-menu"]//li[contains(@class, "menu-item") and contains(a, .) and not(contains(ul, .))]');
+    // Check the menu item 'User interface' has a single child 'a' link tag.
+    $assert->elementExists('xpath', '//div[@class="toolbar-menu-administration"]//ul[contains(@class, "toolbar-menu")]//li[contains(@class, "menu-item")]//ul[@class="toolbar-menu"]//li[contains(@class, "menu-item") and count(child::*)=1 and child::*=a]');
 
   }
 
-- 
GitLab