Commit graph

51 commits

Author SHA1 Message Date
Željko Filipin
86b867f794 Make running Selenium tests using Sauce Labs easy
If SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are not
defined, tests are run with `npm run selenium`, as usual.

https://www.mediawiki.org/wiki/Selenium/Node.js/Inside_MediaWiki-Vagrant
https://www.mediawiki.org/wiki/Selenium/Node.js/Target_MediaWiki-Vagrant

If the environment variables are defined, to run tests using Sauce Labs
and targeting Beta Cluster, run this:

```
export SAUCE_USERNAME=***
export SAUCE_ACCESS_KEY=***
export MW_SERVER=https://en.wikipedia.beta.wmflabs.org
./node_modules/.bin/wdio tests/selenium/wdio.conf.js
```

https://www.mediawiki.org/wiki/Selenium/Node.js/Target_beta_cluster_using_Sauce_Labs

Bug: T139740
Change-Id: I622d9c55ae595ab772e733388d209623e3a9f81e
2017-05-25 15:57:04 +00:00
Ed Sanders
ee3d5a014f build: Update eslint to 0.4.0 and make pass
Change-Id: Ib230392f332268ac801cf668f399fcefb1cb1cc5
2017-05-04 22:38:03 +00:00
Timo Tijhof
4a8045400a build: Sync qunitjs version for karma with version of Special page
Special:JavaScriptTest loads qunitjs from /resources/lib/qunitjs
which was upgraded in 99aad9397e to 1.23.1.

However, when running QUnit tests from the command-line, QUnit is
loaded by karma-qunit using the npm qunitjs dependency, which was
still at v1.22.0.

Change-Id: Ie24b2b061735fa03a8ed1527d09f65c103506c67
2017-04-18 16:31:42 -07:00
Paladox
7dfe22b45e build: Update karma to 1.5.0, karma-firefox-launcher to 1.0.1
karma:
 Changelog at https://github.com/karma-runner/karma/releases
 https://github.com/karma-runner/karma/compare/v1.1.0...v1.5.0

karma-firefox-launcher:
 Changelog at https://github.com/karma-runner/karma-firefox-launcher/blob/master/CHANGELOG.md#101-2017-03-04
 https://github.com/karma-runner/karma-firefox-launcher/compare/v1.0.0...v1.0.1


Karma v1.1.1 added use of `<script crossorigin="anonymous">` for
the urls it initially loads. While most requests will be done by
MW itself directly (and served locally via the proxy at /w/) the
initial request cannot come from the proxy and is loaded from wgServer
directly. Therefore we need to set crossOriginAttribute=false to override
the new default that v1.1.1 introduced.

Change-Id: I9f5067b949c0a77e46f47c2a110a7b5df5953fda
2017-04-15 03:14:55 +00:00
James D. Forrester
0190d6cbb6 build: Bump grunt-banana-checker from 0.5.0 to 0.6.0
Change-Id: I64d4267d20716b893237f7f13729343593c8d382
2017-03-28 15:08:05 -04:00
Antoine Musso
c35a2c0567 build: karma now reports with mocha formatter
The progress reporter is quite nice to avoid spammy output to the
terminal, but it is not very human friendly when trying to find out what
is breaking.

Mocha has a very nice reporting organized as modules and list items for
each of the tests:

ext.cx.tools.template
  ✖ Equivalent template exists
  ✔ Adapting a template not existing in target language
  ✖ Adapting template having invalid title
  ✖ Template name and params adaptation using templatedata
  ✖ Template params adaptation using templateData - English to French
  ✖ Template params adaptation using templateData - English to Spanish

Add karma-mocha-reporter node module and make it the reporter.

Change-Id: Ic7d848b45e8e5ad3839d8a2bd822b63838319ad7
2017-03-20 19:12:18 +00:00
Željko Filipin
7aee98758a Selenium tests in Node.js using WebdriverIO
Introduce the WebdriverIO browser testing framework driven by Node.js.
The overall intents are:
* have MediaWiki core to provide a platform to run tests that is shared
  between core and the extensions.
* phase out ruby driven browser tests eventually.

Code is namespaced in sub directory /tests/selenium
The 'pages' sub directory provides helper representing a MediaWiki page
such as Special:Login and human friendly helpers to interact with the
elements.

Add Grunt task webdriver:test.

Provide a npm script to easily spawn/dispose chromedriver and run above
grunt task.

wdio.conf.js provides all the configuration. It defaults to point to a
MediaWiki-Vagrant installation on http://127.0.0.1:8080. Can be
overriden with environment settings as needed.

