2020-12-10 23:45:56 +02:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
2020-12-17 22:02:12 +02:00
|
|
|
/* eslint-disable max-nested-callbacks */
|
|
|
|
|
2020-12-11 20:34:11 +02:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
|
2020-12-10 23:45:56 +02:00
|
|
|
describe('Create and delete board / card', () => {
|
2020-12-17 22:02:12 +02:00
|
|
|
const timestamp = new Date().toLocaleString();
|
|
|
|
const boardTitle = `Test Board (${timestamp})`;
|
|
|
|
const cardTitle = `Test Card (${timestamp})`;
|
|
|
|
|
2021-02-10 02:34:54 +02:00
|
|
|
beforeEach(() => {
|
2021-04-16 13:42:37 +02:00
|
|
|
localStorage.setItem('focalboardSessionId', 'TESTTOKEN');
|
2021-03-30 22:06:39 +02:00
|
|
|
localStorage.setItem('language', 'en');
|
2021-04-16 13:42:37 +02:00
|
|
|
cy.expect(localStorage.getItem('focalboardSessionId')).to.eq('TESTTOKEN');
|
2021-02-10 02:34:54 +02:00
|
|
|
});
|
|
|
|
|
2020-12-10 23:45:56 +02:00
|
|
|
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');
|
2020-12-17 22:02:12 +02:00
|
|
|
});
|
2020-12-10 23:45:56 +02:00
|
|
|
|
2020-12-17 22:02:12 +02:00
|
|
|
it('Can set the board title', () => {
|
2020-12-10 23:45:56 +02:00
|
|
|
// Board title
|
2021-05-27 12:58:07 +02:00
|
|
|
cy.get('.Editable.title').
|
2020-12-10 23:45:56 +02:00
|
|
|
type(boardTitle).
|
|
|
|
type('{enter}').
|
|
|
|
should('have.value', boardTitle);
|
2020-12-17 22:02:12 +02:00
|
|
|
});
|
2020-12-10 23:45:56 +02:00
|
|
|
|
2021-09-08 06:52:03 +02:00
|
|
|
it('Can hide and show the sidebar with active board', async () => {
|
|
|
|
// Hide and show the sidebar option available on mobile devices
|
|
|
|
cy.viewport(767, 1024);
|
|
|
|
cy.get('.sidebarSwitcher').click();
|
2021-07-01 05:57:46 +02:00
|
|
|
cy.get('.Sidebar .heading').should('not.exist');
|
|
|
|
cy.get('.Sidebar .show-button').click();
|
|
|
|
cy.get('.Sidebar .heading').should('exist');
|
2021-09-08 06:52:03 +02:00
|
|
|
|
|
|
|
cy.viewport(1024, 1024);
|
|
|
|
cy.get('.sidebarSwitcher').should('not.exist');
|
2021-07-01 05:57:46 +02:00
|
|
|
});
|
|
|
|
|
2020-12-17 22:02:12 +02:00
|
|
|
it('Can rename the board view', () => {
|
2020-12-11 20:34:11 +02:00
|
|
|
// Rename board view
|
|
|
|
const boardViewTitle = `Test board (${timestamp})`;
|
2021-03-30 22:06:39 +02:00
|
|
|
cy.get('.ViewHeader>.Editable[title=\'Board view\']').should('exist');
|
|
|
|
cy.get('.ViewHeader>.Editable').
|
2020-12-11 20:34:11 +02:00
|
|
|
clear().
|
|
|
|
type(boardViewTitle).
|
|
|
|
type('{esc}');
|
|
|
|
|
2021-03-30 22:06:39 +02:00
|
|
|
cy.get(`.ViewHeader .Editable[title='${boardViewTitle}']`).should('exist');
|
2020-12-17 22:02:12 +02:00
|
|
|
});
|
2020-12-11 20:34:11 +02:00
|
|
|
|
2020-12-17 22:02:12 +02:00
|
|
|
it('Can create a card', () => {
|
2020-12-10 23:45:56 +02:00
|
|
|
// Create card
|
|
|
|
cy.get('.ViewHeader').contains('New').click();
|
|
|
|
cy.get('.CardDetail').should('exist');
|
2020-12-17 22:02:12 +02:00
|
|
|
});
|
2020-12-10 23:45:56 +02:00
|
|
|
|
2020-12-17 22:02:12 +02:00
|
|
|
it('Can set the card title', () => {
|
2020-12-10 23:45:56 +02:00
|
|
|
// Card title
|
2021-07-26 10:34:21 +02:00
|
|
|
cy.get('.CardDetail .EditableArea.title').
|
2020-12-10 23:45:56 +02:00
|
|
|
type(cardTitle).
|
|
|
|
type('{enter}').
|
|
|
|
should('have.value', cardTitle);
|
|
|
|
|
|
|
|
// Close card
|
2021-06-04 22:18:25 +02:00
|
|
|
cy.get('.Dialog.dialog-back .wrapper').click({force: true});
|
2020-12-17 22:02:12 +02:00
|
|
|
});
|
2020-12-10 23:45:56 +02:00
|
|
|
|
2020-12-17 22:02:12 +02:00
|
|
|
it('Can create a table view', () => {
|
2020-12-11 20:34:11 +02: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
|
2021-03-30 22:06:39 +02:00
|
|
|
cy.get('.ViewHeader .Editable[title=\'Table view\']').should('exist');
|
2020-12-11 20:34:11 +02:00
|
|
|
|
|
|
|
// Card should exist in table
|
|
|
|
cy.get(`.TableRow [value='${cardTitle}']`).should('exist');
|
2020-12-17 22:02:12 +02:00
|
|
|
});
|
2020-12-11 20:34:11 +02:00
|
|
|
|
2020-12-17 22:02:12 +02:00
|
|
|
it('Can rename the table view', () => {
|
2020-12-11 20:34:11 +02:00
|
|
|
// Rename table view
|
|
|
|
const tableViewTitle = `Test table (${timestamp})`;
|
2021-03-30 22:06:39 +02:00
|
|
|
cy.get('.ViewHeader .Editable[title=\'Table view\']').
|
2020-12-11 20:34:11 +02:00
|
|
|
clear().
|
|
|
|
type(tableViewTitle).
|
|
|
|
type('{esc}');
|
|
|
|
|
2021-03-30 22:06:39 +02:00
|
|
|
cy.get(`.ViewHeader .Editable[title='${tableViewTitle}']`).should('exist');
|
2020-12-17 22:02:12 +02:00
|
|
|
});
|
2020-12-11 20:34:11 +02:00
|
|
|
|
2020-12-17 22:02:12 +02:00
|
|
|
it('Can sort the table', () => {
|
2020-12-11 20:34:11 +02:00
|
|
|
// Sort
|
|
|
|
cy.get('.ViewHeader').contains('Sort').click();
|
|
|
|
cy.get('.ViewHeader').contains('Sort').parent().contains('Name').click();
|
2020-12-17 22:02:12 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('Can delete the board', () => {
|
2020-12-10 23:45:56 +02:00
|
|
|
// Delete board
|
|
|
|
cy.get('.Sidebar .octo-sidebar-list').
|
|
|
|
contains(boardTitle).first().
|
|
|
|
next().
|
|
|
|
find('.Button.IconButton').
|
|
|
|
click({force: true});
|
|
|
|
|
2020-12-11 21:10:25 +02:00
|
|
|
cy.contains('Delete board').click({force: true});
|
2020-12-10 23:45:56 +02:00
|
|
|
|
2021-07-14 21:22:40 +02:00
|
|
|
// Board should not exist
|
2020-12-10 23:45:56 +02:00
|
|
|
cy.contains(boardTitle).should('not.exist');
|
|
|
|
});
|
|
|
|
});
|