1
0
mirror of https://github.com/mattermost/focalboard.git synced 2024-12-24 13:43:12 +02:00
focalboard/webapp/cypress/integration/cardBadges.ts
Scott Bishel b911de0cc3
CP - Update en.json: Bug fix and consistency (#3231)
* Update en.json: Bug fix and consistency (#3151)

* Update en.json

Updated copy and fixed https://github.com/mattermost/focalboard/issues/3131

* update cypress tests

* update default messages, en.json is created from default messages when running i18n-extract

* update tests for string changes

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
(cherry picked from commit 020d83fa44)

* clean up cherry-pick

* more cleanup

* fix bad merge

* fix cypress tests

Co-authored-by: Justine Geffen <justinegeffen@users.noreply.github.com>
2022-06-16 16:47:44 +05:30

70 lines
2.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
describe('Card badges', () => {
beforeEach(() => {
cy.apiInitServer()
cy.apiResetBoards()
cy.apiGetMe().then((userID) => cy.apiSkipTour(userID))
localStorage.setItem('welcomePageViewed', 'true')
localStorage.setItem('language', 'en')
})
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()
cy.focused().type('three{enter}')
cy.focused().type('four{enter}')
cy.focused().type('{esc}')
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()
cy.findByRole('button', {name: 'Comments and description'}).click()
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**')
cy.findByRole('button', {name: 'Properties menu'}).click()
cy.findByRole('button', {name: 'Comments and description'}).click()
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()
}
})