feat(tests): add project tests derived from old namespace tests
This commit is contained in:
parent
f7629c28f4
commit
5dd6e9a077
@ -1,6 +1,7 @@
|
|||||||
import {createFakeUserAndLogin} from '../../support/authenticateUser'
|
import {createFakeUserAndLogin} from '../../support/authenticateUser'
|
||||||
|
|
||||||
import {TaskFactory} from '../../factories/task'
|
import {TaskFactory} from '../../factories/task'
|
||||||
|
import {ProjectFactory} from '../../factories/project'
|
||||||
import {prepareProjects} from './prepareProjects'
|
import {prepareProjects} from './prepareProjects'
|
||||||
|
|
||||||
describe('Projects', () => {
|
describe('Projects', () => {
|
||||||
@ -78,7 +79,7 @@ describe('Projects', () => {
|
|||||||
.should('not.contain', projects[0].title)
|
.should('not.contain', projects[0].title)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should remove a project', () => {
|
it('Should remove a project when deleting it', () => {
|
||||||
cy.visit(`/projects/${projects[0].id}`)
|
cy.visit(`/projects/${projects[0].id}`)
|
||||||
|
|
||||||
cy.get('.menu-container .menu-list li:first-child .dropdown .menu-list-dropdown-trigger')
|
cy.get('.menu-container .menu-list li:first-child .dropdown .menu-list-dropdown-trigger')
|
||||||
@ -118,4 +119,53 @@ describe('Projects', () => {
|
|||||||
cy.get('main.app-content')
|
cy.get('main.app-content')
|
||||||
.should('contain.text', 'This project is archived. It is not possible to create new or edit tasks for it.')
|
.should('contain.text', 'This project is archived. It is not possible to create new or edit tasks for it.')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should show all projects on the projects page', () => {
|
||||||
|
const projects = ProjectFactory.create(10)
|
||||||
|
|
||||||
|
cy.visit('/projects')
|
||||||
|
|
||||||
|
projects.forEach(p => {
|
||||||
|
cy.get('[data-cy="projects-list"]')
|
||||||
|
.should('contain', p.title)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should not show archived projects if the filter is not checked', () => {
|
||||||
|
ProjectFactory.create(1, {
|
||||||
|
id: 2,
|
||||||
|
}, false)
|
||||||
|
ProjectFactory.create(1, {
|
||||||
|
id: 3,
|
||||||
|
is_archived: true,
|
||||||
|
}, false)
|
||||||
|
|
||||||
|
// Initial
|
||||||
|
cy.visit('/projects')
|
||||||
|
cy.get('.project-grid')
|
||||||
|
.should('not.contain', 'Archived')
|
||||||
|
|
||||||
|
// Show archived
|
||||||
|
cy.get('[data-cy="show-archived-check"] label.check span')
|
||||||
|
.should('be.visible')
|
||||||
|
.click()
|
||||||
|
cy.get('[data-cy="show-archived-check"] input')
|
||||||
|
.should('be.checked')
|
||||||
|
cy.get('.project-grid')
|
||||||
|
.should('contain', 'Archived')
|
||||||
|
|
||||||
|
// Don't show archived
|
||||||
|
cy.get('[data-cy="show-archived-check"] label.check span')
|
||||||
|
.should('be.visible')
|
||||||
|
.click()
|
||||||
|
cy.get('[data-cy="show-archived-check"] input')
|
||||||
|
.should('not.be.checked')
|
||||||
|
|
||||||
|
// Second time visiting after unchecking
|
||||||
|
cy.visit('/projects')
|
||||||
|
cy.get('[data-cy="show-archived-check"] input')
|
||||||
|
.should('not.be.checked')
|
||||||
|
cy.get('.project-grid')
|
||||||
|
.should('not.contain', 'Archived')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user