2020-12-10 14:52:35 +01:00
|
|
|
import {TaskFactory} from '../../factories/task'
|
2021-11-17 18:11:19 +01:00
|
|
|
import {prepareLists} from './prepareLists'
|
2020-12-10 14:52:35 +01:00
|
|
|
|
|
|
|
import '../../support/authenticateUser'
|
|
|
|
|
|
|
|
describe('Lists', () => {
|
2021-05-27 08:51:42 +02:00
|
|
|
let lists
|
2021-11-17 18:11:19 +01:00
|
|
|
prepareLists((newLists) => (lists = newLists))
|
2020-12-10 14:52:35 +01:00
|
|
|
|
|
|
|
it('Should create a new list', () => {
|
|
|
|
cy.visit('/')
|
2021-01-30 17:17:04 +01:00
|
|
|
cy.get('.namespace-title .dropdown-trigger')
|
|
|
|
.click()
|
|
|
|
cy.get('.namespace-title .dropdown .dropdown-item')
|
|
|
|
.contains('New list')
|
2020-12-10 14:52:35 +01:00
|
|
|
.click()
|
|
|
|
cy.url()
|
2021-11-17 18:04:53 +01:00
|
|
|
.should('contain', '/lists/new/1')
|
2021-01-21 23:33:16 +01:00
|
|
|
cy.get('.card-header-title')
|
2022-01-05 13:46:33 +01:00
|
|
|
.contains('New list')
|
2020-12-10 14:52:35 +01:00
|
|
|
cy.get('input.input')
|
|
|
|
.type('New List')
|
2021-01-17 18:57:57 +01:00
|
|
|
cy.get('.button')
|
2021-01-21 23:33:16 +01:00
|
|
|
.contains('Create')
|
2020-12-10 14:52:35 +01:00
|
|
|
.click()
|
|
|
|
|
2021-10-02 22:47:13 +02:00
|
|
|
cy.get('.global-notification', { timeout: 1000 }) // Waiting until the request to create the new list is done
|
2020-12-10 14:52:35 +01:00
|
|
|
.should('contain', 'Success')
|
|
|
|
cy.url()
|
|
|
|
.should('contain', '/lists/')
|
|
|
|
cy.get('.list-title h1')
|
|
|
|
.should('contain', 'New List')
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should redirect to a specific list view after visited', () => {
|
|
|
|
cy.visit('/lists/1/kanban')
|
|
|
|
cy.url()
|
|
|
|
.should('contain', '/lists/1/kanban')
|
|
|
|
cy.visit('/lists/1')
|
|
|
|
cy.url()
|
|
|
|
.should('contain', '/lists/1/kanban')
|
|
|
|
})
|
|
|
|
|
2021-05-27 08:51:42 +02:00
|
|
|
it('Should rename the list in all places', () => {
|
2021-11-17 18:11:19 +01:00
|
|
|
TaskFactory.create(5, {
|
2021-05-27 08:51:42 +02:00
|
|
|
id: '{increment}',
|
|
|
|
list_id: 1,
|
|
|
|
})
|
|
|
|
const newListName = 'New list name'
|
|
|
|
|
|
|
|
cy.visit('/lists/1')
|
|
|
|
cy.get('.list-title h1')
|
|
|
|
.should('contain', 'First List')
|
|
|
|
|
2022-05-11 01:15:08 +02:00
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child .dropdown .dropdown-trigger')
|
2021-05-27 08:51:42 +02:00
|
|
|
.click()
|
2022-05-11 01:15:08 +02:00
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child .dropdown .dropdown-content')
|
2021-05-27 08:51:42 +02:00
|
|
|
.contains('Edit')
|
|
|
|
.click()
|
2021-08-23 19:42:42 +02:00
|
|
|
cy.get('#title')
|
2021-05-27 08:51:42 +02:00
|
|
|
.type(`{selectall}${newListName}`)
|
2022-09-01 18:09:50 +02:00
|
|
|
cy.get('footer.card-footer .button')
|
2021-05-27 08:51:42 +02:00
|
|
|
.contains('Save')
|
|
|
|
.click()
|
|
|
|
|
|
|
|
cy.get('.global-notification')
|
|
|
|
.should('contain', 'Success')
|
|
|
|
cy.get('.list-title h1')
|
|
|
|
.should('contain', newListName)
|
|
|
|
.should('not.contain', lists[0].title)
|
2022-05-11 01:15:08 +02:00
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child')
|
2021-05-27 08:51:42 +02:00
|
|
|
.should('contain', newListName)
|
|
|
|
.should('not.contain', lists[0].title)
|
|
|
|
cy.visit('/')
|
2021-12-30 16:14:51 +01:00
|
|
|
cy.get('.card-content')
|
2021-05-27 08:51:42 +02:00
|
|
|
.should('contain', newListName)
|
|
|
|
.should('not.contain', lists[0].title)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should remove a list', () => {
|
|
|
|
cy.visit(`/lists/${lists[0].id}`)
|
|
|
|
|
2022-05-11 01:15:08 +02:00
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child .dropdown .dropdown-trigger')
|
2021-05-27 08:51:42 +02:00
|
|
|
.click()
|
2022-05-11 01:15:08 +02:00
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child .dropdown .dropdown-content')
|
2021-05-27 08:51:42 +02:00
|
|
|
.contains('Delete')
|
|
|
|
.click()
|
|
|
|
cy.url()
|
|
|
|
.should('contain', '/settings/delete')
|
2022-01-04 19:58:06 +01:00
|
|
|
cy.get('[data-cy="modalPrimary"]')
|
2021-05-27 08:51:42 +02:00
|
|
|
.contains('Do it')
|
|
|
|
.click()
|
|
|
|
|
|
|
|
cy.get('.global-notification')
|
|
|
|
.should('contain', 'Success')
|
2022-05-11 01:15:08 +02:00
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .menu-list')
|
2021-05-27 08:51:42 +02:00
|
|
|
.should('not.contain', lists[0].title)
|
|
|
|
cy.location('pathname')
|
|
|
|
.should('equal', '/')
|
|
|
|
})
|
2022-06-30 18:04:41 +02:00
|
|
|
|
|
|
|
it('Should archive a list', () => {
|
|
|
|
cy.visit(`/lists/${lists[0].id}`)
|
|
|
|
|
|
|
|
cy.get('.list-title .dropdown')
|
|
|
|
.click()
|
|
|
|
cy.get('.list-title .dropdown .dropdown-menu .dropdown-item')
|
|
|
|
.contains('Archive')
|
|
|
|
.click()
|
|
|
|
cy.get('.modal-content')
|
|
|
|
.should('contain.text', 'Archive this list')
|
|
|
|
cy.get('.modal-content [data-cy=modalPrimary]')
|
|
|
|
.click()
|
|
|
|
|
2022-05-11 01:15:08 +02:00
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .menu-list')
|
2022-06-30 18:04:41 +02:00
|
|
|
.should('not.contain', lists[0].title)
|
|
|
|
cy.get('main.app-content')
|
|
|
|
.should('contain.text', 'This list is archived. It is not possible to create new or edit tasks for it.')
|
|
|
|
})
|
2020-12-10 14:52:35 +01:00
|
|
|
})
|