main

mattermost/focalboard

Last updated at: 29/12/2023 09:39

global.d.ts

TLDR

This file defines the global TypeScript declarations for the Cypress framework. It includes types and interfaces related to user login data, API calls, and UI interactions.

Methods

apiRegisterUser

Creates a new user by making an API request to the server. The data parameter contains the user's login data and email. The optional token parameter is used for authentication. If failOnError is set to true, the test case will fail if an error occurs during the API request.

apiLoginUser

Logs in a user by making an API request to the server. The data parameter contains the user's login data.

apiGetMe

Retrieves user information by making an API request to the server. Returns a Chainable object that includes a string representing the server response.

apiChangePassword

Changes the user's password by making an API request to the server. The userId parameter specifies the user ID, oldPassword is the current password, and newPassword is the new desired password.

apiInitServer

Initializes the server by making an API request. Returns a Chainable object.

apiDeleteBoard

Deletes a board by making an API request to the server. The id parameter specifies the ID of the board to be deleted.

apiResetBoards

Resets all boards by making an API request to the server. Returns a Chainable object.

apiSkipTour

Skips the tour for a user by making an API request to the server. The userID parameter specifies the ID of the user.

uiCreateNewBoard

Creates a new board in the user interface. The optional title parameter specifies the title of the board.

uiAddNewGroup

Adds a new group in the user interface. The optional name parameter specifies the name of the group.

uiAddNewCard

Adds a new card in the user interface. The optional title parameter specifies the title of the card, and columnIndex specifies the index of the column where the card should be added.

uiCreateBoard

Creates a board on a given menu item in the user interface. The item parameter specifies one of the template menu options, such as 'Empty board'.

uiCreateEmptyBoard

Creates an empty board in the user interface.

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

declare namespace Cypress {
    type LoginData = {
        username: string
        password: string
    }
    type UserData = LoginData & {
        email: string
    }
    interface Chainable {
        apiRegisterUser: (data: UserData, token?: string, failOnError?: boolean) => Chainable
        apiLoginUser: (data: LoginData) => Chainable
        apiGetMe: () => Chainable<string>
        apiChangePassword: (userId: string, oldPassword: string, newPassword: string) => Chainable
        apiInitServer: () => Chainable
        apiDeleteBoard: (id: string) => Chainable
        apiResetBoards: () => Chainable
        apiSkipTour: (userID: string) => Chainable

        uiCreateNewBoard: (title?: string) => Chainable
        uiAddNewGroup: (name?: string) => Chainable
        uiAddNewCard: (title?: string, columnIndex?: number) => Chainable

        /**
         * Create a board on a given menu item.
         *
         * @param {string} item - one of the template menu options, ex. 'Empty board'
         */
        uiCreateBoard: (item: string) => Chainable
        uiCreateEmptyBoard: () => Chainable
    }
}