This PR refactors our GUI apptests
so that it uses regex search to find values in our console/qtextedit output regardless if it is in plaintext
, html
, or markdown
.
This introduces a new function FindInConsole
which uses QRegularExpression to search the output of the console. The function must be provided with a perl compatible regex pattern which wants to match a single group. The function then returns the matched group. If no match is found, an empty QString
is returned.
We then use this new function in TestRpcCommand
to find the current chain
value instead of reading with univalue.
This approach can apply to a wider variety of testing scenarios as we can reuse this function to search for values when the console output is exported in a different format than plaintext
. As an example, A follow up PR will add tests for console resizing and needs to look for the size in html
tags after exporting the console text with toHtml()
.