Page MenuHomePhabricator

Update DiscussionTools integration tests' input files to reflect current wikitext parser output
Open, Needs TriagePublic

Description

(I'm filing this task for the TODO comment in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/1004223/5/tests/cases/for-parser-cache-new/for-parser-cache-new.html, because I want to reference this problem elsewhere)

Most of the input files for integration tests in DiscussionTools in /tests/cases were created by saving the HTML generated by MediaWiki when viewing the page with ?action=render (as documented in tests/cases/README.txt)

This was fine when we started the development, but since then several things happened that caused these input files to diverge from reality:

This means that we have to have some workarounds in our discussion parser that only serve to make our own test cases pass, but is not actually used in production. You can find them by searching for "mw-headline", "data-mw-comment", "ext-discussiontools". (Codesearch)

Someone should figure out how to extract the "early stage" wikitext parser HTML from MediaWiki (it's not normally exposed), and then update all of the tests to use it, and then remove the workarounds in the parser. Currently the only "correct" test is for-parser-cache-new.html.

This work probably has to happen after T363030: Remove the mostly unused Parser.js from DiscussionTools, because the JS discussion parser actually expects to run on the "final" HTML with all the extra things.