main

mattermost/focalboard

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

ui_commands.ts

TLDR

The ui_commands.ts file contains custom Cypress commands for creating boards in a user interface.

Methods

uiCreateBoard

This method creates a new board in the user interface. It takes an item parameter specifying the name of the board to be created. The method performs the following steps:

  1. Logs a message indicating the creation of a new board with the specified item name.
  2. Checks if the "+ Add board" element is visible and clicks on it.
  3. Clicks on the element that contains the specified item name.
  4. Clicks on the "Use this template" element forcefully.
  5. Waits for 1000 milliseconds.

uiCreateEmptyBoard

This method creates a new empty board in the user interface. It performs the following steps:

  1. Logs a message indicating the creation of a new empty board.
  2. Checks if the "+ Add board" element is visible and clicks on it.
  3. Waits for 500 milliseconds.
  4. Clicks on the "Create an empty board" element forcefully.
  5. Waits for 1000 milliseconds.
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

/* eslint-disable cypress/no-unnecessary-waiting */

Cypress.Commands.add('uiCreateBoard', (item: string) => {
    cy.log(`Create new board: ${item}`)

    cy.contains('+ Add board').should('be.visible').click()

    cy.contains(item).click()

    cy.contains('Use this template').click({force: true}).wait(1000)
})

Cypress.Commands.add('uiCreateEmptyBoard', () => {
    cy.log('Create new empty board')

    cy.contains('+ Add board').should('be.visible').click().wait(500)
    return cy.contains('Create an empty board').click({force: true}).wait(1000)
})