UI test logger has wrong expectations on vertical tabs
Ilmari Lauhakangas
ilmari.lauhakangas at libreoffice.org
Wed Dec 1 18:45:23 UTC 2021
I was going to write a small Python UI test concerning Writer hyperlink
tab focus and decided to try our test logger. It turns out the
log-to-test converter expects some UI element ID values to be numeric
while they are not. I couldn't figure out how to fix it.
I followed
https://wiki.documentfoundation.org/Development/UITests#Tools_for_writing_a_test
Installed python-textx package.
PYTHONPATH=/home/user/libreoffice/instdir/program
URE_BOOTSTRAP=file:////home/user/libreoffice/instdir/program/fundamentalrc
LO_COLLECT_UIINFO="test.log" SAL_USE_VCLPLUGIN=gen instdir/program/soffice
Opened Writer and Ctrl-K to insert hyperlink, canceled and quit.
cd uitest/ui_logger_dsl
python dsl_core.py /home/user/libreoffice/instdir/uitest/test.log
/home/user/libreoffice/sw/qa/uitest/hyperlink.py
The log file has a line:
Choose Tab number internet in 'tabcontrol' from
and dsl_core.py fails on the line with:
textx.exceptions.TextXSyntaxError: None:6:19: error: Expected INT at
position /home/user/libreoffice/instdir/uitest/test.log:(6, 19) => 'ab
number *internet i'.
In uitest/ui_logger_dsl/UI_Object_commands.tx we have:
TabControlUIObject:
'Choose Tab number' tab_page_number=INT 'in' tab_id=STRING ('from'
parent_id=ID)?
It doesn't matter, if I change tab_page_number=STRING, it errors saying
it expected STRING as if internet was not a string?!?
In a gdb session I checked the contents of the parameters
break /home/user/libreoffice/vcl/source/uitest/logger.cxx:599
Thread 1 "soffice.bin" hit Breakpoint 1, UITestLogger::logEvent
(this=0x555556cc9510, rDescription=...) at
/home/user/libreoffice/vcl/source/uitest/logger.cxx:600
600 aLogLine = "Choose Tab number " +
GetValueInMapWithIndex(rDescription.aParameters, 0)
(gdb) p rDescription
$1 = (const EventDescription &) @0x7fffffffb1f0: {aKeyWord =
"VerticalTab", aAction = "SELECT", aID = "tabcontrol", aParent = "",
aParameters = std::__debug::map with 1 element = {["POS"] = "internet"}}
Relevant commits:
https://git.libreoffice.org/core/commit/644a775833857955576b5284bf2f1b992d8f5b21
https://git.libreoffice.org/core/commit/f558d810de845ad1dd52632ca0a2cae4733ed6e6
I know this tool is underused, but it would be nice to make sure it
works and maybe we will start using it more :)
Ilmari
More information about the LibreOffice
mailing list