class EditPage extends Page {
get content() { return browser.element( '#wpTextbox1' ); }
- get displayedContent() { return browser.element( '#mw-content-text' ); }
+ get conflictingContent() { return browser.element( '#wpTextbox2' ); }
+ get displayedContent() { return browser.element( '#mw-content-text .mw-parser-output' ); }
get heading() { return browser.element( '#firstHeading' ); }
get save() { return browser.element( '#wpSave' ); }
+ get previewButton() { return browser.element( '#wpPreview' ); }
openForEditing( title ) {
super.openTitle( title, { action: 'edit' } );
}
+ preview( name, content ) {
+ this.openForEditing( name );
+ this.content.setValue( content );
+ this.previewButton.click();
+ }
+
edit( name, content ) {
this.openForEditing( name );
this.content.setValue( content );
name = Util.getTestString( 'BeforeEach-name-' );
} );
+ it( 'should be previewable', function () {
+ EditPage.preview( name, content );
+
+ assert.strictEqual( EditPage.heading.getText(), 'Creating ' + name );
+ assert.strictEqual( EditPage.displayedContent.getText(), content );
+ assert( EditPage.content.isVisible(), 'editor is still present' );
+ assert( !EditPage.conflictingContent.isVisible(), 'no edit conflict happened' );
+ // provoke and dismiss reload warning due to unsaved content
+ browser.url( 'data:text/html,Done' );
+ try {
+ browser.alertAccept();
+ } catch ( e ) {}
+ } );
+
it( 'should be creatable', function () {
// create
EditPage.edit( name, content );