2020-12-10 22:45:56 +01:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
2020-12-11 19:34:11 +01:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
|
2020-12-10 22:45:56 +01:00
|
|
|
describe('Create and delete board / card', () => {
|
|
|
|
it('Can create and delete a board and card', () => {
|
|
|
|
cy.visit('/');
|
|
|
|
cy.contains('+ Add Board').click({force: true});
|
|
|
|
cy.contains('Empty board').click({force: true});
|
|
|
|
cy.get('.BoardComponent').should('exist');
|
|
|
|
|
|
|
|
const timestamp = new Date().toLocaleString();
|
|
|
|
|
|
|
|
// Board title
|
|
|
|
const boardTitle = `Test Board (${timestamp})`;
|
|
|
|
cy.get('.ViewTitle>.Editable.title').
|
|
|
|
type(boardTitle).
|
|
|
|
type('{enter}').
|
|
|
|
should('have.value', boardTitle);
|
|
|
|
|
2020-12-11 19:34:11 +01:00
|
|
|
// Rename board view
|
|
|
|
const boardViewTitle = `Test board (${timestamp})`;
|
|
|
|
cy.get('.ViewHeader').
|
2020-12-11 20:10:25 +01:00
|
|
|
contains('.octo-editable', 'Board view').
|
2020-12-11 19:34:11 +01:00
|
|
|
clear().
|
|
|
|
type(boardViewTitle).
|
|
|
|
type('{esc}');
|
|
|
|
|
|
|
|
cy.get('.ViewHeader').
|
|
|
|
contains('.octo-editable', boardViewTitle).
|
|
|
|
should('exist');
|
|
|
|
|
2020-12-10 22:45:56 +01:00
|
|
|
// Create card
|
|
|
|
cy.get('.ViewHeader').contains('New').click();
|
|
|
|
cy.get('.CardDetail').should('exist');
|
|
|
|
|
|
|
|
// Card title
|
|
|
|
const cardTitle = `Test Card (${timestamp})`;
|
|
|
|
cy.get('.CardDetail>.Editable.title').
|
|
|
|
type(cardTitle).
|
|
|
|
type('{enter}').
|
|
|
|
should('have.value', cardTitle);
|
|
|
|
|
|
|
|
// Close card
|
|
|
|
cy.get('.Dialog.dialog-back').click({force: true});
|
|
|
|
|
2020-12-11 19:34:11 +01:00
|
|
|
// Create table view
|
|
|
|
// cy.intercept('POST', '/api/v1/blocks').as('insertBlocks');
|
|
|
|
cy.get('.ViewHeader').get('.DropdownIcon').first().parent().click();
|
|
|
|
cy.get('.ViewHeader').contains('Add View').click();
|
|
|
|
cy.get('.ViewHeader').contains('Add View').click();
|
|
|
|
cy.get('.ViewHeader').contains('Add View').parent().contains('Table').click();
|
|
|
|
|
|
|
|
// cy.wait('@insertBlocks');
|
|
|
|
|
|
|
|
// Wait for round-trip to complete and DOM to update
|
2020-12-11 20:10:25 +01:00
|
|
|
cy.contains('.octo-editable', 'Table view').should('exist');
|
2020-12-11 19:34:11 +01:00
|
|
|
|
|
|
|
// Card should exist in table
|
|
|
|
cy.get(`.TableRow [value='${cardTitle}']`).should('exist');
|
|
|
|
|
|
|
|
// Rename table view
|
|
|
|
const tableViewTitle = `Test table (${timestamp})`;
|
|
|
|
cy.get('.ViewHeader').
|
2020-12-11 20:10:25 +01:00
|
|
|
contains('.octo-editable', 'Table view').
|
2020-12-11 19:34:11 +01:00
|
|
|
clear().
|
|
|
|
type(tableViewTitle).
|
|
|
|
type('{esc}');
|
|
|
|
|
|
|
|
cy.get('.ViewHeader').
|
|
|
|
contains('.octo-editable', tableViewTitle).
|
|
|
|
should('exist');
|
|
|
|
|
|
|
|
// Sort
|
|
|
|
cy.get('.ViewHeader').contains('Sort').click();
|
|
|
|
cy.get('.ViewHeader').contains('Sort').parent().contains('Name').click();
|
|
|
|
|
2020-12-10 22:45:56 +01:00
|
|
|
// Delete board
|
|
|
|
cy.get('.Sidebar .octo-sidebar-list').
|
|
|
|
contains(boardTitle).first().
|
|
|
|
next().
|
|
|
|
find('.Button.IconButton').
|
|
|
|
click({force: true});
|
|
|
|
|
2020-12-11 20:10:25 +01:00
|
|
|
cy.contains('Delete board').click({force: true});
|
2020-12-10 22:45:56 +01:00
|
|
|
|
2020-12-11 19:34:11 +01:00
|
|
|
// // Board should not exist
|
2020-12-10 22:45:56 +01:00
|
|
|
cy.contains(boardTitle).should('not.exist');
|
|
|
|
});
|
|
|
|
});
|