forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MM-29278 Make database error message easier to understand on Cypress …
…test (mattermost#6630) * make database error message easier to understand on Cypress test * Update e2e/cypress/support/db_commands.d.ts Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
- Loading branch information
1 parent
d17b29a
commit 486e807
Showing
6 changed files
with
97 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
/// <reference types="cypress" /> | ||
|
||
// *************************************************************** | ||
// Each command should be properly documented using JSDoc. | ||
// See https://jsdoc.app/index.html for reference. | ||
// Basic requirements for documentation are the following: | ||
// - Meaningful description | ||
// - Each parameter with `@params` | ||
// - Return value with `@returns` | ||
// - Example usage with `@example` | ||
// Custom command should follow naming convention of having `db` prefix, e.g. `dbGetUser`. | ||
// *************************************************************** | ||
|
||
declare namespace Cypress { | ||
interface Chainable<Subject = any> { | ||
|
||
/** | ||
* Gets server config, and assert if it matches with the database connection being used by Cypress | ||
* | ||
* @example | ||
* cy.apiRequireServerDBToMatch(); | ||
*/ | ||
apiRequireServerDBToMatch(): void; | ||
|
||
/** | ||
* Gets active sessions of a user on a given username or user ID directly from the database | ||
* @param {String} username | ||
* @param {String} userId | ||
* @param {String} limit - maximum number of active sessions to return, e.g. 50 (default) | ||
* @returns {Object} user - user object | ||
* @returns {[Object]} sessions - an array of active sessions | ||
*/ | ||
dbGetActiveUserSessions({username: string, userId, limit}): Chainable<Record<string, any>>; | ||
|
||
/** | ||
* Gets active sessions of a user on a given username or user ID directly from the database | ||
* @param {Object} options | ||
* @param {String} options.username | ||
* @param {String} options.userId | ||
* @param {String} options.limit - maximum number of active sessions to return, e.g. 50 (default) | ||
* @returns {UserProfile} user - user object | ||
* @returns {[Object]} sessions - an array of active sessions | ||
*/ | ||
dbGetActiveUserSessions(options: Record<string, any>): Chainable<Record<string, any>>; | ||
|
||
/** | ||
* Gets user on a given username directly from the database | ||
* @param {Object} options | ||
* @param {String} options.username | ||
* @returns {UserProfile} user - user object | ||
*/ | ||
dbGetUser(options: Record<string, string>): Chainable<UserProfile>; | ||
|
||
/** | ||
* Gets session of a user on a given session ID directly from the database | ||
* @param {Object} options | ||
* @param {String} options.sessionId | ||
* @returns {Session} session | ||
*/ | ||
dbGetUserSession(options: Record<string, string>): Chainable<Session>; | ||
|
||
/** | ||
* Updates session of a user on a given user ID and session ID with fields to update directly from the database | ||
* @param {Object} options | ||
* @param {String} options.sessionId | ||
* @param {String} options.userId | ||
* @param {Object} options.fieldsToUpdate - will update all except session ID and user ID | ||
* @returns {Session} session | ||
*/ | ||
dbUpdateUserSession(options: Record<string, any>): Chainable<Session>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters