Commit graph

51 commits

Author SHA1 Message Date
Jan Drewniak fcd4d1a272 Hygiene: Followup from 191fc2a
pass a collection of jQuery objects to `.append` instead of
and array.

Use `.css` instead of `.attr` to set thumbnail background image.

Change a unit to reflect the escaping pattern of the `.css` method

Bug: T219846
Change-Id: I6359be2db6c7c7a8e4b52296e0801d4ded921b46
2019-05-01 22:28:47 +02:00
Ed Sanders 26b15d19b9 build: Update eslint-config-wikimedia to 0.10.1
Change-Id: I01388bfdda108e9e80b32d68983e1d826d0db784
2019-02-10 16:46:48 +00:00
Ed Sanders 7b0c26ba59 build: Update devDependencies
eslint-config-wikimedia      0.5.0  →   0.8.1
 grunt-eslint                20.1.0  →  21.0.0
 grunt-stylelint              0.9.0  →  0.10.1
 stylelint                    8.2.0  →   9.2.0
 stylelint-config-wikimedia   0.4.2  →   0.4.3

Add "eslint-plugin-qunit"

Change-Id: I4761b12a9c3d4cb35bb891a7f999a84be46f543e
2018-11-12 22:24:07 +00:00
jdlrobson 6b49ddff1b Remove EventLogging/A-B test code from RelatedArticles
With RelatedArticlesEnabledBucketSize now removed, installation of this
extension will turn it on for 100% users without any mechanism to turn
it off.

Additional changes:
* Bump version
* Add Readers team to contributors

Bug: T202306
Change-Id: I7dc270a06dd3afd4e894c8298165d6d6d4fda8d6
2018-09-20 11:13:13 -07:00
Jan Drewniak 6856ef8b5e Renaming QUnit test files from "test_" to "test.js"
Updates QUnit test files from starting with "test_" to ending with
"test.js" in accordance with the Readers Wed coding conventions.

https://www.mediawiki.org/wiki/Reading/Web/Coding_conventions

Bug: T197884
Change-Id: I3c15385d22d308b8b465985ca55e8b802d72dae4
2018-09-19 14:54:48 +02:00
Fomafix 00405b0309 Remove mediaWiki and jQuery from eslint globals
Remove all mappings in the closures like in
I7cf2426cde597259e8c6f3f6f615a1a81a0ca82b in core.

Change-Id: Ie9a2fadb8e276774784a4937bb5c3ec11f213352
2018-09-15 17:54:03 +00:00
Fomafix 969ae7c05f Remove unused jshint comment
Change-Id: If1db410a48a754a4f892b6164f6a4997bed3bec4
2018-08-17 14:06:24 +02:00
Fomafix 0fa064728f Use native JavaScript instead of jQuery
Replace
* $.each( array, function ( index, value ) { ... } ) by
  array.forEach( function ( value ) { ... } )

* $.map( array, function ( value ) { ... } ) by
  array.map( function ( value ) { ... } )

* $.isArray( var ) by
  Array.isArray( var )

* $.isFunction( var ) by
  typeof var === 'function'

Change-Id: I450f5a75eb9c3fe20517da02986b0a491ebca67a
2018-08-17 12:45:12 +02:00
Željko Filipin 5c8571317b Selenium: add selenium-daily NPM script
The script is needed to run the new Docker-based Jenkins job that runs daily and targets beta cluster.
selenium-test script, NPM packages and wdio.conf.js files are dependencies.

Change-Id: Ic0fb26cfdd07225260b6ef70ce81a49ee73af331
Job: RelatedArticles-npm-browser-run-selenium-daily-node-6-docker
Bug: T188742
2018-08-10 08:32:24 -05:00
jdlrobson 993c4e227e Use wdio-mediawiki in selenium tests
Change-Id: If48e0a885acdf4bca73ec2a9d613fe2f0403dd61
2018-06-20 10:23:11 -05:00
Željko Filipin 0a482c7e5c Update README file for Selenium tests
Bug: T187862
Change-Id: I20a3f0b87b5940c81c227d236262f036a17528d3
2018-02-27 14:06:27 +01:00
Željko Filipin 265a1c5f8f Clean up ESLint configuration
parserOptions is redundant sice env is already set to es6.

Bug: T164024
Change-Id: Iec58f229352446d95fef111b659d5e32b9bdb523
2017-12-22 16:15:44 +01:00
Željko Filipin cf04eaa480 Fix location of LocalSettings.php
It used to be in tests/browser, now it's in tests/selenium.

