Commit graph

75 commits

Author SHA1 Message Date
Ed Sanders fddb47b128 build: Update eslint-config-wikimedia to 0.28.2 and autofix
Change-Id: I6f9731d42bceb5ff4e2c9733a567c72e359abcbd
2024-06-14 13:07:36 +01:00
Umherirrender dd5a18c1fc tests: Use renamed class BundleSizeTestBase
Follow-Up: I131e0d85bd14e75aaebd6f212b2e64a45d4c73a2
Change-Id: I071827d4f046ffc7ad545094b146912db7c43fc5
2024-06-12 20:38:55 +02:00
libraryupgrader 833a84db4a build: Updating npm dependencies
* eslint-config-wikimedia: 0.25.1 → 0.27.0
* @wikimedia/codex: 1.3.5 → 1.4.0

Change-Id: I2c36146322f92812c009ef26c6138068356aa053
2024-04-20 20:17:32 +00:00
Jon Robson 71de06a682 Simplify the RelatedArticles extension to use Codex CSS components
Changes:
- Removes redundant styles now inside Codex
- With the new component, it's not possible to display 3 cards in a
single line at a tablet resolution, so the media query responsible
is bumped to apply only at the desktop threshold
- Decisions are documented in ADR

Bug: T286835
Change-Id: I493e8e601ccc31b3cf1f16c0b5a8975f12ef336c
2024-01-30 09:16:34 -08:00
jenkins-bot fa502f63e8 Merge "Add mw-no-invert class to thumbnails" 2023-10-05 14:38:51 +00:00
Ed Sanders 1071a53446 build: Update linters
Change-Id: I98cbfd20fd85cdf8bb8dc1276ebbc516992212c3
2023-09-15 17:06:48 +00:00
Ed Sanders ac97092078 Add mw-no-invert class to thumbnails
Bug: T345281
Change-Id: I65829811ff0027017d4f91b0dedf7957177f47b5
2023-09-11 18:46:45 +01:00
Jon Robson a90c476b37 Add bundlesize tests
Bug: T315792
Change-Id: I39f037e62bb34cbf5e854aac71ca983c0e1146c7
2023-06-27 09:17:06 -07:00
Umherirrender 1a4bd424b4 tests/qunit: Change assert.ok to assert.true
Avoid loose assertion

Change-Id: I6fd398ef2608c836fd59e0a48271f11c5e0d78a9
2023-03-31 20:37:25 +02:00
Željko Filipin 26e69c8e15 selenium: Enable one skipped test, delete one failing test
Both tests are disabled for more than a year, see
f318d3acd2.

'ReadMore is not present on Vector' is failing so it is deleted.
'ReadMore is present in Minerva @daily' is passing so it is enabled.

To be sure that the passing test is not flaky, the CI has ran it 100
times, it never failed.

Bug: T280652
Change-Id: I739414c4f3f650ce14e31b6bb2bfdd21efb8ff44
2022-11-24 12:40:45 +00:00
Jon Robson e5431a1c0b Limit RelatedArticles feature to ES6 browsers
We currently require support for IntersectionObserver.
which is supported on Edge >= 15 (15 has partial support),
Firefox >55, Chrome >58, Safari 12.1, Opera >=38,
iOS Safari >=12.2, Android 100

Full ES6 is supported in Edge >=15, Firefox >=54, Chrome >=51,
Safari >=10, Opera >=38, iOS Safari >=10, so such a change
would only drop support for Edge 15 and Firefox 54.

CSS.escape is guaranteed in all these browsers according to
caniuse, with the only discrepancy being the Edge browser (versions
16-18) so it is also suggested we remove support for those browsers.

Firefox 54 accounts for 0.0026% of page views
Edge 15-18 accounts for 0.069% of page views

Bug: T306355
Change-Id: Id2987e3456607b610c38da9ee157a026d1d00ada
2022-04-27 15:45:42 +00:00
Jon Robson b528100f3d Add jest testing infrastructure
Adds a test for  resources/ext.relatedArticles.readMore/index.js

Change-Id: Icf8a5afca2489308e2bcaa611c0fe27ed9f46f3a
2022-04-19 18:51:58 +00:00
Jon Robson 911d78e8ee [organization] organize file by module
Follow up to I9442b0336e22ca795cc06f76068215266fe81271

Bug: T306228
Change-Id: Ifb1f1937009b098999471cfa5e820a063dc5a4a0
2022-04-18 08:37:22 -07:00
Jon Robson df1ff38877 [Maintenance] Reduce related articles to two modules
1) Merge ext.relatedArticles.readMore and ext.relatedArticles.cards modules

These are always loaded together. No need to have them in separate modules.
In process switch to packagefiles

