NOTE: Pre-requisites for this task are {T248016} and {T248232}.
NOTE: Microsoft Playwright is relatively new and therefore is currently lacking documentation. However it appears quite promising from what it promises to give in near future. The aim of this task is to just play around with Microsoft Playwright.
Pick a simple test from mediawiki/core, for example User should be able to create account and implement it using [[ https://github.com/microsoft/playwright | Microsoft Playwright ]]. Feel free to pick any other test, this is just an example.
**WebdriverIO** implementation:
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/tests/selenium/specs/user.js#21
```
describe( 'User', function () {
it( 'should be able to create account', function () {
// create
CreateAccountPage.createAccount( username, password );
// check
assert.strictEqual( CreateAccountPage.heading.getText(), `Welcome, ${username}!` );
} );
} );
```
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/master/tests/selenium/pageobjects/createaccount.page.js
```
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 [[ https://gerrit.wikimedia.org/r/c/mediawiki/core/+/588667 | 588667 ]]
[] @Gbahdeyboh [[ https://gerrit.wikimedia.org/r/c/mediawiki/core/+/588937 | 588937 ]]