Bug: T164024
Change-Id: Ie05744fa18c983458f7f50a42d2f120e84b99c54
2017-12-19 13:46:53 +01:00
Ed Sanders 10de1deaf4 build: Update eslint and stylelint
Change-Id: I82bfb5fbfea4997f3048305574d2ff7d28ecd1b8
2017-10-09 15:37:28 +01:00
jdlrobson 3ec5e91e00 Make RelatedArticles tests QUnit 2 compatible
Bug: T174598
Change-Id: Ib5a8a46253beed60e77de34263504bb12146641e
2017-09-01 11:16:31 -04:00
Željko Filipin 9d2a46fbda For Selenium tests, click the link to switch to mobile view
Clicking `Mobile view` link works on both MediaWiki-Vagrant and beta cluster. Appending `&mobileaction=toggle_view_mobile` to URL works only on  MediaWiki-Vagrant.

Bug: T171847
Change-Id: Iff47a5e3b25ee3af15a4843ca7efe550c334c3b7
2017-08-22 13:22:26 +02:00
jdlrobson daa7281381 QA: Move LocalSettings to folder with other browser tests
Depends-On: Ib069004f8dcb76550fe96a6544f2846d4a7af1b9
Bug: T164024
Change-Id: Iaae9709b7407738850cdfc47c7ff56cc6eb2b1ca
2017-08-14 15:33:36 +02:00
jenkins-bot 70787d2d70 Merge "Breaking change: Remove Sidebar code from RelatedArticles" 2017-08-10 18:26:08 +00:00
jdlrobson 94ecc2d917 Breaking change: Remove Sidebar code from RelatedArticles
RelatedArticles will now only render related articles in the footer of
skins.

Bump version to 3.0.0

Bug: T165991
Change-Id: Ia4e28c0ed76b3aff37c0aea8eb713923312ba23c
2017-08-10 12:44:58 -05:00
jdlrobson b7f7d9c351 Having 2 folders for browser tests is confusing.
This patch removes all unnecessary artifacts from the old Ruby tests.
LocalSettings is needed for CI purposes and can be removed once CI
has updated.

Bug: T164024
Change-Id: Ifec8bf2b3cd7d4db105c254248cdfcdf773472ef
2017-08-02 07:42:08 -07:00
Željko Filipin a40cfcb134 Replace Ruby Related pages browser tests with node js version
Additional changes:
* Remove all Ruby artifacts
* Update eslint to allow es6 in tests

