2020-12-10 14:52:35 +01:00
|
|
|
import {UserFactory} from '../../factories/user'
|
|
|
|
|
|
|
|
import '../../support/authenticateUser'
|
|
|
|
import {ListFactory} from '../../factories/list'
|
|
|
|
import {NamespaceFactory} from '../../factories/namespace'
|
2021-05-27 08:51:42 +02:00
|
|
|
import {TaskFactory} from '../../factories/task'
|
2020-12-10 14:52:35 +01:00
|
|
|
|
|
|
|
describe('Namepaces', () => {
|
|
|
|
let namespaces
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
UserFactory.create(1)
|
|
|
|
namespaces = NamespaceFactory.create(1)
|
|
|
|
ListFactory.create(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should be all there', () => {
|
|
|
|
cy.visit('/namespaces')
|
|
|
|
cy.get('.namespace h1 span')
|
|
|
|
.should('contain', namespaces[0].title)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should create a new Namespace', () => {
|
2021-05-27 08:51:42 +02:00
|
|
|
const newNamespaceTitle = 'New Namespace'
|
|
|
|
|
2020-12-10 14:52:35 +01:00
|
|
|
cy.visit('/namespaces')
|
|
|
|
cy.get('a.button')
|
2021-01-17 12:15:57 +01:00
|
|
|
.contains('Create namespace')
|
2020-12-10 14:52:35 +01:00
|
|
|
.click()
|
2021-05-27 08:51:42 +02:00
|
|
|
|
2020-12-10 14:52:35 +01:00
|
|
|
cy.url()
|
|
|
|
.should('contain', '/namespaces/new')
|
2021-01-21 23:33:16 +01:00
|
|
|
cy.get('.card-header-title')
|
2020-12-10 14:52:35 +01:00
|
|
|
.should('contain', 'Create a new namespace')
|
|
|
|
cy.get('input.input')
|
2021-05-27 08:51:42 +02:00
|
|
|
.type(newNamespaceTitle)
|
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-05-27 08:51:42 +02:00
|
|
|
|
|
|
|
cy.get('.global-notification')
|
|
|
|
.should('contain', 'Success')
|
|
|
|
cy.get('.namespace-container')
|
|
|
|
.should('contain', newNamespaceTitle)
|
2020-12-10 14:52:35 +01:00
|
|
|
cy.url()
|
|
|
|
.should('contain', '/namespaces')
|
|
|
|
})
|
2021-05-27 08:51:42 +02:00
|
|
|
|
|
|
|
it('Should rename the namespace all places', () => {
|
|
|
|
const newNamespaces = NamespaceFactory.create(5)
|
|
|
|
const newNamespaceName = 'New namespace name'
|
|
|
|
|
|
|
|
cy.visit('/namespaces')
|
|
|
|
|
|
|
|
cy.get(`.namespace-container .menu.namespaces-lists .namespace-title:contains(${newNamespaces[0].title}) .dropdown .dropdown-trigger`)
|
|
|
|
.click()
|
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .namespace-title .dropdown .dropdown-content')
|
|
|
|
.contains('Edit')
|
|
|
|
.click()
|
|
|
|
cy.url()
|
|
|
|
.should('contain', '/settings/edit')
|
|
|
|
cy.get('#namespacetext')
|
|
|
|
.invoke('val')
|
|
|
|
.should('equal', newNamespaces[0].title) // wait until the namespace data is loaded
|
|
|
|
cy.get('#namespacetext')
|
|
|
|
.type(`{selectall}${newNamespaceName}`)
|
|
|
|
cy.get('footer.modal-card-foot .button')
|
|
|
|
.contains('Save')
|
|
|
|
.click()
|
|
|
|
|
|
|
|
cy.get('.global-notification')
|
|
|
|
.should('contain', 'Success')
|
|
|
|
cy.get('.namespace-container .menu.namespaces-lists')
|
|
|
|
.should('contain', newNamespaceName)
|
|
|
|
.should('not.contain', newNamespaces[0].title)
|
|
|
|
cy.get('.content.namespaces-list')
|
|
|
|
.should('contain', newNamespaceName)
|
|
|
|
.should('not.contain', newNamespaces[0].title)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should remove a namespace when deleting it', () => {
|
|
|
|
const newNamespaces = NamespaceFactory.create(5)
|
|
|
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
cy.get(`.namespace-container .menu.namespaces-lists .namespace-title:contains(${newNamespaces[0].title}) .dropdown .dropdown-trigger`)
|
|
|
|
.click()
|
|
|
|
cy.get('.namespace-container .menu.namespaces-lists .namespace-title .dropdown .dropdown-content')
|
|
|
|
.contains('Delete')
|
|
|
|
.click()
|
|
|
|
cy.url()
|
|
|
|
.should('contain', '/settings/delete')
|
|
|
|
cy.get('.modal-mask .modal-container .modal-content .actions a.button')
|
|
|
|
.contains('Do it')
|
|
|
|
.click()
|
|
|
|
|
|
|
|
cy.get('.global-notification')
|
|
|
|
.should('contain', 'Success')
|
|
|
|
cy.get('.namespace-container .menu.namespaces-lists')
|
|
|
|
.should('not.contain', newNamespaces[0].title)
|
|
|
|
})
|
2020-12-10 14:52:35 +01:00
|
|
|
})
|