@ -1,11 +1,11 @@
import { createFakeUserAndLogin } from '../../support/authenticateUser'
import { TaskFactory } from '../../factories/task'
import { ListFactory} from '../../factories/lis t'
import { ProjectFactory} from '../../factories/projec t'
import { TaskCommentFactory } from '../../factories/task_comment'
import { UserFactory } from '../../factories/user'
import { NamespaceFactory } from '../../factories/namespace'
import { User ListFactory} from '../../factories/users_lis t'
import { User ProjectFactory} from '../../factories/users_projec t'
import { TaskAssigneeFactory } from '../../factories/task_assignee'
import { LabelFactory } from '../../factories/labels'
import { LabelTaskFactory } from '../../factories/label_task'
@ -48,22 +48,22 @@ describe('Task', () => {
createFakeUserAndLogin ( )
let namespaces
let lis ts
let projec ts
let buckets
beforeEach ( ( ) = > {
// UserFactory.create(1)
namespaces = NamespaceFactory . create ( 1 )
lists = Lis tFactory. create ( 1 )
projects = Projec tFactory. create ( 1 )
buckets = BucketFactory . create ( 1 , {
list_id: lis ts[ 0 ] . id ,
project_id: projec ts[ 0 ] . id ,
} )
TaskFactory . truncate ( )
User Lis tFactory. truncate ( )
User Projec tFactory. truncate ( )
} )
it ( 'Should be created new' , ( ) = > {
cy . visit ( '/ lis ts/1/list')
cy . visit ( '/ projec ts/1/list')
cy . get ( '.input[placeholder="Add a new taskโฆ"' )
. type ( 'New Task' )
cy . get ( '.button' )
@ -74,11 +74,11 @@ describe('Task', () => {
. should ( 'contain' , 'New Task' )
} )
it ( 'Inserts new tasks at the top of the lis t', ( ) = > {
it ( 'Inserts new tasks at the top of the projec t', ( ) = > {
TaskFactory . create ( 1 )
cy . visit ( '/ lis ts/1/list')
cy . get ( '. lis t-is-empty-notice')
cy . visit ( '/ projec ts/1/list')
cy . get ( '. projec t-is-empty-notice')
. should ( 'not.exist' )
cy . get ( '.input[placeholder="Add a new taskโฆ"' )
. type ( 'New Task' )
@ -95,7 +95,7 @@ describe('Task', () => {
it ( 'Marks a task as done' , ( ) = > {
TaskFactory . create ( 1 )
cy . visit ( '/ lis ts/1/list')
cy . visit ( '/ projec ts/1/list')
cy . get ( '.tasks .task .fancycheckbox label.check' )
. first ( )
. click ( )
@ -106,7 +106,7 @@ describe('Task', () => {
it ( 'Can add a task to favorites' , ( ) = > {
TaskFactory . create ( 1 )
cy . visit ( '/ lis ts/1/list')
cy . visit ( '/ projec ts/1/list')
cy . get ( '.tasks .task .favorite' )
. first ( )
. click ( )
@ -134,7 +134,7 @@ describe('Task', () => {
. should ( 'contain' , '#1' )
cy . get ( '.task-view h6.subtitle' )
. should ( 'contain' , namespaces [ 0 ] . title )
. should ( 'contain' , lis ts[ 0 ] . title )
. should ( 'contain' , projec ts[ 0 ] . title )
cy . get ( '.task-view .details.content.description' )
. should ( 'contain' , tasks [ 0 ] . description )
cy . get ( '.task-view .action-buttons p.created' )
@ -179,21 +179,21 @@ describe('Task', () => {
. should ( 'contain' , 'Mark as undone' )
} )
it ( 'Shows a task identifier since the lis t has one', ( ) = > {
const lists = Lis tFactory. create ( 1 , {
it ( 'Shows a task identifier since the projec t has one', ( ) = > {
const projects = Projec tFactory. create ( 1 , {
id : 1 ,
identifier : 'TEST' ,
} )
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
list_id: lis ts[ 0 ] . id ,
project_id: projec ts[ 0 ] . id ,
index : 1 ,
} )
cy . visit ( ` /tasks/ ${ tasks [ 0 ] . id } ` )
cy . get ( '.task-view h1.title.task-id' )
. should ( 'contain' , ` ${ lis ts[ 0 ] . identifier } - ${ tasks [ 0 ] . index } ` )
. should ( 'contain' , ` ${ projec ts[ 0 ] . identifier } - ${ tasks [ 0 ] . index } ` )
} )
it ( 'Can edit the description' , ( ) = > {
@ -236,14 +236,14 @@ describe('Task', () => {
. should ( 'contain' , 'Success' )
} )
it ( 'Can move a task to another lis t', ( ) = > {
const lists = Lis tFactory. create ( 2 )
it ( 'Can move a task to another projec t', ( ) = > {
const projects = Projec tFactory. create ( 2 )
BucketFactory . create ( 2 , {
lis t_id: '{increment}'
projec t_id: '{increment}'
} )
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
list_id: lis ts[ 0 ] . id ,
project_id: projec ts[ 0 ] . id ,
} )
cy . visit ( ` /tasks/ ${ tasks [ 0 ] . id } ` )
@ -251,7 +251,7 @@ describe('Task', () => {
. contains ( 'Move' )
. click ( )
cy . get ( '.task-view .content.details .field .multiselect.control .input-wrapper input' )
. type ( ` ${ lis ts[ 1 ] . title } {enter} ` )
. type ( ` ${ projec ts[ 1 ] . title } {enter} ` )
// The requests happen with a 200ms timeout. Because of that, the results are not yet there when cypress
// presses enter and we can't simulate pressing on enter to select the item.
cy . get ( '.task-view .content.details .field .multiselect.control .search-results' )
@ -261,7 +261,7 @@ describe('Task', () => {
cy . get ( '.task-view h6.subtitle' )
. should ( 'contain' , namespaces [ 0 ] . title )
. should ( 'contain' , lis ts[ 1 ] . title )
. should ( 'contain' , projec ts[ 1 ] . title )
cy . get ( '.global-notification' )
. should ( 'contain' , 'Success' )
} )
@ -269,7 +269,7 @@ describe('Task', () => {
it ( 'Can delete a task' , ( ) = > {
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
lis t_id: 1 ,
projec t_id: 1 ,
} )
cy . visit ( ` /tasks/ ${ tasks [ 0 ] . id } ` )
@ -286,17 +286,17 @@ describe('Task', () => {
cy . get ( '.global-notification' )
. should ( 'contain' , 'Success' )
cy . url ( )
. should ( 'contain' , ` / lists/${ tasks [ 0 ] . lis t_id} / ` )
. should ( 'contain' , ` / projects/${ tasks [ 0 ] . projec t_id} / ` )
} )
it ( 'Can add an assignee to a task' , ( ) = > {
const users = UserFactory . create ( 5 )
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
lis t_id: 1 ,
projec t_id: 1 ,
} )
User Lis tFactory. create ( 5 , {
lis t_id: 1 ,
User Projec tFactory. create ( 5 , {
projec t_id: 1 ,
user_id : '{increment}' ,
} )
@ -321,10 +321,10 @@ describe('Task', () => {
const users = UserFactory . create ( 2 )
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
lis t_id: 1 ,
projec t_id: 1 ,
} )
User Lis tFactory. create ( 5 , {
lis t_id: 1 ,
User Projec tFactory. create ( 5 , {
projec t_id: 1 ,
user_id : '{increment}' ,
} )
TaskAssigneeFactory . create ( 1 , {
@ -347,7 +347,7 @@ describe('Task', () => {
it ( 'Can add a new label to a task' , ( ) = > {
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
lis t_id: 1 ,
projec t_id: 1 ,
} )
LabelFactory . truncate ( )
const newLabelText = 'some new label'
@ -375,7 +375,7 @@ describe('Task', () => {
it ( 'Can add an existing label to a task' , ( ) = > {
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
lis t_id: 1 ,
projec t_id: 1 ,
} )
const labels = LabelFactory . create ( 1 )
LabelTaskFactory . truncate ( )
@ -388,13 +388,13 @@ describe('Task', () => {
it ( 'Can add a label to a task and it shows up on the kanban board afterwards' , ( ) = > {
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
list_id: lis ts[ 0 ] . id ,
project_id: projec ts[ 0 ] . id ,
bucket_id : buckets [ 0 ] . id ,
} )
const labels = LabelFactory . create ( 1 )
LabelTaskFactory . truncate ( )
cy . visit ( ` / lists/${ lis ts[ 0 ] . id } /kanban ` )
cy . visit ( ` / projects/${ projec ts[ 0 ] . id } /kanban ` )
cy . get ( '.bucket .task' )
. contains ( tasks [ 0 ] . title )
@ -412,7 +412,7 @@ describe('Task', () => {
it ( 'Can remove a label from a task' , ( ) = > {
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
lis t_id: 1 ,
projec t_id: 1 ,
} )
const labels = LabelFactory . create ( 1 )
LabelTaskFactory . create ( 1 , {
@ -527,13 +527,13 @@ describe('Task', () => {
TaskAttachmentFactory . truncate ( )
const tasks = TaskFactory . create ( 1 , {
id : 1 ,
list_id: lis ts[ 0 ] . id ,
project_id: projec ts[ 0 ] . id ,
bucket_id : buckets [ 0 ] . id ,
} )
const labels = LabelFactory . create ( 1 )
LabelTaskFactory . truncate ( )
cy . visit ( ` / lists/${ lis ts[ 0 ] . id } /kanban ` )
cy . visit ( ` / projects/${ projec ts[ 0 ] . id } /kanban ` )
cy . get ( '.bucket .task' )
. contains ( tasks [ 0 ] . title )