Commit graph

1472 commits

Author SHA1 Message Date
Translation updater bot ea2c0d71ea Localisation updates from https://translatewiki.net.
Change-Id: I8d5752698c6ff75a1f09e442e9e002dc86978a02
2018-02-19 22:25:48 +01:00
jdlrobson 21f2d4ab0f Model should capture page id
We're going to need this for logging page views.

Change-Id: I1fc46a9fab54f512edaf5feb5abbaa4f025dcb4a
2018-02-19 16:46:13 +00:00
Pmiazga f8533dbac8 Merge "Capture page view-like interactions" 2018-02-19 16:45:29 +00:00
Translation updater bot 2ddf8a96d8 Localisation updates from https://translatewiki.net.
Change-Id: Iffdf847fa767ccdea4b65b6e733740835c07e2f0
2018-02-18 22:41:02 +01:00
libraryupgrader a7ca711185 build: Updating mediawiki/minus-x to 0.3.1
Change-Id: Ifb9cbb6fe4b9a6dd36c1213890bdc42c3b7f7574
2018-02-18 07:12:34 +00:00
jdlrobson a702c0f499 Capture page view-like interactions
* New action added PREVIEW_SEEN
* The action will be used to signal that a page view needs
to be recorded.
* PREVIEW_SEEN is a delayed action which is triggered
as a side-effect of the previewShow action. It is only dispatched
if the user is still previewing the same card and the page
related to the card has preview type `page`
* The pageview changelistener is added when
$wgPopupsVirtualPageViews is set to true.
* The page view changelistener listens for page views and logs
them using EventLogging when needed using
https://meta.wikimedia.org/wiki/Schema:VirtualPageView

Note:
* Currently if a user has enabled the DNT header, the
event will not be logged. There is ongoing discussion on the
ticket and fixing this will be addressed separately.
* Only title and referrer are logged in the initial version.
The task demands that "namespace" is logged but this information
is not provided by the summary endpoints we use so will need
to be added later (if indeed needed) either via a change to that
endpoint of by using JavaScript to parse the URL.

Bug: T184793
Change-Id: Id1fe34e4bdada3a41f0d888a753af366d4756590
2018-02-16 23:03:33 +00:00
jenkins-bot 8bd51dec2d Merge "Improve & fix action and integration tests" 2018-02-16 19:11:59 +00:00
joakin 1fff0d2ea7 Improve & fix action and integration tests
This change fixes some issues with assertions not running, removes
unnecessary promise dances, and improves legibility and some code
patterns in the action and integration node tests mainly.

Detailed changes:

* actions.js
  * Fully migrate out of jQuery 1 promises (no done/fail)
  * Fix linkDwell action not returning the fetch action promise

* actions.test.js
  * Simplify setupWait for the tests
    * It always autoresolves immediately the wait call to ensure speedy tests
    * No waitDeferreds or waitPromises array coordination, rely on action
      returned promises instead
  * Get rid of that = this in favor of arrow functions
  * Rename generic "p" promises to meaningful names
  * Add assert.expect for more solid tests (so that we don't skip assertions in
    the future if we change them)
  * Fix some assertions that weren't being run because of the incorrect promise
    being returned (p.then, and then just returning p)
  * Get rid of $.when stubbing in favor of waiting for the promise returned from
    the action
    * Get rid of hacky setTimeout(..., 0) to run assertions after the promises

* integration.test.js
  * Get rid of wait(0) calls to hack around asynchronous actions
    * Use the action returned promises instead of the waitPromises/Deferreds
  * Remove unused "el" parameter being passed to this.abandon in several tests
  * Remove unnecessary test helper this.abandonPreview (it was the same as
    this.abandon)
  * Clarify a bit the last and more complex test with some comments and variable
    name changes
  * Get rid of that=this in favor of arrow functions

* container.test.js
  * Get rid of that=this in favor of arrow functions

* previewBehavior.test.js
  * Get rid of that=this in favor of arrow functions
  * Get rid of $.each in favor of .forEach

Bug: T170807
Change-Id: I06fafd92a1712f143018e2ddff24fadf1a6882b3
2018-02-16 13:52:56 +01:00
Translation updater bot 9ed23bdcfa Localisation updates from https://translatewiki.net.
Change-Id: Ic1ffbf229666c32a6b8d3c274c5ce40eef73630b
2018-02-15 22:47:18 +01:00
jenkins-bot 99a37a19a7 Merge "Don't leak deferreds out of functions" 2018-02-15 17:45:15 +00:00
joakin 2df22ef2b2 Don't leak deferreds out of functions
Always try to return a promise.

