Problem/Motivation

There are several tests that have references to Bartik and Seven:

      3 core/modules/help_topics/tests/src/Functional/HelpTopicTest.php
   3 core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
   1 core/modules/help_topics/tests/src/Functional/HelpTopicsSyntaxTest.php

These tests should be updated to either use Olivero, Claro, or System module's test_theme so we can deprecate Bartik #3249109: Deprecate Bartik and Seven #3084814: Deprecate Seven theme as mentioned at #3278124: Convert various tests that use bartik/seven to olivero/claro.

Steps to reproduce

git grep -E '(bartik)|(seven)' -- 'core/modules/help_topics/tests' | awk -F: '{print $1}' | sort | uniq -c should return no results when this work is complete.

Remaining tasks

Update the tests.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

I don't think we need release notes or a change record.

Issue fork drupal-3281439

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deviantintegral created an issue. See original summary.

deviantintegral’s picture

Issue summary: View changes
deviantintegral’s picture

_shY’s picture

Status: Active » Needs review
FileSize
3.19 KB

Replaced references to the Seven and Bartik.

Status: Needs review » Needs work

The last submitted patch, 4: 3281439-4.patch, failed testing. View results

_shY’s picture

Status: Needs work » Needs review
FileSize
4.09 KB

Reworked patch. Correction for the warning message, seems like for the Claro theme they a bit different.

Status: Needs review » Needs work

The last submitted patch, 6: 3281439-6.patch, failed testing. View results

andregp’s picture

@_shY just a tip for you. It's always a good practice to provide an interdiff between the new patch and the last one so other developers can see clearly what you changed in the code. :)

andregp’s picture

This is what I discovered so far about this issue.

By using the new themes, the element's markup gets completely different and this is part or the reason why the HelpTopicSearchTest.php is failing.
Checking the code and the pages' HTML from inside the tests, I noticed that when we use the method statusMessageContains('some text', 'warning'); it internally calls for buildStatusMessageSelector() that creates a selector like //div[@data-drupal-messages]//div[contains(@aria-label, "Warning message") (you can see an image of the selector builder attached).

The problem is not that the warning message is different with the new themes, but the warning element markup is different (image attached) and because statusMessageContains() internally uses a predetermined xpath selector this method can't find the selector. Fortunately we still can check for the warning message by another way, like by replacing

$this->assertSession()->statusMessageContains('Help search is not fully indexed', 'warning');

with

$this->assertSession()->elementTextContains('xpath', '//div[@data-drupal-messages]//div[contains(@aria-labelledby, "message-warning-title")]', 'Help search is not fully indexed');

It would be nice if that was the only problem (replacing the statusMessageContains() methods), but another problem I found is that the search/help page looses the search field with the provided patch (image attached), and I wasn't able to fix this.

andregp’s picture

This is a partial patch that fixes the setUp() method and 2 of the 3 tests in HelpTopicSearchTest.php. It still needs work for the testHelpSearch() though.

daffie’s picture

deviantintegral’s picture

Here's an update that:

  1. Adds the missing "Search help" block for the Claro theme, which lets a test pass when we convert it to Claro.
  2. Uses the above hints on xpaths for asserting additional status messages (thanks!)
  3. Updates other tests to use stark, updating the HTML assertions as well.
  4. Switches an assertion for help topic scanning to Claro.

The last submitted patch, 12: 3281439-12.patch, failed testing. View results

deviantintegral’s picture

I converted this to a merge request and fixed the last test failure. This is now ready for review.

Spokje made their first commit to this issue’s fork.

nod_’s picture

Status: Needs review » Needs work

added a comment on the MR + needs a reroll

Spokje’s picture

Spokje’s picture

nod_’s picture

Status: Needs work » Reviewed & tested by the community

Works for me :) thanks

nod_’s picture

Status: Reviewed & tested by the community » Needs work

Need to fix the 9.5 test failures :/

Spokje’s picture

Assigned: Unassigned » Spokje

Missing file in the d9.5 patch, hang on.

Spokje’s picture

FileSize
661 bytes
6.65 KB
Spokje’s picture

Assigned: Spokje » Unassigned
Status: Needs work » Needs review
nod_’s picture

Status: Needs review » Reviewed & tested by the community

all good, thanks :)

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php
@@ -68,7 +68,7 @@ protected function setUp(): void {
-    $this->assertSession()->statusMessageContains('Help search is not fully indexed', 'warning');
+    $this->assertSession()->statusMessageContains('Help search is not fully indexed');

@@ -261,7 +261,7 @@ public function testUninstall() {
-    $this->assertSession()->statusMessageContains('The selected modules have been uninstalled.', 'status');
+    $this->assertSession()->statusMessageContains('The selected modules have been uninstalled.');

@@ -278,7 +278,7 @@ public function testUninstallSearch() {
-    $this->assertSession()->statusMessageContains('The selected modules have been uninstalled.', 'status');
+    $this->assertSession()->statusMessageContains('The selected modules have been uninstalled.');

Removing the status message type essentially leads into lost test coverage. I think we need to update \Drupal\Tests\WebAssert::buildStatusMessageSelector so that it works with Claro 😬

nod_’s picture

Status: Needs work » Needs review

updated the 10.x branch to fix the buildStatusMessageSelector method to work with claro

nod_’s picture

Added a comment

aarti zikre’s picture

FileSize
21.64 KB

Verified merge request for Drupal 9.5.x dev version
https://git.drupalcode.org/project/drupal/-/merge_requests/2476

Testing Steps:
* Install a new Drupal instance
* Add & fetch this issue fork’s repository using
git remote add drupal-3281439 git@git.drupal.org:issue/drupal-3281439.git
git fetch drupal-3281439
* Switch to that branch
git checkout 3281439-update-help-topics
* Clear all catches
* Run git grep -E '(bartik)|(seven)' -- 'core/modules/help_topics/tests' | awk -F: '{print $1}' | sort | uniq -c

Test Result:
This git command return nothing which is expected behaviour
Refer SS
2022-07-18/3281439 MR test.png

MR result Pass.
Can be move to RTBC.

aarti zikre’s picture

Status: Needs review » Reviewed & tested by the community
lauriii’s picture

Status: Reviewed & tested by the community » Needs work

Posted some feedback on the MR.

nod_’s picture

Status: Needs work » Reviewed & tested by the community

adressed feedback, should still be green but waiting on what testbot says.

  • catch committed b039939 on 10.0.x
    Issue #3281439 by nod_, Spokje, deviantintegral, _shY, andregp, lauriii...
  • catch committed 0ec6766 on 10.1.x
    Issue #3281439 by nod_, Spokje, deviantintegral, _shY, andregp, lauriii...
  • catch committed 30b945b on 9.5.x
    Issue #3281439 by nod_, Spokje, deviantintegral, _shY, andregp, lauriii...
catch’s picture

Version: 10.0.x-dev » 9.5.x-dev
Status: Reviewed & tested by the community » Fixed

@aarti zikre DrupalCI already indicates whether the MR applies or not, to set something RTBC you should also indicate that you've read the code and that it looks OK. Additionally there's no need to provide a screenshot of command line output. I've removed commit credit for this issue but hopefully it will help for the next one.

Committed/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.