- Issue created by @dydave
- Merge request !115Issue #3508173 by dydave: Fixed GitLab CI configuration causing jobs to fail... → (Merged) created by dydave
- 🇫🇷France dydave
Quick follow-up on this issue:
Reverted the GitLab CI configuration file to use an exact copy of the current template at:
https://git.drupalcode.org/project/gitlab_templates/-/blob/main/gitlab-c...
(copy/pasted)After reverting the config file, the following PHPUNIT Tests error appeared, see build:
https://git.drupalcode.org/issue/admin_toolbar-3466125/-/pipelines/4297021) Drupal\Tests\admin_toolbar\Functional\AdminToolbarSettingsFormTest::testAdminToolbarSettingsForm Behat\Mink\Exception\ElementNotFoundException: Element matching 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, .))]" not found. /builds/issue/admin_toolbar-3466125/vendor/behat/mink/src/WebAssert.php:465 /builds/issue/admin_toolbar-3466125/tests/src/Functional/AdminToolbarSettingsFormTest.php:79
Corresponding to the following check with
xpath
:// 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, .))]');
I'm really not sure why this XPath expression works fine (passes) with
- Previous major: 10.4.2
- Previous minor: 11.0.8
But fails with:- Next minor: 11.x-dev 134af09 (11.2.x)
- PHP:8.3/8.4, Core stable: 11.1.2
... very confusing ...Maybe something changed with the PHPUnit libraries with different versions, or maybe in Drupal Core from version 11.1.x something changed with the way XPath expressions are evaluated?!
I don't really know what could have changed and didn't look any further than that...
Instead, I decided to try different XPath combinations and opted to change the expression:
- from:
li
node containsa
node and notul
- to:
li
node has exactly one child which is ana
link tag.
Resulting in the following expression:// 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]');
Which seemed to solve all PHPUnit tests 🥳
At this point, all the jobs came back to passing green 🟢 \o/
https://git.drupalcode.org/project/admin_toolbar/-/pipelines/430264Except the ones we already knew still had warnings:
- ESLint: see 📌 GitlabCI: Fix ESLINT validation errors Active
- PHPSTAN Next minor (11.2): that's a new one with deprecation errors, to be addressed in a separate issue (Out of scope).
Since the merge request has absolutely no change impacting the actual module's code, I went ahead and merged the changes at #3.The latest 3.x build is now back to where it was before the template version was pinned, with almost all of the build jobs passing 🟢.
https://git.drupalcode.org/project/admin_toolbar/-/pipelines/430273Marking this issue Fixed at this point.
If any more changes or fixes are needed, they should be addressed in new issues.Feel free to let us know if you have any questions or concerns on any aspects of the latest code changes, this issue, or the project in general, we would surely be glad to provide additional information.
Thanks in advance for your feedback and comments! Automatically closed - issue fixed for 2 weeks with no activity.