Commit graph

23 commits

Author SHA1 Message Date
Stephen Niedzielski deffae141c Hygiene: improve ESLint globals readability
- Drop unused moment, Redux, and ReduxThunk globals.

- Instead of using a confusing and deprecated boolean, specify that
  globals are "readable" / "writable"
  https://eslint.org/docs/user-guide/configuring#specifying-globals

Change-Id: I711a4ea7c51c9a560f20fc28bc99bd932c7e1e25
2019-02-21 07:59:56 -07:00
Thiemo Kreuz fb5b120515 Minor fix-ups to type hints in JavaScript code
This patch also removes misplaced empty lines at the beginning of a
scope. In PHP code we even have a sniff for these. In JavaScript we
don't, but I suggest to be consistent about this.

Change-Id: Ic104ae8fe176da1dafa9bc783402adecb71de1f0
2019-02-14 11:15:01 +01:00
jenkins-bot 86cf91728a Merge "QA: Test page in Selenium needs a lead section" 2019-02-04 13:48:25 +00:00
jdlrobson 364abd75b5 QA: Test page in Selenium needs a lead section
A lead section is essential for a summary in the /restbase/
content service. On commits we test the mediawiki endpoint but
against beta cluster we test the restbase endpoint.

I overlooked this in If855c7c0a2ad65d96d03d6a1411b453ecbe8752b

Bug: T214974
Change-Id: I9959d7ae463c4e1d4fa5345fdb59fe1b2152d49e
2019-02-01 23:03:36 -08:00
jenkins-bot 85d00ea85f Merge "Adapt Popups browser tests to recent breaking change" 2019-02-02 01:04:43 +00:00
jdlrobson a8b9dc6c07 Adapt Popups browser tests to recent breaking change
The previous Popups test page pointed to the "Main page" which as
of Ie15487184a7f9fc08603fc42cfad3aeac6642dcc has specially handling

This makes a new test page "Popups test page 2" that is linked to from
"Popups test page" which previously linked to the Main page which
now leads to the display of a broken Popup

This gets our test fixed but the problem with main page previews
will remain (T215080)

Bug: T214974
Change-Id: If855c7c0a2ad65d96d03d6a1411b453ecbe8752b
2019-02-01 15:56:18 -08:00
WMDE-Fisch 0c3d876b45 Avoid arrow functions in browser tests
Mocha discourages the usage of arrow functiones in the test specs since
Mocha context can't be accessed from inside.

I stumbled across this when using this.skip(); in the reference preview
selenium tests. Since it took me some time to figure out why it was not
working, I guess it's better to avoid lambdas generally there.

See https://mochajs.org/#arrow-functions

Change-Id: I95cb183ac88e9a624c449a8f9addbe84bf76c335
2019-01-29 16:37:37 +00:00
WMDE-Fisch 645aa24b7c Add browser tests for reference previews
The test setup was slightly refactored to be more general about
the type of the popup.

The additional reference links on the test page were added mostly
to be prepared for further tests of more complex cases.

On the CI the tests should be executed with having reference
popups enabled. The code tries to skip test when the feature is
disabled.

See I17687c62cc8d738a4eb41738c9ce6662a5ec68d8
and I1eb7409aa3bd111c2e461dfe245d95f7e78d416c

Bug: T213415
Change-Id: I74110c6227596ff10c75f5f0b0da3d952f11a239
2019-01-24 12:42:49 +00:00
Željko Filipin c578de27d8 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 and NPM packages are dependencies. selenium-daily now just calls selenium-test.

selenium-daily might seem redundant, but it provides flexibility. In case a
repository does not want to run all tests daily, that's easily fixed by updating the
selenium-daily script.

Bug: T188742
Change-Id: I35c93ff1897afc4b9e66703a1acf765e3fe7b643
2018-09-05 19:16:12 +00:00
Antoine Musso 1cff4a15a7 QA: Selenium no more needs wgUsejQueryThree
$wgUsejQueryThree was a transient setting that has been removed with
MediaWiki 1.31.  It is thus no more needed in the Selenium
LocalSettings.php file.

