wiki.techinc.nl/tests/selenium/wdio-mediawiki/CreateAccountPage.js
Máté Szabó d150c66840 auth: Disable irrelevant account creation fields for temp users
Why:

- When signing up for an account, temporary users are currently forced
  to provide a reason for creating an account, and also have the option
  to send a temporary password to an email address.
- Neither of these options are useful for temporary users wanting to
  create a full user account.

What:

- Don't show these two form fields on Special:CreateAccount for temporary users.
- Add a functional test for the temporary user account creation flow.

Bug: T328718
Change-Id: Ie545857f7647be89d9462ec2b0def48690f0a2bf
2024-09-10 16:45:56 +02:00

69 lines
1.4 KiB
JavaScript

'use strict';
const Page = require( './Page' );
const Util = require( 'wdio-mediawiki/Util' );
class CreateAccountPage extends Page {
get username() {
return $( '#wpName2' );
}
get password() {
return $( '#wpPassword2' );
}
get confirmPassword() {
return $( '#wpRetype' );
}
get create() {
return $( '#wpCreateaccount' );
}
get heading() {
return $( '#firstHeading' );
}
get tempPasswordInput() {
return $( '#wpCreateaccountMail' );
}
get reasonInput() {
return $( '#wpReason' );
}
open() {
super.openTitle( 'Special:CreateAccount' );
}
/**
* Navigate to Special:CreateAccount, then fill out and submit the account creation form.
*
* @param {string} username
* @param {string} password
* @return {Promise<void>}
*/
async createAccount( username, password ) {
await this.open();
await this.submitForm( username, password );
}
/**
* Fill out and submit the account creation form on Special:CreateAccount.
* The browser is assumed to have already navigated to this page.
*
* @param {string} username
* @param {string} password
* @return {Promise<void>}
*/
async submitForm( username, password ) {
await Util.waitForModuleState( 'mediawiki.special.createaccount', 'ready', 10000 );
await this.username.setValue( username );
await this.password.setValue( password );
await this.confirmPassword.setValue( password );
await this.create.click();
}
}
module.exports = new CreateAccountPage();