2) Merge ext.relatedArticles.readMore.bootstrap and ext.relatedArticles.readMore.gateway

Always loaded together.

Bug: T306228
Change-Id: I9442b0336e22ca795cc06f76068215266fe81271
2022-04-14 17:48:37 -07:00
osamaahmed17 078cfb2347 selenium: Refactor WebdriverIO tests from sync to async mode
WebdriverIO has dropped support of sync mode due to breaking changes in Chromium, hence all tests have been changed to async.

Update npm packages: @wdio/*, wdio-mediawiki and webdriverio
because async mode needs at least webdriverio v7.9.

Remove npm package: @wdio/sync.

Bug: T300797
Change-Id: Ia2a857eb46dbd613a10f48c686bcf6b2fdc3e202
2022-02-09 16:15:05 +00:00
jdlrobson f318d3acd2 Skip Selenium tests
Discussed with Edward, and there seems to be some problems with
these Selenium tests that are being surfaced in
Ie7cfa3e2b19d22086bfa1ba9c64e17760eb29ad2. Skipping on the short term.

Change-Id: Id9dc0b3bf6a619bec73e0e18915c184fe20936d5
2021-09-07 19:08:43 +00:00
sahil 0512e508db selenium: Update wdio-mediawiki
wdio-mediawiki v1.1.1:
- Includes wdio-defaults.conf.js file that vastly simplifies wdio.conf.js.
- Replaces @wdio/spec-reporter with @wdio/dot-reporter.
- Introduces video recording.

Bug: T283597
Change-Id: I35a7b000de1f0b55d8e797e0ff35b0b3590460e7
2021-06-21 20:46:30 +05:30
sahil 2578a87e28 selenium: Update README.md file
Bug: T282237
Change-Id: Ia14349e8630e7a075e5f3ce8dea1572027309ef3
2021-05-24 18:00:35 +00:00
Željko Filipin edeb38fc58 selenium: Add JUnit reporter
JUnit reporter is required to create the XML file that Jenkins uses to
create Test Result Trend chart for selenium-daily-beta-RelatedArticles
job.

Bug: T214686
Change-Id: I6d950630a85def4987118d107c15f7c7f309488c
2021-04-29 17:02:37 +02:00
Reedy 2715c27bbe Rename RelatedArticlesFooterWhitelistedSkins to RelatedArticlesFooterAllowedSkins
Bug: T277958
Change-Id: I468a38df92347cc764e0457d4598bedfc4d92efa
2021-04-20 19:00:26 +01:00
Željko Filipin 75faab3cf4 Selenium: run only 'ReadMore is present in Minerva' test when targeting the Beta Cluster
'ReadMore is not present on Vector' test works fine in CI but it is failing when targeting the Beta Cluster.

Bug: T255053
Change-Id: I80d35829601ade7df9d2cd886df6320a05430e44
2020-07-14 11:55:27 +02:00
Ed Sanders ebecd9c144 build: Update eslint-config-wikimedia to 0.16.2
Change-Id: Ib6681e7d5fb03f4fa54823bf0d37e16d37be3416
2020-06-23 20:30:43 +01:00
vidhi-mody e4f2b070c1 Selenium: Update to WebdriverIO v5
Update NPM packages: webdriverio, wdio-mediawiki.
Update ESlint configuration.

Replace NPM packages:
- wdio-mocha-framework with @wdio/mocha-framework.
- wdio-spec-reporter with @wdio/spec-reporter.

New NPM packages: @wdio/cli, @wdio/local-runner, @wdio/sync.

Replace:
- `browser.element` with `$`.
- `chromeOptions` with `'goog:chromeOptions'`.
- `password` with `mwPwd`.
- `username` with `mwUser`.
- `isVisible()` with `isDisplayed()`.

Bug: T250685
Change-Id: Ic8b49974c05f88a2010c118198b49ee10c175c68
2020-05-27 23:05:51 +05:30
libraryupgrader dfb3995a90 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 28.0.0 → 29.0.0
  The following sniffs are failing and were disabled:
  * MediaWiki.Commenting.FunctionComment.MissingParamTag

npm:
* eslint-config-wikimedia: 0.11.0 → 0.15.0
  The following rules are failing and were disabled:
  * no-jquery/no-parse-html-literal

* grunt-eslint: 21.0.0 → 22.0.0
* grunt-stylelint: 0.10.1 → 0.13.0
* stylelint-config-wikimedia: 0.6.0 → 0.8.0

Additional changes:
* Also sorted "composer fix" command to run phpcbf last.
* Removing manual reportUnusedDisableDirectives for eslint.

Change-Id: Iab538420d73bbbebfd05cf815ab06773f16da8da
2020-01-15 06:11:54 +00:00
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