You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Cypress: add a way to specify the prefix for userIDs (#9787)
This helps a lot with debugging tests where there are multiple users.
This commit is contained in:
committed by
GitHub
parent
3ec75fdd3c
commit
ddfa627ce6
@ -22,6 +22,10 @@ import { Credentials } from "./synapse";
|
||||
import Chainable = Cypress.Chainable;
|
||||
|
||||
interface CreateBotOpts {
|
||||
/**
|
||||
* A prefix to use for the userid. If unspecified, "bot_" will be used.
|
||||
*/
|
||||
userIdPrefix?: string;
|
||||
/**
|
||||
* Whether the bot should automatically accept all invites.
|
||||
*/
|
||||
@ -41,6 +45,7 @@ interface CreateBotOpts {
|
||||
}
|
||||
|
||||
const defaultCreateBotOptions = {
|
||||
userIdPrefix: "bot_",
|
||||
autoAcceptInvites: true,
|
||||
startClient: true,
|
||||
bootstrapCrossSigning: true,
|
||||
@ -153,7 +158,7 @@ function setupBotClient(
|
||||
|
||||
Cypress.Commands.add("getBot", (synapse: SynapseInstance, opts: CreateBotOpts): Chainable<MatrixClient> => {
|
||||
opts = Object.assign({}, defaultCreateBotOptions, opts);
|
||||
const username = Cypress._.uniqueId("userId_");
|
||||
const username = Cypress._.uniqueId(opts.userIdPrefix);
|
||||
const password = Cypress._.uniqueId("password_");
|
||||
return cy.registerUser(synapse, username, password, opts.displayName).then((credentials) => {
|
||||
cy.log(`Registered bot user ${username} with displayname ${opts.displayName}`);
|
||||
|
Reference in New Issue
Block a user