I see text is unreliable in Drupal 11

Created on 8 August 2025, 21 days ago

I had a Drupal 10 project with about 200 long behat tests. All behats were green.
I did a cleanup upgrade to Drupal 11, and a lot of my behats start failing.

It's in the step "I see the text".

I also have "behat drevops" installed for automatic screenshots. The behats that fail, fail on the step "I see the text"; but looking in the screenshot file the exact text is there, visibly.

I have a custom step that checks more specific areas of page for text, and that still works. So in:

Then the element with class "td.views-field.views-field-title" should contain the text "D-2021"
Then I see the text "D-2021"

The first line works, behat fails on the second. But the first line proofs that D-2021 is really in the html output. And that it's also not a bigpipe timing issue or so (because else the first line would also fail).

My current working theory is that something that changed in Drupal D11 is breaking the "I see the text" step. I using drupal-extension 5.5.0 on Drupal 11.

🐛 Bug report
Status

Active

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sboden
  • I debugged both Drupal 10 and Drupal 11.

    The results:
    In WebAssert.php method pageTextContains(), there's following line to get the contents of the page:

    $actual = $this->session->getPage()->getText();
    

    And in Drupal 10 the responsive tables on the page are in $actual. While in Drupal 11 using the exact same code and database, the responsive tables seem to be filtered out.

    When I do a local hack to:

    $actual = $this->session->getDriver()->getContent();
    

    it usually works, but also not in all cases as that will output the contents as html. If you have text that crosses tags that it also fails.
    So the change is "damned if you, damned if you don't".

    It's a small change behaviour, which is going to cause a lot of rework for a lot of people.

Production build 0.71.5 2024