Bug: T164024
Change-Id: If6c8d32df042b831d52440963606a47c8ce7b552
2017-07-26 11:41:07 +00:00
jenkins-bot 38ac4650e0 Merge "Make number of RelatedArticles configurable" 2017-07-06 21:09:06 +00:00
jdlrobson 9126c7d0ef Make number of RelatedArticles configurable
Wikivoyage pages have more than 3 related articles as they make use
of the {{#related:}}  magic word.

After speaking with Nirzar we should allow this project to show more than 3.
This change allows this while keeping the existing behaviour on other wikis and
will pave the way for removing a bunch of code from this extension.

Additional changes:
* Cleanup skinStyles definitions
* Limit cards to 30% maximum width and give margin top to account for
situations where the number of cards are multiple of 3
** In Minerva hardcode the max-width to pixels.
* Margins are switched from hardcoded 10px to percentage based. Yes
this changes the right margin slightly but is more maintable and visually
the same.

Bug: T164765
Change-Id: I41119de3228c2df799f740d4bd00082101c21b97
2017-07-06 11:17:47 -07:00
Sam Smith f4c82d3a33 Hygiene: SamplingRate -> BucketSize
In order to avoid further confusion, clarify that we're bucketing users
for experiments.

Bug: T167236
Depends-On: I752cdf068ca25bffb38229380785e7da1a208049
Change-Id: I6508ab8fa3d436ae295eb047e170fdc5417d25fc
2017-06-20 05:26:29 +01:00
jdlrobson 4598d9b567 Remove CardsGateway (unused)
Bug: T167647
Change-Id: I7e2a7777a5f28991d77deab520a55d3bd242104b
2017-06-14 13:10:01 -07:00
jdlrobson 6dee0147f4 Migrate Cards code to RelatedArticles
* Move across all files
* Rename ext-card- prefix to ext-related-articles- prefix
** Since all code using these prefixes is JS
  we do not have to worry about cached HTML

Bug: T137021
Change-Id: I784fd132c36329fa0dcc49fe2804460061940347
2017-06-07 08:35:53 -07:00
Timo Tijhof 1b6c46d7dd tests: Don't assume synchronous jQuery.Deferred
Bug: T124742
Change-Id: I8289d88fa61447ba31e7b767727775ead411987e
2017-04-14 18:12:55 -07:00
jdlrobson dbb73c389d Remove Related Articles from desktop beta features
This change removes RelatedArticles from beta features.
It repurposes the BlacklistSkins config to be a whitelist that describes
when related pages should be shown in the footer.

To avoid enabling related pages on desktop, this depends on a config
change that makes use of the new configuration option.

Simplify browser tests to reflect the new status quo.

Bug: T146436
Bug: T160076
Depends-On: I522e0182d1c3d9261bd0561c3ec0c789b6431c7a
Change-Id: I84da1fb33a901a6365375d00d192af35422ff0b0
2017-04-04 23:01:36 +00:00
jdlrobson 0e5eef27ce Don't run the test for minerva stable against the beta cluster
On the beta cluster, the browser test should pass.
Add a new test to reflect the two different states.

Bug: T157165
Change-Id: I2a777436dfa3a14d58855449c39cc144b7149a62
2017-02-03 12:23:56 -08:00
jdlrobson c6bc8f804d Update browser test to run on desktop
This previously passed with a false positive as it replicated
the scenario `ReadMore is not present in minerva stable` by running
on the mobile domain.

This change makes it run on the desktop domain and pass (it now
fails given it runs on Minerva skin)

Bug: T157165
Change-Id: Idb2002b0f2d378cc0b6df73ad1381bfee32448c9
2017-02-03 12:22:30 -08:00
Baha 1bc4b5c1b3 Fix browser tests
The ReadMore checkbox on the beta preferences page doesn't have an ID
anymore. It has a name though, which is used from now on.

The regression was introduced in I8636f32330e23814ba3b4c0f5e22e55aaf77883e.

Bug: T148856
Change-Id: Ieb20c8d9e97d53e6afae3a9fc99ce4dea471b0b5
2016-10-24 15:27:53 -04:00
jenkins-bot ec0fbca920 Merge "Allow blacklisting skins for showing ReadMore in footer" 2016-09-26 15:31:04 +00:00
Baha 9c1404ce99 Allow blacklisting skins for showing ReadMore in footer
Introduce a new config variable `RelatedArticlesFooterBlacklistedSkins`
to control skins that are allowed to show ReadMore in the footer.
As before Minerva beta mode is always allowed to show.

Depends-on: I366c8656a0f14a7069053b2e6199caac20471ea4
Depends-on: Ie4ac3c11e81eeea9f5b4a7161a64477cb5d60f07
Bug: T144047
Change-Id: I1663ab25083d9d907f288e60d506831bebb67945
2016-09-26 15:26:03 +00:00
Željko Filipin 316073e6ff Fix MediawikiApi::HttpError in Selenium tests
Use https (instead of http) in mediawiki_url environment variable.

Bug: T145799
Change-Id: Ie4d7188a2f3a11f1eaa5163ffd83544e9828e136
2016-09-16 17:02:14 +02:00
jdlrobson f09f7a717d Beta should be available to test suite.
This old classic returns again.
A browser test fails when this is not enabled as it asserts that
the user is in beta.

Bug: T120715
Change-Id: I2c5339ba959318a3b995a28e22f3df375ae53103
2016-09-12 21:33:58 +00:00
Kunal Mehta a4c4f6700f Remove uncessary ParserClearState hook
The ParserOutput object is already reset when state is reset, so there's no
point in setting or unsetting properties on it.

And since the only unit test was deleted, remove the hook for that too.

Change-Id: Idf12365e8c4b14e527d923edc1086bdaf349df32
2016-07-28 15:55:02 -07:00
Kunal Mehta d8329fdbb1 build: Updating mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I3de1f2562898b76b56f5e7aa36b61088331ff52c
2016-05-09 16:59:15 -07:00
Željko Filipin be874d472e Migration of browsertests* Jenkins jobs to selenium* jobs
selenium* jobs are a new way of running Ruby based Selenium tests. The
jobs are triggered daily.

Bug: T128190
Change-Id: I02fc3e8542d732ca728f47316a8e183ed28744e7
2016-04-25 19:35:20 +02:00
Željko Filipin b272dc6932 Fix mobile Selenium Jenkins job
Until T128190 is resolved, we can not run both mobile and desktop job
daily. Since there are 3 mobile and only 1 desktop scenario, run mobile
job until running desktop jobs is possible.

Bug: T128084
Change-Id: I13eba1c2a4f33f8e88c8bc1a000914e65322b9cc
2016-03-02 12:25:52 +01:00
Željko Filipin 3ca8ef02ad Fixed Selenium tests
Tests now run fine on my local machine and at beta cluster. Please
notice that the first three scenarios run at mobile site, and the fourth
one runs at desktop site.

Bug: T120715
Change-Id: Ib57f48b01d909915ae44976aa51824b4530ffffc
2016-02-13 01:52:28 +00:00
Željko Filipin 33abf32c8c Fixed failing Selenium Jenkins job
The job requires features/scenarios tagged with environment
(@en.m.wikipedia.beta.wmflabs.org) and browser (@chrome) to run
properly.

I did not tag the last scenario, since it failed.

Bug: T126589
Change-Id: Ib99c50657f7a68d0b00048aac96c2f2892e89713
2016-02-11 11:47:04 +01:00
Antoine Musso d8b773f9a4 Rake entry point and rubocop fix up
Introduce the rake test entry point which is invoked by CI.

Add a basic rubocop configuration based on
https://www.mediawiki.org/wiki/Manual:Coding_conventions/Ruby

Fix up a few ruby issues.

Bug: T120715
Change-Id: I3df0a3b13155259ec6cb5010e7aaa3bf9aa7b230
2016-01-06 16:57:22 +01:00
Baha f19aee12b8 Add Gemfile
mediawiki_selenium 1.4 or greater is need for running browser tests.

Bug: T120715
Change-Id: If5bf9dcc7310896b8d8b218d636952c344a2a105
2015-12-28 15:54:25 +01:00
jdlrobson 1db93f0d14 QA: Add extension tags to tests
Certain tests only work when certain tests are installed. Tag them

Bug: T120715
Change-Id: I6b4333e5c45c41fc5699bf18f6b3a76556290df6
2015-12-07 20:27:25 +00:00
Baha 9932fee563 Add browser tests for ReadMore
Change-Id: Ia1f628b4f2e1af7d33dc6779a139c2800be82964
2015-12-04 15:43:45 +05:00
Sam Smith fbc696177a Fix RelatedPagesGateway unit test failures
I33936a3 didn't introduce a regression but highlighted an issue with the
fixture in the RelatedPagesGateway unit test: the fixture is in the
legacy JSON format despite the API request URL including
formatversion=2.

Change-Id: Id372d022625d88eea685267ea6b6484cf6b28cbc
2015-11-25 14:34:11 +00:00
Baha 8cf9b60ab5 Make RelatedArticles soft-depend on Cards
RelatedArticles tries to load the 'ext.cards' module and if
it succeeds it continues with showing the related articles
on the page.

Dependency: I6661527175eb889cec4193b18fa18207f332b4fc
Bug: T117108
Change-Id: I33936a3e9cd5d1f0296e48fd1c2bba77fff4e466
2015-11-18 22:22:10 +05:00
jhobs d08962d12d [Hygiene] Rename internal uses of "article" to "page"
Leave all public-facing uses of "article" (including classes) because
the extension is remaining named RelatedArticles. Replace all other
instances with "page" for consistency with other extensions.

Bug: T117908
Change-Id: Ib0f258f26b0d11cfe8a598dbd90ff37afbbe36ac
2015-11-13 19:03:39 -05:00
Sam Smith 0fed50e266 Optionally disable Read More using extension data
By default, the Read More feature tries to use editor-curated articles
before using the CirrusSearch morelike: feature. Add a configuration
variable that disables the former behaviour but leave the default in
place.

Changes:

* Add the wgReadMoreOnlyUseCirrusSearch configuration variable, which
  defaults to false, and pass it in to
  mw.relatedArticles.RelatedPagesGateway at construction time
* Add the onlyUseCirrusSearch parameter to
  mw.relatedArticles.RelatedPagesGateway, which controls whether to
  ignore the editorCuratedArticles parameter

Bug: T117443
Change-Id: I0dfa67f4a68e8dc17302fef7ebf8d23c0c1d892c
2015-11-12 12:43:29 +00:00
jdlrobson e86fc3b159 Fall back to CirrusSearch's morelike: feature
When no related articles have been specified by an editor we instead
hit request pages similar to the current page using the CirrusSearch
extension's "morelike:" feature [0].

Changes:
* Config variable introduced RelatedArticlesUseCirrusSearch which allows
you to turn on use of the CirrusSearch API.
* Introduce a RelatedPagesGateway for dealing with making the API call
  and returning consistent results
* Move the "simple" API call for hydrating related pages fetched from
  the wgRelatedArticles configuration variable into RelatedPagesGateway
* Reduce the bootstrap module to just a bootstrap module!

Bug: T116707
Change-Id: Ia0ced1d7ae57c0939d1f5af275aa9d393f1420b1
2015-11-06 10:23:39 -08:00