Page MenuHomePhabricator

Do not skip tests in MobileFrontend
Closed, ResolvedPublic

Description

Router.js, InfiniteScroll and mobile settings tests have been disabled due to causing problems in the Jenkins environment.
See T98377.

settings.js

  • we cannot easily stub localStorage. Look at mediawiki.storage for details.

Router.js

The culprit is QUnit.start and QUnit.stop not working as before on teardown of the test_Router.js.
From what I've been investigating, there is now way we can stop and start QUnit in setup & teardown, and stop and start are being deprecated. The test suite for the router needs to be re-thought and the Router itself should be decoupled from the browser (it is completely coupled to window/window.location/etc making it super hard to test without messing with the browser).

What this should be:

  • Decouple the Router.js from window and browser details. Maybe use an intermediate event emitter that provides the hash and emits the hashchange events, etc. Provide one by default that covers what the window does.
  • Refactor the tests (enable them) and use a fake event emitter to trigger and set router behavior, and test the Router properly.

Event Timeline

Jhernandez raised the priority of this task from to Needs Triage.
Jhernandez updated the task description. (Show Details)
Jhernandez moved this task to To Triage on the Readers-Web-Backlog board.
Jhernandez added a subscriber: Jhernandez.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 11 2015, 11:43 AM
Sumit added a subscriber: Sumit.Aug 26 2015, 6:29 PM

I'd like to attempt this task. I have a fair idea of the need to decouple hashchange event from window for allowing testing of Router behaviour. I just need some info on

Maybe use an intermediate event emitter that provides the hash and emits the hashchange events, etc

Is there an example I can look for implementing the above "intermediate event emitter"?

Change 236702 had a related patch set uploaded (by Jdlrobson):
Attempt to get Router and InfiniteScroll tests working again

https://gerrit.wikimedia.org/r/236702

Change 236702 abandoned by Jdlrobson:
WIP: Attempt to get Router test working again

https://gerrit.wikimedia.org/r/236702

Jdlrobson triaged this task as Normal priority.Sep 8 2015, 11:44 PM
Jdlrobson added a subscriber: Jdlrobson.

Given we have no test coverage things could break in future (especially as we transition to oojsui so we should do this sooner rather than later)

Jdlrobson set Security to None.
Jdlrobson renamed this task from Refactor Router.js and its tests to Do not skip tests in MobileFrontend.Sep 23 2015, 12:18 AM
Jdlrobson raised the priority of this task from Normal to High.
Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from Backlog to Bugs on the MobileFrontend board.Nov 4 2015, 5:01 PM

Change 260330 had a related patch set uploaded (by Sumit):
Enable skipped router tests

https://gerrit.wikimedia.org/r/260330

Sumit claimed this task.Dec 21 2015, 7:48 AM

Change 260330 merged by jenkins-bot:
Enable skipped router tests

https://gerrit.wikimedia.org/r/260330

Jdlrobson closed this task as Resolved.Dec 22 2015, 6:35 PM