Bug: T170807
Change-Id: I4a48b6e40a5398a743e39589b5c2fcac4482a814
2018-02-15 15:01:36 +01:00
libraryupgrader 6c294c91c2 build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
Change-Id: I62343b120937faf99bae94188e6a934cc0402fe5
2018-02-15 13:44:12 +00:00
Jan Drewniak 95b880aa29 Return promises from action thunks
Returning promises from the `linkDwell` and `abandon` thunks and
removing some of the `wait` stubs in the unit test for these actions.

Also converting a fetch callback from a `.fail` to a Promise A+
compatible `.catch`.

Bug: T170807
Change-Id: I4bbf2863db090e222ba926d3bc36a99da4bdb601
2018-02-14 20:08:05 +00:00
Jan Drewniak 10465c8bf8 Centering settings dialog and overlay
- Removing the javascript positioning of the settings dialog.
- Placing the settings dialog inside the settings overlay.
- Using flexbox to center the settings dialog.

Bug: T157072
Change-Id: If8d929fe019a04ed5f96aa593779841a52f58eff
2018-02-14 17:54:38 +01:00
Translation updater bot b3d466a399 Localisation updates from https://translatewiki.net.
Change-Id: I63690cc500a6fed1fc74a0fe5c5e7c9e3c0964d3
2018-02-11 10:42:20 +01:00
Jan Drewniak f4d04b95b6 Updating mw-node-qunit to v3
Fixes tests for sinon v4, which is a dependency of mw-node-qunit v3.

Bug: T180255
Change-Id: I8c7b703f81140e06546aa954f98b8766f5225ff5
2018-02-08 12:20:52 +01:00
Translation updater bot c81af043b2 Localisation updates from https://translatewiki.net.
Change-Id: Ibf99ad57f69106e0c9ed0b03a67296c531d17211
2018-02-07 22:17:43 +01:00
Translation updater bot 44b598c554 Localisation updates from https://translatewiki.net.
Change-Id: I17a0f6f52888deb34e969e40f990d17ac9fd3578
2018-02-06 22:35:39 +01:00
Translation updater bot b3a1134c82 Localisation updates from https://translatewiki.net.
Change-Id: I025dbee5a26f72faa40045013d955f013cbd27a4
2018-02-05 22:36:58 +01:00
Ed Sanders 998d7c4f22 build: Update linters
Change-Id: I1af64c55fdd26a2923a1ec20500e97ea13d92bc8
2018-02-04 22:09:45 +00:00
Translation updater bot 8b14ce2773 Localisation updates from https://translatewiki.net.
Change-Id: I9210687d1b1fabcd15bfc9f2f5ed95d96fa3ba51
2018-01-31 22:20:18 +01:00
jenkins-bot 83731256d8 Merge "Hygiene: add bundlesize test" 2018-01-30 23:35:18 +00:00
Translation updater bot c791fcb891 Localisation updates from https://translatewiki.net.
Change-Id: Id6065cd4a419a4c56bdfd7ef5b75919c33950d14
2018-01-30 22:17:02 +01:00
Stephen Niedzielski 7da20008c0 Hygiene: add bundlesize test
This patch adds a production build output gzipped file size check to the
test script so that any future changes may only introduce known size
differences. Note:

• The initial limit was taken from the present gzipped file size rounded
  up to the 10th of a kibibyte.

• JEDEC notation is used. bundlesize internally uses Bytes utility which
  only supports base 2 units.

  https://github.com/visionmedia/bytes.js