Bug: T199939
Change-Id: I74565cc81ff3704d2d91c8768b0e8f8ee7a4dcc3
2018-07-19 15:57:47 +02:00
Stephen Niedzielski ae44042cbf Hygiene: add assertion messages
Change-Id: Ic0a47bd468532824e8648c3f6371cc403896603c
2018-05-08 15:55:23 -05:00
Stephen Niedzielski 4dd9df12eb Doc: update some of the popups / preview terminology
Bug: T165036
Change-Id: Id75543d4d886e4cca8278baaf4f4a21c8e4389b7
2018-03-23 11:18:26 +01:00
Stephen Niedzielski 007cc5ab7c Hygiene: favor string templates over concatenation
Update the ESLint config to favor ES6 strings where variables or string
concatenation is used and fix *all* offenders automatically via:

  eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I1a9345162348e5ded21d541e7a2ce251ea72ab5a
2018-03-21 08:05:55 -05:00
Stephen Niedzielski 57762e0417 Hygiene: favor const
Bug: T165036
Change-Id: I17d374eaac6627ca6a8ba178862b2a9cff2538c0
2018-03-21 10:44:24 +00:00
Stephen Niedzielski 0bee0906d4 Hygiene: replace var with let and const
eslint \
    --cache \
    --max-warnings 0 \
    --report-unused-disable-directives \
    --fix \
    src tests

Change-Id: I051275126ae7fa9affd16c2504017c0584f2d9c7
2018-03-20 14:14:02 -05:00
Stephen Niedzielski ece4670710 Hygiene: use arrow for anonymous functions
In some places, the arrow function seems more natural. This patch
approximates the following with manual amendments:

  find \
    -not \( \( -name node_modules -o -name .git -o -name vendor -o -name doc -o -name resources \) -prune \) \
    -iname \*.js|
  xargs -rd\\n sed -ri 's%function\s*(\([^)]*\))%\1 =>%g'

Files to focus on were identified with:

  rg -slg\!/resources/dist/ -g\!/i18n/ -g\!/doc/ 'this|self|arguments|bind|call|apply|new'|
  xargs -rd\\n git difftool -y

Bug: T165036
Change-Id: Ic66b6000b8fc000f9bfde39749f9cfa69924a13c
2018-03-20 09:27:08 -05:00
jdlrobson 695a7b6b58 QA: Cleanup unnecessary test changes
Various tweaks were made in Ibe212721807d3698dc45ef46b2dbde15ca9d2f70
to get the browser tests to pass. Many of them were unnecessary.

Change-Id: I47ac37512da38a33f4b3b919cc412b79231b0324
2018-03-16 09:53:04 -07:00
jdlrobson deaaf0961b Remove popups from critical rendering path
Instead load it via mw.loader.using

We retain the module name ext.popups as this will be present
in cached HTML, however now it will load the bulk of the code
inside ext.popups.main

Bug: T176211
Change-Id: Ibe212721807d3698dc45ef46b2dbde15ca9d2f70
2018-03-13 08:44:31 -07:00
Željko Filipin 541a42dd17 Update README file for Selenium tests
Bug: T187862
Change-Id: Ib62a6059e8048712617870d07746bee1ab92e371
2018-02-27 14:04:39 +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
Željko Filipin b174a6f298 Clean up ESLint configuration
parserOptions is redundant sice env is already set to es6.

Bug: T177262
Change-Id: If478a0aaeb7fef184be965645fbd2cb276b630c8
2017-12-22 16:12:54 +01:00
Željko Filipin c175cffe9b Fix location of LocalSettings.php
It used to be in tests/browser, now it's in tests/selenium.

Bug: T177262
Change-Id: I102c77834f4c63da06fcc6140a28de9dba231ae6
2017-12-19 13:35:46 +01:00
jdlrobson cf774be88b Port Popups browser tests to selenium
Bug: T177262
Change-Id: Ie77cf7bc79f454904983ed5cf65dc9fe2b1ececc
2017-11-01 13:31:36 -07:00