blob: 558209ed41f8768e804e08f19b05b0580d2030c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
'use strict';
const Page = require( 'wdio-mediawiki/Page' );
class ViewEditPage extends Page {
// Here we avoid things depending on the config, e.g. group and global
get filterId() { return $( '#mw-abusefilter-edit-id .mw-input' ); }
get name() { return $( 'input[name="wpFilterDescription"]' ); }
get rules() { return $( '#wpFilterRules' ); }
get comments() { return $( 'textarea[name="wpFilterNotes"]' ); }
get hidden() { return $( 'input[name="wpFilterHidden"]' ); }
get enabled() { return $( 'input[name="wpFilterEnabled"]' ); }
get deleted() { return $( 'input[name="wpFilterDeleted"]' ); }
// @todo This assumes that warn is enabled in the config, which is true by default
get warnCheckbox() { return $( 'input[name="wpFilterActionWarn"]' ); }
get warnOtherMessage() { return $( 'input[name="wpFilterWarnMessageOther"]' ); }
get submitButton() { return $( '#mw-abusefilter-editing-form input[type="submit"]' ); }
get error() { return $( '.errorbox' ); }
get warning() { return $( '.warningbox' ); }
submit() {
this.submitButton.waitForClickable();
this.submitButton.click();
}
/**
* Conveniency: the ace editor is hard to manipulate, and working with
* the hidden textarea isn't great (sendKeys is not processed)
*/
switchEditor() {
const button = $( '#mw-abusefilter-switcheditor' );
button.waitForClickable();
button.click();
}
setWarningMessage( msg ) {
$( 'select[name="wpFilterWarnMessage"]' ).selectByAttribute( 'value', 'other' );
this.warnOtherMessage.setValue( msg );
}
invalidateToken() {
$( '#mw-abusefilter-editing-form input[name="wpEditToken"]' ).setValue( '' );
}
open( subpage ) {
super.openTitle( 'Special:AbuseFilter/' + subpage );
}
}
module.exports = new ViewEditPage();
|