wiki.techinc.nl/package.json

48 lines
1.5 KiB
JSON
Raw Normal View History

{
"private": true,
"scripts": {
"api-testing": "npm run api-testing-lint && mocha --timeout 0 --recursive tests/api-testing",
"api-testing-lint": "eslint --cache --max-warnings 0 tests/api-testing/**",
"build": "grunt minify",
"test": "grunt lint",
"qunit": "grunt qunit",
"doc": "jsduck",
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
2016-12-19 16:39:29 +00:00
"postdoc": "grunt copy:jsduck",
selenium: Replace wdio-chromedriver with ./selenium.sh script This package was serving two purposes: * Install chromedriver automatically. * Start chromedriver automatically when using the 'npm run selenium' entry point (e.g. for local development). For the CI entry points (selenium-test, selenium-daily) the chromedriver is skipped. For those, we expect the CI runner to have started a chromedriver server already, which allows the server to continue running between different the test suites of different extensions etc. By letting WDIO start the chromedriver for local development, we had the benefit of 'npm run selenium' directly being an alias to the 'wdio' command. This made it easy to pass additional arguments like --spec or --mochaOpts for running specific tests only and overall makes things easier to reason about from a developer perspective with fewer (required) layers of indirection you see and need to understand when debugging. But, this has also caused problems. Specifically, it means developers have to use the same version of Chrome locally as we specify in package.json which isn't very flexible. While we could try to keep this up-to-date roughly, that too isn't an option because the secure environments we recommend for local use (Quibble and Fresh-node) both use a Debian distro with typically older versions of Chromium than your local auto-updating Google Chrome. For now, let's go back to moving the responsibility of installing chromedriver together with the responsibility to install Chrome itself. == Changes == For CI, nothing changes (it already installs both). For developers using Quibble, Vagrant or Fresh nothing changes (already installs both). For developers who make their own secure environment, they will need to make sure chromedriver is installed, just as we required between 2017 and Aug 2019 before my commit 1955a8aa56. == How == wdio-chromedriver cannot start a foreign install because the protocol can change between versions, so unfortunately together with not using chromedriver from npm, we also can't use the wdio-chromedriver autostart mechanism. Instead, I'm bringing back Antoine's shell script that did this prior to ebda397c5450. But, with a few tweaks so that it forwards shell arguments, this way developers continue to enjoy the benefit of 1955a8aa56, which is that 'npm run selenium -- --spec foo.js' works. Bug: T234610 Change-Id: I03ca94315d0611d2b6abccc12cf9076d41b2c00e
2019-12-17 17:35:47 +00:00
"selenium": "./tests/selenium/selenium.sh",
"selenium-daily": "npm run selenium-test -- --mochaOpts.grep @daily",
selenium: Replace wdio-chromedriver with ./selenium.sh script This package was serving two purposes: * Install chromedriver automatically. * Start chromedriver automatically when using the 'npm run selenium' entry point (e.g. for local development). For the CI entry points (selenium-test, selenium-daily) the chromedriver is skipped. For those, we expect the CI runner to have started a chromedriver server already, which allows the server to continue running between different the test suites of different extensions etc. By letting WDIO start the chromedriver for local development, we had the benefit of 'npm run selenium' directly being an alias to the 'wdio' command. This made it easy to pass additional arguments like --spec or --mochaOpts for running specific tests only and overall makes things easier to reason about from a developer perspective with fewer (required) layers of indirection you see and need to understand when debugging. But, this has also caused problems. Specifically, it means developers have to use the same version of Chrome locally as we specify in package.json which isn't very flexible. While we could try to keep this up-to-date roughly, that too isn't an option because the secure environments we recommend for local use (Quibble and Fresh-node) both use a Debian distro with typically older versions of Chromium than your local auto-updating Google Chrome. For now, let's go back to moving the responsibility of installing chromedriver together with the responsibility to install Chrome itself. == Changes == For CI, nothing changes (it already installs both). For developers using Quibble, Vagrant or Fresh nothing changes (already installs both). For developers who make their own secure environment, they will need to make sure chromedriver is installed, just as we required between 2017 and Aug 2019 before my commit 1955a8aa56. == How == wdio-chromedriver cannot start a foreign install because the protocol can change between versions, so unfortunately together with not using chromedriver from npm, we also can't use the wdio-chromedriver autostart mechanism. Instead, I'm bringing back Antoine's shell script that did this prior to ebda397c5450. But, with a few tweaks so that it forwards shell arguments, this way developers continue to enjoy the benefit of 1955a8aa56, which is that 'npm run selenium -- --spec foo.js' works. Bug: T234610 Change-Id: I03ca94315d0611d2b6abccc12cf9076d41b2c00e
2019-12-17 17:35:47 +00:00
"selenium-test": "wdio ./tests/selenium/wdio.conf.js"
},
"devDependencies": {
selenium: Upgrade from webdriver v4 to v5 * Options no longer needed or no longer exist in wdio v5: - coloredLogs: Now always on. The underlying 'chalk' library can still be influenced via the FORCE_COLOR environment variable. - screenshotPath: Removed. Was already disabled in our config. - deprecationWarnings: Meh. - 'sync: true' – On by default when `@wdio/sync` is installed. The wdio v5 config generator doesn't recommend setting manually. * The selenium.sh script was removed. It existed to start and stop chromedriver for local use by developers. This is now done by the wdio-chromedriver-service. In WMF CI, Quibble starts its own chromedriver (as optimisation, reused across gated repos), which is why the 'selenium-test' entry points remains and skips this. * The wdio-mediawiki package now requires wdio v5 and Node 10. This doesn't affect extension repos because versions are pinned. Upgrade may happen at the earliest convenience. * Several WDIO methods changed names or signature. Full list at: <https://github.com/webdriverio/webdriverio/blob/v5.13.2/CHANGELOG.md#v500-2018-12-20> Highlights: - browser.element() is now browser.findElement() with "$()" as alias. - browser.localStorage replaced by browser.setLocalStorage. - browser.deleteCookie() requires `name` param. To delete all at once, there is a new method browser.deleteAllCookies(). - Commands that return data no longer wrapped in `{ value: … }`. Values are now returned directly. - Custom config keys are now under browser.config instead of browser.options. Renamed our username/password keys to be mw-prefixed, to avoid clashes and reduce confusion with similar config keys. - browser.click(selector) and browser.getText(selector) no longer exist. Use $(selector).click() or .getText() instead. * Fix "no such alert" warning from specs/page.js by removing the apparently redundant code. Bug: T234002 Bug: T213268 Change-Id: I908997569ca8457997af30cb29e98ac41fae3b64
2019-09-27 03:08:00 +00:00
"@wdio/cli": "5.13.2",
"@wdio/devtools-service": "5.13.2",
"@wdio/dot-reporter": "5.13.2",
"@wdio/junit-reporter": "5.13.2",
"@wdio/local-runner": "5.13.2",
"@wdio/mocha-framework": "5.13.2",
"@wdio/sauce-service": "5.13.2",
"@wdio/sync": "5.13.2",
"api-testing": "1.0.3",
"eslint-config-wikimedia": "0.15.0",
"eslint-plugin-vue": "^6.1.2",
"grunt": "1.0.4",
"grunt-banana-checker": "0.8.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-watch": "1.1.0",
"grunt-eslint": "22.0.0",
"grunt-karma": "3.0.2",
"grunt-stylelint": "0.12.0",
"grunt-svgmin": "5.0.0",
"jpeg-js": "0.3.5",
"karma": "4.4.1",
"karma-chrome-launcher": "3.1.0",
"karma-firefox-launcher": "1.3.0",
"karma-mocha-reporter": "2.2.5",
"karma-qunit": "4.0.0",
"postcss-less": "2.0.0",
"qunit": "2.9.3",
"stylelint-config-wikimedia": "0.7.0",
"wdio-mediawiki": "file:tests/selenium/wdio-mediawiki",
selenium: Upgrade from webdriver v4 to v5 * Options no longer needed or no longer exist in wdio v5: - coloredLogs: Now always on. The underlying 'chalk' library can still be influenced via the FORCE_COLOR environment variable. - screenshotPath: Removed. Was already disabled in our config. - deprecationWarnings: Meh. - 'sync: true' – On by default when `@wdio/sync` is installed. The wdio v5 config generator doesn't recommend setting manually. * The selenium.sh script was removed. It existed to start and stop chromedriver for local use by developers. This is now done by the wdio-chromedriver-service. In WMF CI, Quibble starts its own chromedriver (as optimisation, reused across gated repos), which is why the 'selenium-test' entry points remains and skips this. * The wdio-mediawiki package now requires wdio v5 and Node 10. This doesn't affect extension repos because versions are pinned. Upgrade may happen at the earliest convenience. * Several WDIO methods changed names or signature. Full list at: <https://github.com/webdriverio/webdriverio/blob/v5.13.2/CHANGELOG.md#v500-2018-12-20> Highlights: - browser.element() is now browser.findElement() with "$()" as alias. - browser.localStorage replaced by browser.setLocalStorage. - browser.deleteCookie() requires `name` param. To delete all at once, there is a new method browser.deleteAllCookies(). - Commands that return data no longer wrapped in `{ value: … }`. Values are now returned directly. - Custom config keys are now under browser.config instead of browser.options. Renamed our username/password keys to be mw-prefixed, to avoid clashes and reduce confusion with similar config keys. - browser.click(selector) and browser.getText(selector) no longer exist. Use $(selector).click() or .getText() instead. * Fix "no such alert" warning from specs/page.js by removing the apparently redundant code. Bug: T234002 Bug: T213268 Change-Id: I908997569ca8457997af30cb29e98ac41fae3b64
2019-09-27 03:08:00 +00:00
"webdriverio": "5.13.2"
}
}