Replaced WikiPage::newFromID with newFromTitle,
because a Title object exists and could be reused
Bug: T297688
Change-Id: Ide30f259477ed8e0b48df31f5a23cafeb38d7316
* Declare variables inline, as per the current code conventions.
* Convert ad-hoc cases objects into native QUnit.test.each().
This makes for shorter and cleaner code, as well as for more
detailed test reporting, and removes the need to manually construct
assertion messages based on test case prefix string etc.
* Start adopting ES5 Array.forEach in a few places where otherwise
ESLint would complain about variable name clashes.
* Future proof the test module names, by stripping the global variable
namespace that some classes still use, matching packageFiles convention
as used for NotificationBadge.js and its tests already, by specifying
only the bundle name and the exported class name. Note that the
QUnit UI does fuzzy matching so filtering works the same either
way, e.g. "echodmfilter" will match "ext.echo.dm - FilterModel".
Change-Id: I49858dd2c95d0869f2cd15693f05c38312a9f710
The default timestamp of 00000000000000 cannot represent as timestamp,
because it gets a negative timestamp -00011130000000
This is needed for proper cross-RDBMS support
This reapply a change from I46206e0b3a687dff3168a81cf0020e669133e876,
reverted with I1c8c409b7820512b3e31246a7f3d8c1cf4db209c.
Bug: T244898
Change-Id: I109b783de0a8d60ccb161b280ce5fa09e145017b
== Problem 1 ==
As of I09c27a084100b223, tests/qunit/index.js or equiv was used to
load test files asynchronously from a using() callback. This was
untracked by RL or QUnit, and thus sometimes ended up finishing after
the test runner was already done executing all tests. In CI this
means the tests are sometimes never loaded and the browser (or Node)
process already killed before they even have a chance to arrive.
Prior to QUnit 2.17, this was no way of detecting this. As of
QUnit 2.17 (core upgraded last week) when running tests manually
the following helpful warnings appear in the console:
> [warning] Unexpected test after runEnd.
> [warning] This is unstable and will fail in QUnit 3.0.
> test @ qunit.js
> tests/qunit/model/test_mw.echo.dm.SeenTimeModel.js
> require
There were about 1072 instances of this warning, all from Echo.
Fix this problem by removing the async callbacks and specifying the
two modules as normal dependencies instead.
== Problem 2 ==
Class NotificationBadge was being loaded in a strange way out of
bound. This was a violation of module boundaries and should not be
needed other than for a temporary hack or other tech debt. More
generally when a test uses `packageFiles` this is a likely sign of
tech debt or misunderstandings.
Instead, depend on `ext.echo.mobile` and export/import the class
as normal.
After this, the test module can use `scripts` instead.
== Problem 3 ==
The `ext.echo.mobile` uses a Mustache template which the test
was also duplicating a reference to. This is no longer needed now.
Due to the `qunit/index.js` file carefully splitting the operations
between template assignment and file loading, I wondered whether
it was meaning to replace or mock it with something else, but it
simply refers to the same file and only does this because it wasn't
using the module directly. This is now resolved.
If you do need to mock in the future, this can simply be done
by assigning `NotificationBadge.prototype.template` from a
beforeEach() callback in the test suite, or by supporting it
property as a constructor option in NotificationBadge.js and
assigning `this.template` there, which is supported by the
mobile `View` class already it seems and would follow DI patterns
more effectively.
== Problem 4 ==
Most of the Echo tests were ignored sometimes and executed other
times.
The test for `ext.echo.mobile` in particular though was never
executed in CI specifically because:
> Undefined module: 'mobile.startup'
This became a hard error with this patch, which is fixed by
the CI config change with Ie9dabe3269c56fa76db8e51.
Bug: T299780
Change-Id: Ie4a87f3b8085fd6ae53ec586c1782cc266d5288a
Moved the factory deeper into the code right before the one usage it
still needed a full user object
Narrow done method arguments from User to UserIdentity
and use the identity directly
Change-Id: Ic118f23ef504c7fda892480df61ea68c10915f78
The section titles are wikitext extracted from inside heading markup
like `== … ==`, so start-of-line markup like `*` should not be parsed.
Bug: T299572
Change-Id: Ie3995b943e5fe20ad86041d6be755f14f32eb01e
WebdriverIO has dropped support of sync mode due to breaking changes in Chromium, hence all tests of Echo have been changed to async.
Bug: T293073
Change-Id: I8327d33c99e495b109d97df7b525181dfc41c18d
Replace User::getOption() with UserOptionsLookup::getOption() since this method will be hard-deprecated.
Bug: T296083
Change-Id: I0ecdc63b0344bc4c24196cc5edb3d02b6a7ed615
It's an attribute, so it is definitely the manager's
responsibility. Unit test case included.
(EchoDataOutputFormatter really calls for becoming a service.)
Change-Id: If2658dd8c107246158cd93cbb233d8af62fd4424
Previously, ApiEchoNotifications returned only events which were
enabled for the `web` notifier type. With this change, the notifier
type or types to consider can be specified by argument to the new
`notifiertypes` parameter.
This change is required so that the apps can request notification
content from the API for push notifications.
Bug: T287909
Change-Id: I2d1155e113f2defb0f02416a7a659c3ee162d3a6
At the moment we support a maximum of 10 tokens per user for subscribing
to push notifications, stored as a basic list that runs out when the
limit is reached. There may, however, be some edge cases where an app
registers a token and then forgets to unregister it (and repeats this 10
times), after which time it will be unable to register any new token.
This changes the token list to behave more like a circular buffer, by
simply deleting the oldest token before inserting the new one. This way
an app could register a new token even in the rare case of forgetting
the previous ten.
Change-Id: I387de63460882e4e56d1aa6db1f78d73a0495208
* Fix off-by-one counting
* Fix asserting properties on the wrong event (first one instead of
last one), luckily they are identical
Change-Id: Ib1a02476554b29b2a1d0bfdfa89859d71d7691b1
User::setOption() is deprecated and should be replaced with UserOptionsManager::setOption()
Bug: T277818
Change-Id: I001301fb95635c421a0bbb921fd909c5312dc896
::doUserEditContent() is available since 1.36 as a replacement
for ::doEditContent(), which has been deprecated. Extension
already requires MediaWiki 1.37+, so the method is always
available.
Bug: T255507
Change-Id: Iee5de356dbccd453a3083e0a58859b4cd83a946b