As I have come to find while writing tests many themes can screw up the testing framework with < span > tags and what not inside the < a > tag. This can be solved by looking for the text directly inside the link element or nested within.

The following will look the same in the browser.


But only the first will work with the assertLink(), assertNoLink(), and clickLink() methods.

#1 855726-nested-text.patch2.14 KBboombatower
PASSED: [[SimpleTest]]: [MySQL] 22,126 pass(es).
[ View ]


boombatower’s picture

Assigned:Unassigned» boombatower
Status:Active» Needs review
new2.14 KB
PASSED: [[SimpleTest]]: [MySQL] 22,126 pass(es).
[ View ]
thedavidmeister’s picture

Version:7.x-dev» 8.x-dev
Assigned:boombatower» Unassigned
Status:Needs review» Needs work
Issue tags:+Needs tests

This is still an issue in D8.

Patch no longer applies in D7.

curl -0 | git apply
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2189  100  2189    0     0   1815      0  0:00:01  0:00:01 --:--:--  2229
error: simpletest/drupal_web_test_case.php: No such file or directory

I feel like this XPath expression that assertLink(), assertNoLink() and clickLink() are all sharing could be centralised rather than duplicating it, but that might be out of scope for this issue.

Could we write tests for this? Assert links in some strings that we know should work but don't because of this bug?

#2094585: [meta] [experimental] Core review bonus for #2072647: #theme 'maintenance_page' should support render arrays in #content.