Possible project for any of the hackathons.
I've seen in multiple projects that browser test pages specify strings with messages from the HTML:
- Example in gather (cant use ids because title changes from skin to skin)
- Example in mobile frontend.
Those messages are brittle because if they change or they get translated differently the tests will break.
i18n messages have good conventions around them, so we should be able to scan and grab the messages from mediawiki core, and from the installed extensions and put them on a hash we can use in the pages (concrete design of the code open to thoughts) so that we can reference elements by text in a solid way that wont break (and also test cross-language tests without trouble).
The idea would be that instead of doing this:
class NotFoundPage include PageObject h1(:title, text: 'Error - Page not found') end
We could do something like (syntax open to discussion):
class NotFoundPage include PageObject h1(:title, text: messages[:en]['mobile-frontend-generic-404-title']) end
And grab the i18n message from the actual json files.
With Zeljko we made a small proof of concept to show it working and serve as inspiration/test : https://gerrit.wikimedia.org/r/#/c/192542/1