2022-01-13 18:26:27 +02:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
|
|
|
describe('Card badges', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.apiInitServer()
|
|
|
|
cy.apiResetBoards()
|
2022-02-28 13:28:16 +02:00
|
|
|
cy.apiGetMe().then((userID) => cy.apiSkipTour(userID))
|
2022-01-13 18:26:27 +02:00
|
|
|
localStorage.setItem('welcomePageViewed', 'true')
|
2022-04-06 16:22:47 +02:00
|
|
|
localStorage.setItem('language', 'en')
|
2022-01-13 18:26:27 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
it('Shows and hides card badges', () => {
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
// Create new board
|
|
|
|
cy.uiCreateNewBoard('Testing')
|
|
|
|
|
|
|
|
// Add a new card
|
|
|
|
cy.uiAddNewCard('Card')
|
|
|
|
|
|
|
|
// Add some comments
|
|
|
|
cy.log('**Add some comments**')
|
|
|
|
addComment('Some comment')
|
|
|
|
addComment('Another comment')
|
|
|
|
addComment('Additional comment')
|
|
|
|
|
|
|
|
// Add card description
|
|
|
|
cy.log('**Add card description**')
|
|
|
|
cy.findByText('Add a description...').click()
|
|
|
|
cy.findByRole('combobox').type('## Header\n- [ ] one\n- [x] two{esc}')
|
|
|
|
|
|
|
|
// Add checkboxes
|
|
|
|
cy.log('**Add checkboxes**')
|
|
|
|
cy.findByRole('button', {name: 'Add content'}).click()
|
|
|
|
cy.findByRole('button', {name: 'checkbox'}).click()
|
2022-05-19 18:05:55 +02:00
|
|
|
cy.focused().type('three{enter}')
|
|
|
|
cy.focused().type('four{enter}')
|
|
|
|
cy.focused().type('{esc}')
|
2022-01-13 18:26:27 +02:00
|
|
|
cy.findByDisplayValue('three').prev().click()
|
|
|
|
|
|
|
|
// Close card dialog
|
|
|
|
cy.log('**Close card dialog**')
|
|
|
|
cy.findByRole('button', {name: 'Close dialog'}).click()
|
|
|
|
cy.findByRole('dialog').should('not.exist')
|
|
|
|
|
|
|
|
// Show card badges
|
|
|
|
cy.log('**Show card badges**')
|
|
|
|
cy.findByRole('button', {name: 'Properties menu'}).click()
|
2022-06-16 13:17:44 +02:00
|
|
|
cy.findByRole('button', {name: 'Comments and description'}).click()
|
2022-01-13 18:26:27 +02:00
|
|
|
cy.findByTitle('This card has a description').should('exist')
|
|
|
|
cy.findByTitle('Comments').contains('3').should('exist')
|
|
|
|
cy.findByTitle('Checkboxes').contains('2/4').should('exist')
|
|
|
|
|
|
|
|
// Hide card badges
|
|
|
|
cy.log('**Hide card badges**')
|
2022-06-16 13:17:44 +02:00
|
|
|
cy.findByRole('button', {name: 'Comments and description'}).click()
|
2022-08-09 08:22:36 +02:00
|
|
|
cy.findByRole('button', {name: 'Properties menu'}).click()
|
2022-01-13 18:26:27 +02:00
|
|
|
cy.findByTitle('This card has a description').should('not.exist')
|
|
|
|
cy.findByTitle('Comments').should('not.exist')
|
|
|
|
cy.findByTitle('Checkboxes').should('not.exist')
|
|
|
|
})
|
|
|
|
|
|
|
|
const addComment = (text: string) => {
|
|
|
|
cy.findByText('Add a comment...').click()
|
|
|
|
cy.findByRole('combobox').type(text).blur()
|
|
|
|
cy.findByRole('button', {name: 'Send'}).click()
|
|
|
|
}
|
|
|
|
})
|