wiki.techinc.nl/tests/api-testing/action/Autopatrolling.js
Clara Andrew-Wani ac4dec907b Add API-testing to core
Bug: T236680
Depends-On: I0110de1539e4d6d9d6a58d1a645c1a1c02d8127f
Change-Id: I827dc895719cc68738ebb425f8471ac38caa49aa
2019-12-19 13:20:12 -05:00

30 lines
1 KiB
JavaScript

const { assert, action, utils } = require( 'api-testing' );
describe( 'Testing default autopatrolling rights', function () {
const anonymousUser = action.getAnon();
let title, mindy;
before( async () => {
title = await utils.title( 'Autopatrol_' );
mindy = await action.mindy();
} );
it( 'should edit page as a user in autopatrol group', async () => {
await mindy.edit( title, { text: 'Is this page autopatrolled?' } );
} );
it( 'should edit page as an anonymous user', async () => {
await anonymousUser.edit( title, { text: 'Anonymous: Is this page autopatrolled?' } );
} );
it( 'should confirm autopatrolling rights', async () => {
const anonUserInfo = await anonymousUser.meta( 'userinfo', {} );
const result = await mindy.list( 'recentchanges', { rctitle: title, rcprop: 'patrolled|user' } );
assert.lengthOf( result, 2 );
assert.sameDeepMembers( result, [
{ anon: '', type: 'edit', unpatrolled: '', user: anonUserInfo.name },
{ type: 'new', patrolled: '', autopatrolled: '', user: mindy.username }
] );
} );
} );