| 1 | 'use strict'; |
| 2 | |
| 3 | const Page = require( 'wdio-mediawiki/Page' ); |
| 4 | |
| 5 | class ProtectPage extends Page { |
| 6 | get reason() { |
| 7 | return $( '#mwProtect-reason input' ); |
| 8 | } |
| 9 | |
| 10 | get editProtectSelect() { |
| 11 | return $( '#mwProtect-level-edit select' ); |
| 12 | } |
| 13 | |
| 14 | get submit() { |
| 15 | return $( '#mw-Protect-submit' ); |
| 16 | } |
| 17 | |
| 18 | async open( title ) { |
| 19 | return super.openTitle( title, { action: 'protect' } ); |
| 20 | } |
| 21 | |
| 22 | async protect( title, reason, editProtect ) { |
| 23 | await this.open( title ); |
| 24 | await this.reason.setValue( reason ); |
| 25 | await this.editProtectSelect.selectByVisibleText( editProtect ); |
| 26 | await this.submit.click(); |
| 27 | } |
| 28 | |
| 29 | } |
| 30 | |
| 31 | module.exports = new ProtectPage(); |