Pick a simple test from mediawiki/core, for example User should be able to create account and implement it using Puppeteer. Feel free to pick any other test, this is just an example.
webdriverio implementation:
describe( 'User', function () { it( 'should be able to create account', function () { // create CreateAccountPage.createAccount( username, password ); // check assert.strictEqual( CreateAccountPage.heading.getText(), `Welcome, ${username}!` ); } ); } );
class CreateAccountPage extends Page { get username() { return $( '#wpName2' ); } get password() { return $( '#wpPassword2' ); } get confirmPassword() { return $( '#wpRetype' ); } get create() { return $( '#wpCreateaccount' ); } get heading() { return $( '#firstHeading' ); } open() { super.openTitle( 'Special:CreateAccount' ); } createAccount( username, password ) { this.open(); this.username.setValue( username ); this.password.setValue( password ); this.confirmPassword.setValue( password ); this.create.click(); } }
Steps:
- open Special:CreateAccount page
- populate required fileds with random strings
- click Create your account button
Assertions:
- check that text Welcome, ${username}! appears on the page
For more information on page object pattern see (draft) page https://www.mediawiki.org/wiki/Selenium/Explanation/Page_object_pattern
Students:
- @AlQaholic007 584908
- @Gbahdeyboh 587574