Bug: T176211
Change-Id: Ie95f388673b0b982b105fef9a2917513a3307060
2018-01-30 20:04:06 +00:00
Translation updater bot e96b24dabc Localisation updates from https://translatewiki.net.
Change-Id: Ifbfed34f64161826a5f94aaea4bd3365745918a3
2018-01-29 22:20:33 +01:00
Translation updater bot 8c79531ffa Localisation updates from https://translatewiki.net.
Change-Id: I4c42c1dca2b3f1346c72197ee4e1f39b2647035e
2018-01-26 22:36:44 +01:00
Translation updater bot 6c1f103656 Localisation updates from https://translatewiki.net.
Change-Id: I449db3c60904a8c9741445851b0ff70b72e1a062
2018-01-25 22:18:11 +01:00
Translation updater bot 8fe2b34ab1 Localisation updates from https://translatewiki.net.
Change-Id: If01fbb13df323a8130a2e3bd3d2f92e1f6b01f0b
2018-01-24 22:20:59 +01:00
Translation updater bot a30a23419c Localisation updates from https://translatewiki.net.
Change-Id: Ie14145b63630282a534ac028f35389231153cde7
2018-01-22 22:18:33 +01:00
jenkins-bot ac6dea8ab5 Merge "Limit line length to 80 characters" 2018-01-22 20:40:34 +00:00
Translation updater bot 58bdc34e94 Localisation updates from https://translatewiki.net.
Change-Id: Id2a0677929893652d4aac7c00ba055d3494733ed
2018-01-21 22:17:20 +01:00
Translation updater bot 5d19ee245a Localisation updates from https://translatewiki.net.
Change-Id: Ia42eedcd65c2421e5dafbbd6d93a842749707206
2018-01-20 14:43:05 +01:00
Stephen Niedzielski af942bd1dc Hygiene: add package-lock file
Add NPM package-lock file, a new feature of NPMv5.

http://blog.npmjs.org/post/161081169345/v500

Change-Id: I10507ff4e1f09b224b0b52909392bfb9f5005cde
2018-01-19 19:05:24 +00:00
joakin 807100bcca Limit line length to 80 characters
Enforce it with eslint.

