From 846a8786d5d98f7a85dba4ed3a3f0690ba7f98d0 Mon Sep 17 00:00:00 2001 From: Chen-I Lim Date: Fri, 11 Dec 2020 10:34:11 -0800 Subject: [PATCH] Cypress: test create table view and rename view --- webapp/cypress/integration/createBoard.js | 47 ++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/webapp/cypress/integration/createBoard.js b/webapp/cypress/integration/createBoard.js index b5ea31526..ead62f9b4 100644 --- a/webapp/cypress/integration/createBoard.js +++ b/webapp/cypress/integration/createBoard.js @@ -1,6 +1,8 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. +/// + describe('Create and delete board / card', () => { it('Can create and delete a board and card', () => { cy.visit('/'); @@ -17,6 +19,18 @@ describe('Create and delete board / card', () => { type('{enter}'). should('have.value', boardTitle); + // Rename board view + const boardViewTitle = `Test board (${timestamp})`; + cy.get('.ViewHeader'). + contains('.octo-editable', 'Board View'). + clear(). + type(boardViewTitle). + type('{esc}'); + + cy.get('.ViewHeader'). + contains('.octo-editable', boardViewTitle). + should('exist'); + // Create card cy.get('.ViewHeader').contains('New').click(); cy.get('.CardDetail').should('exist'); @@ -31,6 +45,37 @@ describe('Create and delete board / card', () => { // Close card cy.get('.Dialog.dialog-back').click({force: true}); + // 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 + cy.contains('.octo-editable', 'Table View').should('exist'); + + // Card should exist in table + cy.get(`.TableRow [value='${cardTitle}']`).should('exist'); + + // Rename table view + const tableViewTitle = `Test table (${timestamp})`; + cy.get('.ViewHeader'). + contains('.octo-editable', 'Table View'). + 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(); + // Delete board cy.get('.Sidebar .octo-sidebar-list'). contains(boardTitle).first(). @@ -40,7 +85,7 @@ describe('Create and delete board / card', () => { cy.contains('Delete Board').click({force: true}); - // Board should not exist + // // Board should not exist cy.contains(boardTitle).should('not.exist'); }); });