The basic functionality of being able to preview an edit is currently
not covered by a test, as far as I can see.
The assertion for a wpTextbox2 that should *not* be there is a result of
the issue documented at T209012, where the EditPage::isConflict flag was
accidentially set. This assertion makes sure accidential conflicts can't
happen again, no matter which extension might cause it.
Bug: T210758
Change-Id: Iae723430b3a88079ad3499429e65c29817eca67e
class EditPage extends Page {
get content() { return browser.element( '#wpTextbox1' ); }
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 heading() { return browser.element( '#firstHeading' ); }
get save() { return browser.element( '#wpSave' ); }
+ get previewButton() { return browser.element( '#wpPreview' ); }
openForEditing( title ) {
super.openTitle( title, { action: 'edit' } );
}
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 );
edit( name, content ) {
this.openForEditing( name );
this.content.setValue( content );
name = Util.getTestString( 'BeforeEach-name-' );
} );
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 );
it( 'should be creatable', function () {
// create
EditPage.edit( name, content );