glob patterns (specs) are made absolute paths from MediaWiki root path
that let us run the tests either from the root path (eg the npm
wrapper or from the tests/selenium directory when invoking wdio
directly. wdio assumes they are relative to the current working
directory, hence the normalization.

wdio.conf.jenkins.js extends the configuration and is used solely for
Jenkins.  The switch is done from the Gruntfile.js whenever JENKINS_HOME
is set.  Specially we want junit reports to be generated.

Provide a more specific eslint configuration.

References:

* MALU https://phabricator.wikimedia.org/source/malu/
* T151442 Research WebdriverIO
* T151443 Research Nightwatch.js

Bug: T139740
Signed-off-by: Antoine Musso <hashar@free.fr>
Change-Id: Ibe7a004a120e82af637ab3e31b725de743134c99
2017-03-14 12:20:32 +01:00
James D. Forrester
36f2a780a1 build: Bump stylelint and make pass
grunt-stylelint              0.6.0  →   0.7.0
 stylelint-config-wikimedia   0.3.0  →   0.4.1

Change-Id: Id87b8df04d415e1f1058a4042a31408236402037
2017-02-17 15:26:05 -08:00
Antoine Musso
307ead451c build: Upgrade karma-chrome-launcher to support Chromium on Mac/Windows
Before karma-chrome-launcher 2.0.0, Chromium was only detected on Linux
and as part of the "Chrome" setting. "Chromium" is now recognised as a
separate browser and is detected on Mac and Windows as well.

https://github.com/karma-runner/karma-chrome-launcher/issues/45

Add a grunt target for Chromium so users may run the following to use
Chromium instead of Chrome:

    grunt karma:chromium

Since we keep the default of "Chrome", we'll need an override for CI
since we install Chromium there instead of Chrome.

Depends on Ie9f906f8 being merged and Nodepool images updated.

Bug: T153756
Change-Id: I6ba0d971e7e8c3022d2ab6268ae637688189d768
2017-01-12 20:37:02 +00:00
Paladox
4185d29d39 Pin eslint version
We don't want tests failing every time upstream publishing a new
version.

Instead we should bump this manually everytime they update to make sure
no failures happen.

Bug: T118941
Change-Id: I1c76dacd0950100825b85a3791f74c1f6d5477d9
2016-12-21 00:55:41 +00:00
James D. Forrester
113856971c build: Bump jsonlint devDependency to latest
grunt-jsonlint   1.0.7  →  1.1.0

We can't bump the karma/qunit modules due to issues with our CI.

Change-Id: I15595df8b30a8ef4ddb6471acdd8d4da4f4afabc
2016-11-22 23:57:40 +00:00
James D. Forrester
62177fc1db build: Bump eslint-config-wikimedia to v0.3.0 (already passes)
Change-Id: Iee727a4521acd8c221733c7bd763cbf2adb9bd49
2016-11-15 15:15:52 -08:00
Ed Sanders
c0fb8a8836 build: Replace jscs+jshint with eslint
Change-Id: Id0a23c03aabadfaf2ec705528ae4b3bd0908fa3e
2016-11-15 15:15:52 -08:00
James D. Forrester
7c9c67b9bf build: Fix stylelint devDependencies
Change-Id: I26cee89c27e3cd8f3c1fc48088b2a8e8b3927e4a
2016-08-05 11:04:02 -07:00
Paladox
0a84165e6c build: Bump grunt-karma and related tools to 1.0.x
Also bump karma to 1.1.0 see changelog at
https://github.com/karma-runner/karma/releases please

Change-Id: Ic982dfc7ccebeecd6082b5476372cbb87fec5f1b
2016-07-11 12:11:41 +01:00
James D. Forrester
36cf480f59 build: Bump grunt-stylelint to v0.4.0 and make pass
Change-Id: I00e469cf9b484c9d4d4ad145480fa6e66dd7e8cc
2016-06-24 14:16:59 +00:00
Hashar
7b17005ab3 Revert "build: Bump grunt-karma and related tools to 1.0.x"
Karma is suspected to have an issue disconnecting Chromium.
That causes the qunit job to idle even after all tests have
been completed.

This reverts commit 72b0d9da08.

Bug: T136188
Change-Id: Id818f5a0d1983d0bffa545f7731a780bf2b9bf25
2016-05-26 19:58:47 +00:00
James D. Forrester
9e76649693 build: Bump grunt-stylelint to v0.3.0
Change-Id: I012d8b8cb2851270180f1a981c49a8a5043ae218
2016-05-19 19:05:36 +01:00
James D. Forrester
72b0d9da08 build: Bump grunt-karma and related tools to 1.0.x
Change-Id: I3d8ad9fbd3b6950c13bf400790eb97fe4e94f849
2016-05-19 15:43:37 +01:00
James D. Forrester
3bf6f42929 build: Introduce stylelint
Initially, with just a single rule to make this a smaller change that we can
incrementally extend up to the full Wikimedia coding conventions preset; namely,
forcing hex references to colours to be in lower-case.

Note the odd src definition to avoid referring to mediawiki.less the directory in
the glob.

Change-Id: I34f0c8e3c8280e3fce0aa22d7537100b850cbb8d
2016-05-19 15:41:15 +01:00
Ricordisamoa
a6f243ae00 Bump grunt to 1.0.1, remove grunt-cli
Change-Id: Ic04c3a0b0237c8785f54b83f1bcfb64a3978d768
2016-04-06 04:24:34 +02:00
Paladox
0c471ab36c Update grunt-banana-checker to 0.5.0
This fixes a json crash according to release notes at
https://github.com/wikimedia/grunt-banana-checker/releases/tag/v0.5.0

Change-Id: I7cb37b3f1289b8b91bd98d770ebe58e4c3c6aae5
2016-03-30 22:32:16 +01:00
James D. Forrester
f883f83762 build: Bump npm development dependencies to latest
grunt-contrib-copy     0.8.2  →    1.0.0
 grunt-contrib-watch    0.6.1  →    1.0.0
 karma                0.13.19  →  0.13.22

Change-Id: Idc5c1ac97580e91d9c958c55cdfdda681330c254
2016-03-19 19:06:44 +00:00
Paladox
50817f09a0 Update grunt-karma to 0.12.2
Reason because this update will include a fix for incompatibility with
grunt 1.0.0 when it is released.

Change-Id: I39f01e3a68b764a4638c3465a1d116aefd517ef5
2016-03-18 23:39:28 +00:00
jenkins-bot
1fc267206c Merge "build: Update grunt-jscs to 2.8.0" 2016-03-13 07:54:39 +00:00
Paladox
5a1a6e8440 build: Update grunt-jscs to 2.8.0
Change-Id: Ica4fac1bee551467614a76c76aa699406927c9a4
2016-03-13 07:42:17 +00:00
Timo Tijhof
e49cccc683 Update Karma's QUnit to v1.22.0
Follows-up 54bbef467d, which updated the version used by
MediaWiki's Special:JavaScriptTest.

Change-Id: I7876808c3b5ac88976706cdff1cf7abe8075cfdb
2016-03-12 18:53:37 +00:00
Paladox
f45608ea3e build: Update grunt-contrib-jshint from 0.12.0 to 1.0.0
Changelog at
https://github.com/gruntjs/grunt-contrib-jshint/blob/v1.0.0/CHANGELOG

This release includes a fix to the checker because sometimes it would
not show where the error was coming from.

Change-Id: Ia2e7d6520b760bdc80f7e24051ec578954aa0706
2016-02-22 22:15:28 +00:00
James D. Forrester
864cc26168 build: Bump grunt-contrib-jshint from 0.11.3 to 0.12.0
Taking the opportunity to modernise our .jshintrc file, I have made the
following changes there and adjusted the repo to pass:

* Replaced the deprecated `"es3": true` with `"esversion": 3`; nil change.
* Adjusted `"latedef": true` to `"latedef": "nofunc"`, a new setting for this
  option that lets us retain previous behaviour. One call needed to be adjusted
  for the update with this change; without it, several dozen were needed.
* Added `"futurehostile": true`, to make bumping `esversion` easier in future.

I have reviewed the rest of the options and chosen not to apply them:
* No need to over-ride the runtime option `maxerr`.
* No need to add the additional 'enforcing' options: `forin`, `nocomma`,
  `nonbsp`, `notypeof`, `predef`, `shadow`, `singleGroups`, `varstmt`.
* No need to add the additional 'relaxing' options, as ideally we should use
  none: `asi`, `boss`, `debug`, `elision`, `eqnull`, `evil`, `expr`,
  `lastsemic`, `loopfunc`, `moz`, `noyield`, `plusplus`, `proto`, `scripturl`,
  `supernew`, `validthis`, `withstmt`
* Definitely no need to add any of the deprecated coding style-related items:
  `camelcase`, `curly`, `immed`, `indent`, `laxcomma`, `maxlen`,
  `maxcomplexity`, `maxdepth`, `maxparams`, `maxstatements`, `newcap`,
  `noempty`, `quotmark`, `sub`

Note that we retain two deprecated options, `laxbreak` and `multistr` which are
set to be removed in the next major version of jshint but are as-yet required
for the repo so that it passes.

Change-Id: I2a780f655010f2231ab2ab93c40b34943828b4df
2016-02-06 18:41:45 -08:00
James D. Forrester
1ef92ba549 build: Bump devDependencies to latest
* grunt-contrib-copy: 0.8.1 -> 0.8.2
* grunt-jscs: 2.6.0 -> 2.7.0
* karma-qunit: 0.1.5 -> 0.1.9

Leaving grunt-contrib-jshint for a follow-up patch.

Avoiding upgrading qunitjs again due to incompatibility of recent versions.

Change-Id: Ie4d2f63c3ec247f1bad26ca5d954362210394618
2016-02-06 17:46:44 -08:00
Paladox
cbf8be4f42 build: Update jscs to latest
* grunt-jscs: 2.5.0 → 2.6.0

Change-Id: I4b1585c557b94927e593975e2e4696b88becd095
2016-01-08 16:37:21 +00:00
Paladox
ce0db4678c Update packages to do with karma
Packages updated are:

karma-chrome-launcher updated to 0.2.0

karma-firefox-launcher updated to 0.1.7

Change-Id: I542436bf8f0d782fc2af57a170faf936271b2bf9
2016-01-06 15:32:25 +00:00
Paladox
522e673e7e Update karma to 0.13.19
Bug: T122941
Change-Id: Iee84646b0f914bceb254ffc18d678d916c38eb20
2016-01-06 02:47:06 +00:00
Paladox
4798892b0d Update grunt-jsonlint to 1.0.7
This update now tells you on which line in which file the error happends.

Changelog is

1.0.7 Include file name and JSON source line number in error messages

1.0.6 CJSON support thanks to @fredghosn, unit tests

Change-Id: I38dc4a51416cfde0bb0434921d15f1c119abc01b
2015-12-24 14:12:42 +00:00
Paladox
9a1e6f8ab7 Update grunt-jscs to 2.5.0
2.5.0

Bump JSCS version to  2.7.0

2.4.0

Bump JSCS version to  2.6.0

2.3.0

Bump JSCS version to  2.5.0

2.2.0

* Update  jscs  dependency to  2.4.0
* Use new  Checker#execute  method, which allows to respect  maxErrors
* option when  fix  option is enabled
* fix  option is now directly passed to  Checker  class of  jscs
* Use new "idiomatic" preset instead of "jquery"
* Test in latest version of node in travis CI
* Update dev dependencies

https://github.com/jscs-dev/grunt-jscs/releases

Change-Id: I472a3c63fff814357799a3889b09bbb6a977474b
2015-12-09 21:45:44 +00:00
Paladox
40a85d0aa3 Update grunt-jsonlint to 1.0.5
This is a minor update there were packages updates in this version.

Change-Id: I43cced8c20153d06f764ebba90f64de0431e2d3f
2015-10-24 15:55:55 +01:00
James D. Forrester
b9b4cb5846 build: Upgrade grunt-banana-checker from v0.3.0 to v0.4.0
Take opportunity to drop no-longer-needed options.

Change-Id: I11250c12d2123d4729e12cd0dce07b24fc5008e5
2015-10-12 14:13:54 -04:00
jenkins-bot
808b957704 Merge "build: Bump various devDependencies to latest" 2015-09-28 23:38:36 +00:00
James D. Forrester
1e3264831d build: Set private flag in package.json (for now)
This fixes the warning about missing package description and license.
This matches what we do elsewhere for dev-only npm pipelines.

Change-Id: I29ee43482b90ea8875a5376409d656648e3c4b27
2015-09-28 11:52:19 -07:00
James D. Forrester
789e8b4676 build: Bump various devDependencies to latest
* grunt-contrib-copy: 0.8.0 -> 0.8.1
* grunt-karma: 0.11.0 -> 0.12.1
* karma: 0.12.36 -> 0.13.10
* karma-chrome-launcher: 0.1.12 -> 0.2.0
* karma-qunit: 0.1.4 -> 0.1.5

All already used in other repos.

Change-Id: If1548e9708aa9c8c97c9d2de14ffb4e8ada933fd
2015-09-25 10:47:06 +01:00
James D. Forrester
6a9bbcdca8 build: Upgrade grunt-banana-checker to v0.3.0
Disable disallowBlankTranslations, disallowDuplicateTranslations and
disallowUnusedTranslations for now as they fail so much.

Change-Id: I52e1555335a6e64b1e9db541ba726cf6ce8c7dd0
2015-09-07 16:42:21 -07:00
James D. Forrester
5ac63862df build: Bump grunt-jscs to 2.1.0 and make pass
Change-Id: I7c5a38ad16c471bb1443a5bde56dda4203fcfad5
2015-09-03 21:30:31 +00:00
paladox
e64b54a8b9 build: Update grunt-contrib-jshint to v0.11.3
Change-Id: I2170f77042d4f31914c684bf6bdc08321abe14db
2015-09-03 20:58:58 +00:00
Kunal Mehta
e410918e5f build: Updating development dependencies
* grunt-banana-checker: 0.2.1 → 0.2.2
* grunt-karma: 0.10.1 → 0.11.0
* karma: 0.12.31 → 0.12.36
* karma-chrome-launcher: 0.1.8 → 0.1.12
* karma-firefox-launcher: 0.1.4 → 0.1.6

Change-Id: Ic8bd8563c6f3313a7c8fc936c0753b071441c2b0
2015-06-07 22:41:11 -07:00
James D. Forrester
5f7c6c5805 build: Bump various devDependencies
grunt-contrib-jshint:  0.11.0 -> 0.11.2
	grunt-jscs:            1.5.0  -> 1.8.0
	karma-chrome-launcher: 0.1.7  -> 0.1.8
	qunitjs:               1.17.1 -> 1.18.0

Some trivial indentation and line-spacing changes to make this pass jscs.

Change-Id: Ieeb6dbcd3e6d9f6f0fb9865d356da462b9b0499b
2015-05-01 23:00:45 +00:00
James D. Forrester
6411ef8320 build: Update grunt-banana-checker to v0.2.1
Change-Id: I7b60b856d8cf21640c382647c6570e32091b5cde
2015-03-27 16:48:58 -07:00
Timo Tijhof
fa4ba8dbd7 build: Declare grunt-cli dependency
A long time ago, npm did not support using command line programs
within 'npm test' (not unless harcoding a path to node_modules/bin/...
within packages.json/scripts/test). But this has been long supported.

Declaring a (dev)dependency will provide its binaries to the
PATH used by the subshell 'npm test' creates internally.

Add grunt-cli so that developers don't have to manually install it.

Change-Id: I6a7fafa3c6e40d2407f07c514167ab9fc7661685
2015-03-19 01:08:57 +00:00
Timo Tijhof
3bbd27aa49 Rename JSDuck config to standard 'jsduck'
* Move configuration to /jsduck.json per standard. This way
  it can be run as plain '$ jsduck' without needing a maintenance
  script or custom Jenkins job. Similar to JSHint, JSCS, Grunt,
  and Gem etc.

* Move --processes=0 from maintenace script into config file.
  This should've been in the config file all along and serves as
  workaround for https://github.com/senchalabs/jsduck/issues/525.

* Use grunt-contrib-copy instead of a symlink for resources.
  For local development a symlink works fine, but for publishing
  from Jenkins to doc.wikimedia.org the /docs/js/ directory needs
  to be standalone. This was previously done with a manual post-build
  step that added an additional rsync, but this logic should be
  in the repository so that the doc entry point can be simplified
  and standardised to 'npm run-script doc' for all projects.

Change-Id: Iaaaac50ee78dd9ff8f24f1ef3a3685ad51cf33b2
2015-03-09 18:10:00 +00:00
James D. Forrester
8626b8823d build: Bump various devDependencies
grunt			0.4.2	-> 0.4.5
grunt-contrib-jshint	0.10.0	-> 0.11.0
grunt-jscs		0.8.1	-> 1.5.0
grunt-karma		0.9.0	-> 0.10.1
karma-firefox-launcher	0.1.3	-> 0.1.4
qunitjs			1.15.0	-> 1.17.1

Some minor fixes to pass new jscs rules; big ones postponed for now.

Change-Id: I5f2348c3cf96cf5aa20eeb9083300155b3920c5b
2015-02-10 00:52:15 +00:00
Alex Monk
1ac1512db8 Update karma to latest version
Per Timo, hopefully this should fix our issues with Chromium timing out
after 10 seconds?

Related patch: https://github.com/karma-runner/karma/commit/840ee5f7

Change-Id: Idbac350e2c612290f860ae740ef6ba242c9e0896
2015-01-30 21:46:20 +00:00