wiki.techinc.nl/tests/selenium/pageobjects/edit.page.js
Thiemo Kreuz 3b03ea9bdc Add browser test for preview functionality to MediaWiki core
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
2018-12-07 16:27:45 +01:00

34 lines
1,005 B
JavaScript

const Page = require( 'wdio-mediawiki/Page' ),
Api = require( 'wdio-mediawiki/Api' );
class EditPage extends Page {
get content() { return browser.element( '#wpTextbox1' ); }
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 );
this.save.click();
}
// @deprecated Use wdio-mediawiki/Api#edit() instead.
apiEdit( name, content ) {
return Api.edit( name, content );
}
}
module.exports = new EditPage();