wiki.techinc.nl/tests/api-testing/action/PrefixSearch.js
Ed Sanders 8b720e9bd6 eslint: Update to eslint-config-wikimedia 0.16.0
* valid-jsdoc replaced with jsdoc plugin
* New /selenium config

Change-Id: I471eebac0312cb25c539c3f6a3ecfc7cfd4ed8d6
2020-06-02 21:32:56 +01:00

28 lines
843 B
JavaScript

'use strict';
const { action, assert, utils } = require( 'api-testing' );
describe( 'Prefix Search', function () {
const prefix = `R${utils.title( utils.uniq() )}`;
const firstPage = `${prefix}_first`;
const secondPage = `${prefix}_second`;
const thirdPage = `${prefix}_third`;
let alice;
before( async () => {
alice = await action.alice();
const text = 'Random Text';
await alice.edit( firstPage, { text } );
await alice.edit( secondPage, { text } );
await alice.edit( thirdPage, { text } );
} );
it( 'should search for pages with the `${prefix}` prefix', async () => {
const result = await alice.list( 'prefixsearch', { pssearch: `${prefix}`, pslimit: 100 } );
const pageTitles = result.map( ( p ) => utils.dbkey( p.title ) );
assert.sameMembers( pageTitles, [ firstPage, secondPage, thirdPage ] );
} );
} );