api-testing: Add test for creating and saving a page

Testing the visualeditoredit action API for VisualEditor.

Change-Id: I951ecf1c71e2ee66e3d1fc15a29b312b8fe9956e
This commit is contained in:
Emeka Chukwukere 2022-09-26 13:40:38 -05:00 committed by Derick Alangi
parent 77565dabf3
commit db6cc66749

View file

@ -6,6 +6,7 @@ describe( 'Visual Editor API', function () {
// const titles = ( list ) => list.map( ( p ) => utils.dbkey( p.title ) );
const title = utils.title( 'VisualEditor' );
const newPage = utils.title( 'VisualEditorNew' );
let alice;
let pageInfo;
@ -50,4 +51,22 @@ describe( 'Visual Editor API', function () {
const result = await alice.action( 'visualeditor', { page: title, paction: 'wikitext' } );
assert.equal( result.visualeditor.result, 'success' );
} );
it( 'Should create page, edit and save page', async () => {
const token = await alice.token();
const html = '<p>save paction</p>';
const summary = 'save test workflow';
const result = await alice.action(
'visualeditoredit',
{
page: newPage,
paction: 'save',
token: token,
html: html,
summary: summary
},
'post'
);
assert.equal( result.visualeditoredit.result, 'success' );
} );
} );