Git Product home page Git Product logo

snyk-community / malu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wikimedia/malu

0.0 1.0 0.0 15 KB

A basic JS end-to-end test harness for MediaWiki. This is a mirror of https://phabricator.wikimedia.org/diffusion/GMALU/ please see https://www.mediawiki.org/wiki/Developer_access for information about contributing.

Home Page: https://phabricator.wikimedia.org/project/view/1905/

License: MIT License

Ruby 3.53% JavaScript 96.47%

malu's Introduction

Malu

A basic JS end-to-end test harness for MediaWiki.

Features

  • Testing against a single MediaWiki instance with any browser supported by selenium-webdriver's builder
  • Configuration via the standard MW_SERVER and MW_SCRIPT_PATH environment variables
  • Anonymous API access and autoconfiguration of the article path by querying siteinfo
  • Support for taking screenshots
  • Basic page objects using CSS strings by default but supporting selenium-webdriver's locators for more complex definitions
  • Qualifying of relative page paths based on the wiki/site context

Setup

Make sure you have a newish version of Node installed. On OS X, do:

brew install node

Add malu to your package.json and install.

npm install

TODO: implement a generator and add documentation about running it

Running tests

Run the entire suite of tests using npm run.

npm run e2e

Run a single test file by executing mocha directly and passing the specific filename. You'll need to specify the mocha timeout directly on the command line as well.

node_modules/.bin/mocha --timeout 10000 -- tests/e2e/scenarios/{filename}.js

Currently, this test suite assumes you have a MediaWiki install running at http://127.0.0.1:8080/ (the default MediaWiki-Vagrant setup). If you want to run the tests against a different environment, you must set MW_SERVER and MW_SCRIPT_PATH accordingly.

export MW_SERVER=http://en.wikipedia.beta.wmflabs.org
export MW_SCRIPT_PATH=/w
node_modules/.bin/mocha --timeout 10000 -- tests/e2e/scenarios/{filename}.js

A single test within a scenario can be executed using Mocha's -g argument.

node_modules/.bin/mocha -g 'Just this test' -- tests/e2e/scenarios/{filename}.js

Debugging

Debugging scenarios is easy. Just add a debugger breakpoint and invoke Mocha with mocha debug.

node_modules/.bin/mocha debug --timeout 10000 -- tests/e2e/scenarios/{filename}.js
                        ^^^^^

malu's People

Contributors

marxarelli avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.