mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
Merge "Add basic end-to-end tests for action=visualeditor"
This commit is contained in:
commit
d58d1ed036
|
@ -2,5 +2,10 @@
|
|||
"root": true,
|
||||
"extends": [
|
||||
"wikimedia/server"
|
||||
]
|
||||
],
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"node": true,
|
||||
"mocha": true
|
||||
}
|
||||
}
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -17,6 +17,7 @@ vendor
|
|||
screenshots/*.png
|
||||
.eslintcache
|
||||
tests/selenium/log
|
||||
.api-testing.config.json
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
"private": true,
|
||||
"description": "Build tools for the VisualEditor-MediaWiki extension.",
|
||||
"scripts": {
|
||||
"eslint": "eslint --cache --ext .js,.json .",
|
||||
"eslint-fix": "eslint --cache --ext .js,.json --fix .",
|
||||
"api-testing": "mocha --timeout 0 --parallel --recursive tests/api-testing",
|
||||
"test": "grunt test",
|
||||
"doc": "jsduck",
|
||||
|
|
|
@ -1,3 +1,53 @@
|
|||
'use strict';
|
||||
|
||||
// TBD
|
||||
const { action, assert, utils } = require( 'api-testing' );
|
||||
|
||||
describe( 'Visual Editor API', function () {
|
||||
// const titles = ( list ) => list.map( ( p ) => utils.dbkey( p.title ) );
|
||||
|
||||
const title = utils.title( 'VisualEditor' );
|
||||
|
||||
let alice;
|
||||
let pageInfo;
|
||||
|
||||
before( async () => {
|
||||
alice = await action.alice();
|
||||
|
||||
const textX = 'Hello World! {{Template Requests}}';
|
||||
|
||||
pageInfo = await
|
||||
alice.edit( title, { text: textX } );
|
||||
|
||||
} );
|
||||
// https://en.wikipedia.org/w/api.php?action=visualeditor&format=json&page=Davido%20Adeleke&paction=metadata
|
||||
|
||||
it( 'can load metadata', async () => {
|
||||
const result = await alice.action( 'visualeditor', { page: title, paction: 'metadata' } );
|
||||
assert.equal( result.visualeditor.oldid, pageInfo.newrevid );
|
||||
} );
|
||||
|
||||
it( 'able to parse', async () => {
|
||||
const result = await alice.action( 'visualeditor', { page: title, paction: 'parse' } );
|
||||
assert.equal( result.visualeditor.result, 'success' );
|
||||
} );
|
||||
|
||||
it( 'able to parsedoc', async () => {
|
||||
const result = await alice.action( 'visualeditor', { page: title, paction: 'parsedoc', wikitext: 'test' } );
|
||||
assert.equal( result.visualeditor.result, 'success' );
|
||||
} );
|
||||
|
||||
it( 'able to parsefragment', async () => {
|
||||
const result = await alice.action( 'visualeditor', { page: title, paction: 'parsefragment', wikitext: 'test' } );
|
||||
assert.equal( result.visualeditor.result, 'success' );
|
||||
} );
|
||||
|
||||
it( 'templatesUsed', async () => {
|
||||
const result = await alice.action( 'visualeditor', { page: title, paction: 'templatesused', wikitext: 'test' } );
|
||||
assert.include( result.visualeditor, 'Template Requests' );
|
||||
} );
|
||||
|
||||
it( 'can load metadata', async () => {
|
||||
const result = await alice.action( 'visualeditor', { page: title, paction: 'wikitext' } );
|
||||
assert.equal( result.visualeditor.result, 'success' );
|
||||
} );
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue