Page MenuHomePhabricator

Hacking: Load i18n messages from MediaWiki to browser tests
Closed, ResolvedPublic


Possible project for any of the hackathons.

I've seen in multiple projects that browser test pages specify strings with messages from the HTML:

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')

We could do something like (syntax open to discussion):

class NotFoundPage
  include PageObject

  h1(:title, text: messages[:en]['mobile-frontend-generic-404-title'])

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 :

Event Timeline

It is time to promote Wikimedia-Hackathon-2015 activities in the program (training sessions and meetings) and main wiki page (hacking projects and other ongoing activities). Follow the instructions, please. If you have questions, about this message, ask here.

zeljkofilipin renamed this task from Load i18n messages from MediaWiki to browser tests to Hacking: Load i18n messages from MediaWiki to browser tests.May 23 2015, 9:59 AM

Please confirm and promote this activity by assigning it to its owner, listing it or scheduling it at the Hackathon wiki page and by placing it in the right column at #Wikimania-Hackathon-2015. Thank you!

zeljkofilipin lowered the priority of this task from Medium to Low.
zeljkofilipin moved this task from Inbox to Waiting on the Browser-Tests-Infrastructure board.
zeljkofilipin removed a subscriber: Cmcmahon.

@Vikassy and I paired on this today. @Vikassy, please push the patch to gerrit.

What is the status of this task, now that Wikimania 2015 is over? Did this hacking project take place and was successfully finished? If yes: Please provide an update and potentially summarize findings / provide a link to anything relevant (and if the task is not completely finished yet, please move the project to the "Work continues after Mexico City" column on the #Wikimania-Hackathon-2015 workboard). If no: Please edit this task by removing the #Wikimania-Hackathon-2015 project from this task. Thanks for your help and keeping this task updated!

Change 225288 had a related patch set uploaded (by Dduvall):
WIP: [BrowserTest] Load i18n messages from MediaWiki to browser tests

@Vikassy: Is there a reason this is still WIP? Didn't we finish this during wikimania?

A message to all open tasks related to the #Wikimania-Hackathon-2015. What do you need to complete this task? Do you need support from the Wikimedia Foundation to push it forward? Help promoting this project? Finding an intern to work on it? Organizing a developer sprint? Pitching it to WMF teams? Applying for a grant? If you need support, share your request at T107423: Evaluate which projects showcased at the Wikimania Hackathon 2015 should be supported further or contact me personally. Thank you!

@Qgil: the related commit is ready to be merged. It is waiting for review.

Change 225288 merged by jenkins-bot:
[BrowserTest] Load i18n messages from MediaWiki to browser tests

@zeljkofilipin Awesome! You should post to wikitech-l or wikimedia-engineering when this is completely available to increase awareness and maybe have teams switch from css selectors to using this for finding the elements where it makes sense. 👍