mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-30 17:04:14 +00:00
6958b99f2e
Change-Id: I622f53bf5f56782b7a0529cdc6bb27c1315ff5a0
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
const Api = require( 'wdio-mediawiki/Api' ),
|
|
BlankPage = require( 'wdio-mediawiki/BlankPage' ),
|
|
LoginPage = require( 'wdio-mediawiki/LoginPage' ),
|
|
Util = require( 'wdio-mediawiki/Util' );
|
|
|
|
class UserPreferences {
|
|
async loginAsOther() {
|
|
const username = Util.getTestString( 'User-' );
|
|
const password = Util.getTestString();
|
|
await Api.createAccount( await Api.bot(), username, password );
|
|
await LoginPage.login( username, password );
|
|
}
|
|
|
|
async setPreferences( preferences ) {
|
|
await BlankPage.open();
|
|
Util.waitForModuleState( 'mediawiki.base' );
|
|
|
|
return await browser.execute( ( prefs ) => mw.loader.using( 'mediawiki.api' ).then( () => new mw.Api().saveOptions( prefs ) ), preferences );
|
|
}
|
|
|
|
async enableWikitext2010EditorWithCodeMirror() {
|
|
await this.setPreferences( {
|
|
usebetatoolbar: '1',
|
|
usecodemirror: '1',
|
|
'visualeditor-enable': '0',
|
|
'visualeditor-newwikitext': '0'
|
|
} );
|
|
}
|
|
|
|
async enableWikitext2017EditorWithCodeMirror() {
|
|
await this.setPreferences( {
|
|
usebetatoolbar: null,
|
|
usecodemirror: '1',
|
|
'visualeditor-enable': '1',
|
|
'visualeditor-newwikitext': '1'
|
|
} );
|
|
}
|
|
}
|
|
|
|
module.exports = new UserPreferences();
|