Ignore:
* Comment lines with eslint disable directives
* QUnit test lines as they contain long subjects (QUnit.* (only, test,
  module, skip, etc)
* Strings, since long strings are used extensively in tests
  * Ignore template literals for similar reasons
* Regex literals as they may be too long, but can't be easily
  split in several lines
* Long urls

See bug for more general proposal for eslint-wikimedia-config.

Bug: T185295
Change-Id: I3aacaf46e61a4d96547c513073e179ef997deb09
2018-01-19 14:20:39 +01:00
Translation updater bot d4f3afd201 Localisation updates from https://translatewiki.net.
Change-Id: Ifcb8b82ff9d0f5f4862abbd1da72f59f33686c78
2018-01-18 22:49:48 +01:00
jenkins-bot 64e81b0fee Merge "Restore test subject" 2018-01-18 17:48:48 +00:00
joakin c6efe18f6a Restore test subject
Test subject was changed and stopped matching the implementation. In
this particular change the test (a bit convoluted but) tests that wait
is called appropriately, which is why the subject read "should delay
dispatching ..."

Change-Id: I3c8d9d8769f3d1c2869a267af105b9489df86cf5
2018-01-18 18:33:58 +01:00
joakin 7169210406 Remove unnecessary .promise() call
In the mediawiki gateway fetch uses mw.Api which when calling ajax
returns a promise (not a deferred).

Thus .promise() here is unnecessary and happens to work because of
jQuery promises but it is not a standard method on JS promises so it
shouldn't be used on promises, only on deferreds.

Change-Id: Iec609b90bffad8b99b3908897dfb72d7c4ed5481
2018-01-18 18:07:43 +01:00
WMDE-Fisch 4adf63b024 When running Selenium tests, use wd/hub
Now it works on Mac, Windows and Linux.

Change-Id: I6ac70e02bc634bb559426baa29dd22f710e554a1
2018-01-18 15:01:01 +01:00
Stephen Niedzielski 9114981380 Update: show placeholder preview for more failures
Functional changes

- Show the default / error preview for all extract request failures
  except those due to network circumstances (such as CORS) or no
  connectivity (offline). Previously, the error preview was displayed
  only for missing pages.

- FETCH_COMPLETE was previously only dispatched after FETCH_END. Now
  it's also dispatched after FETCH_FAILED. The additional "fetch
  complete" is not expected to impact logging. The states of success
  are: START, END, COMPLETE. The new failure states are consistent with
  success: START, FAILED, COMPLETE.

Testing

Errors may be stimulated in a number of ways including:

- Timeout: add a timeout field to RESTBaseGateway /
  MediaWikiGateway.fetch().

  http://api.jquery.com/jquery.ajax/

- Bad request: change MediaWikiGateway.fetch's action field to
  `Math.random() > 0.5 ? 'query' : 'fail'` and RESTBaseGateway.fetch's
  url field to
  `RESTBASE_ENDPOINT + ( Math.random() > 0.5 ? encodeURIComponent( title ) : '%%%' )`.

- Desired Gateway can be configured in Gateway#createGateway().

- Note: T184534 describes a circumstance where cached previews may not
  appear when offline. Disable browser caching to avoid confusion.

Bug: T183151
Bug: T184534
Change-Id: I7332284da0e0fb1ecd234a6f1e146ebd9ad8d81f
2018-01-16 18:44:00 -06:00
Stephen Niedzielski d9d85ab971 Hygiene: add more fetch failure test cases
Add fetch failure tests for integration and preview state.

Bug: T183151
Change-Id: I1a541d96f3a83b99c26a5180ad5ee8626cda97d2
2018-01-16 18:37:03 -06:00
Stephen Niedzielski 6ba57786fb Update: missing preview copy
Update the placeholder extract and button text shown when a page preview
is unavailable from:

  "popups-preview-no-preview": "Looks like there isn't a preview for this page"
  "popups-preview-footer-read": "Read"

To:

  "popups-preview-no-preview": "There was an issue displaying this preview"
  "popups-preview-footer-read": "Go to this page"

Bug: T183151
Change-Id: I0600dbc2e4d51a13675041d3c0741a793f4eae37
2018-01-16 18:36:54 -06:00
Stephen Niedzielski 8ca0cf2088 Fix: preview page URL for 404 RESTBase responses
Functional changes:

- Require page URL when constructing a PreviewModel null object. These
  models have valid titles and are used to display a preview when an
  extract is unobtainable. When presented with an empty URL, their
  linkage incorrectly pointed to the browser's current URL. Additional
  tests were added to verify the fix.

- Check missing title in addition to falsy response in RESTBase gateway
  and update the test assertion to check title. It isn't clear if this
  can happen in the wild.

- Forbid state mutation in the conclusion of
  MediaWikiGateway.getPageSummary() with a call to Deferred.promise().
  This is consistent with the rest of repo including RESTBaseGateway.

  http://api.jquery.com/deferred.promise/

Nonfunctional changes:

- Collapse two RESTBase gateway 404 tests into one as the scenarios and
  expectations were very similar.

- Add failure HTTP status to 'MediaWiki API gateway handles API failure'
  test stub HTTP response for consistency with other cases.

- Add nullity expectations to JSDocs touched and fix a couple typos
  throughout.

- Make the gateway tests a little more consistent by collapsing Deferred
  variable usage where appropriate.

This change is necessary to the completion of T183151 which uses the
PreviewModel null objects for additional error cases.

Bug: T183151
Change-Id: Ib77627fb9c80d8e806208bbafcfc615b130e3278
2018-01-16 18:36:48 -06:00
Translation updater bot ba3ee4e737 Localisation updates from https://translatewiki.net.
Change-Id: Ia11a7bb86da0c2efc3a624045d08d2ddf0f0052f
2018-01-13 22:15:25 +01:00
jenkins-bot 4ba0335640 Merge "extension.json: Remove space before colon" 2018-01-10 14:41:45 +00:00
Fomafix 63f7dd2a1d extension.json: Remove space before colon
Change-Id: Iec606d9769b00e9653fa36e00a3798f80cd9c7f7
2018-01-10 14:38:30 +01:00
Translation updater bot ea23d457f8 Localisation updates from https://translatewiki.net.
Change-Id: I4b3a186144f858807e44602a75809ae7d1d8b598
2018-01-09 22:29:50 +01:00
Translation updater bot 1af082ce7e Localisation updates from https://translatewiki.net.
Change-Id: I725050165fc9d0eb6f79b53eadbb80b446577861
2018-01-08 22:36:12 +01:00
Translation updater bot 683da8bf10 Localisation updates from https://translatewiki.net.
Change-Id: If67921fd13b5bda8eafdfcd229040289e29f9a1e
2018-01-07 22:47:29 +01:00
jdlrobson ff49e7627b Better error handling for unexpected responses
Bug: T182639
Change-Id: Iea04fe41b4be8e15927e93f16cbb4bb44328374f
2018-01-02 10:42:12 -08:00