@ -36,18 +36,40 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
end
shared_let ( :sub_project ) do
create ( :project , name : 'Child' , parent : project , enabled_module_names : enabled_modules )
create ( :project , name : 'Direct Child' , parent : project , enabled_module_names : enabled_modules )
end
shared_let ( :sub_sub_project ) do
create ( :project , name : 'Grandchild' , parent : sub_project , enabled_module_names : enabled_modules )
create ( :project , name : 'Direct Grandchild' , parent : sub_project , enabled_module_names : enabled_modules )
end
shared_let ( :other_project ) do
create ( :project , name : 'Other project' , enabled_module_names : enabled_modules )
end
shared_let ( :other_sub_project ) do
create ( :project , name : 'Other Child' , parent : other_project , enabled_module_names : enabled_modules )
end
shared_let ( :other_sub_sub_project ) do
create ( :project , name : 'First other sub sub child' , parent : other_sub_project , enabled_module_names : enabled_modules )
end
shared_let ( :another_sub_sub_project ) do
create ( :project , name : 'Second other sub sub child' , parent : other_sub_project , enabled_module_names : enabled_modules )
end
shared_let ( :user ) do
create :user ,
member_in_projects : [ project , sub_project , sub_sub_project , other_project ] ,
member_in_projects : [
project ,
sub_project ,
sub_sub_project ,
other_project ,
other_sub_project ,
other_sub_sub_project ,
another_sub_sub_project
] ,
member_with_permissions : permissions
end
@ -55,7 +77,15 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
create :user ,
firstname : 'Other' ,
lastname : 'User' ,
member_in_projects : [ project , other_project , sub_project , sub_sub_project ] ,
member_in_projects : [
project ,
sub_project ,
sub_sub_project ,
other_project ,
other_sub_project ,
other_sub_sub_project ,
another_sub_sub_project
] ,
member_with_permissions : permissions
end
@ -122,8 +152,15 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
sub_project . types << type_task
sub_sub_project . types << type_bug
sub_sub_project . types << type_task
other_project . types << type_bug
other_project . types << type_task
other_sub_project . types << type_bug
other_sub_project . types << type_task
other_sub_sub_project . types << type_bug
other_sub_sub_project . types << type_task
another_sub_sub_project . types << type_bug
another_sub_sub_project . types << type_task
login_as current_user
work_package_view . visit!
@ -134,24 +171,42 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
dropdown . toggle!
dropdown . expect_open
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id , true )
dropdown . toggle_include_all_subprojects
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_sub_project . id )
dropdown . toggle_checkbox ( project . id )
dropdown . toggle_checkbox ( other_project . id )
dropdown . toggle_checkbox ( other_sub_project . id )
dropdown . toggle_checkbox ( sub_sub_project . id )
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id , true )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_sub_project . id , true )
dropdown . toggle_checkbox ( sub_sub_project . id )
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id , true )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_sub_project . id )
@ -172,12 +227,28 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
dropdown . toggle!
dropdown . toggle_include_all_subprojects
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id , true )
dropdown . expect_checkbox ( other_sub_sub_project . id , true )
dropdown . expect_checkbox ( another_sub_sub_project . id , true )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id , true )
dropdown . toggle_include_all_subprojects
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id , true )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_sub_project . id , true )
dropdown . toggle_checkbox ( sub_sub_project . id )
dropdown . click_button 'Apply'
dropdown . expect_closed
dropdown . expect_count 2
@ -188,12 +259,44 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
dropdown . toggle!
dropdown . expect_open
dropdown . toggle_checkbox ( project . id )
dropdown . toggle_checkbox ( other_project . id )
dropdown . toggle_checkbox ( project . id )
dropdown . toggle_checkbox ( sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( other_sub_project . id , true )
dropdown . expect_checkbox ( other_sub_sub_project . id , true )
dropdown . expect_checkbox ( another_sub_sub_project . id , true )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id , true )
dropdown . click_button 'Apply'
dropdown . expect_closed
dropdown . expect_count 2
dropdown . toggle!
dropdown . click_button 'Clear selection'
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id , true )
dropdown . toggle_include_all_subprojects
dropdown . toggle_checkbox ( other_sub_project . id )
dropdown . toggle_checkbox ( sub_sub_project . id )
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id , true )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_sub_project . id , true )
@ -205,8 +308,11 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
dropdown . click_button 'Clear selection'
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_sub_project . id )
@ -220,20 +326,25 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
dropdown . toggle!
dropdown . expect_open
dropdown . toggle_checkbox ( other_project . id )
dropdown . toggle_checkbox ( sub_sub_project . id )
retry_block do
dropdown . search sub_sub_project . name
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_no_checkbox ( other_project . id )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_no_checkbox ( other_sub_project . id )
dropdown . expect_no_checkbox ( other_sub_sub_project . id )
dropdown . expect_no_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id , true )
end
retry_block do
dropdown . search other_project . name
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_no_checkbox ( other_sub_project . id )
dropdown . expect_no_checkbox ( other_sub_sub_project . id )
dropdown . expect_no_checkbox ( another_sub_sub_project . id )
dropdown . expect_no_checkbox ( project . id )
dropdown . expect_no_checkbox ( sub_project . id )
dropdown . expect_no_checkbox ( sub_sub_project . id )
@ -241,55 +352,88 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
retry_block do
dropdown . search ''
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id )
dropdown . expect_checkbox ( other_sub_sub_project . id )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id , true )
end
dropdown . toggle_checkbox ( other_sub_sub_project . id )
retry_block do
dropdown . set_filter_selected true
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_sub_project . id )
dropdown . expect_checkbox ( other_sub_sub_project . id , true )
dropdown . expect_no_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id , true )
end
retry_block do
dropdown . set_filter_selected false
dropdown . toggle_checkbox ( other_project . id )
dropdown . set_filter_selected true
retry_block do
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( other_sub_project . id , true )
dropdown . expect_checkbox ( other_sub_sub_project . id , true )
dropdown . expect_no_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id , true )
end
dropdown . expect_no_checkbox ( other_project . id )
dropdown . toggle_include_all_subprojects
retry_block do
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( other_sub_project . id )
dropdown . expect_checkbox ( other_sub_sub_project . id , true )
dropdown . expect_no_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_no_checkbox ( sub_project . id )
dropdown . expect_no_checkbox ( sub_sub_project . id )
end
retry_block do
dropdown . search other_project . name
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_no_checkbox ( other_sub_project . id )
dropdown . expect_no_checkbox ( other_sub_sub_project . id )
dropdown . expect_no_checkbox ( another_sub_sub_project . id )
dropdown . expect_no_checkbox ( project . id )
dropdown . expect_no_checkbox ( other_project . id )
dropdown . expect_no_checkbox ( sub_project . id )
dropdown . expect_no_checkbox ( sub_sub_project . id )
end
retry_block do
dropdown . search ''
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_sub_project . id , true )
dropdown . expect_no_checkbox ( other_project . id )
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_no_checkbox ( other_sub_project . id )
dropdown . expect_no_checkbox ( other_sub_sub_project . id )
dropdown . expect_no_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_no_checkbox ( sub_project . id )
dropdown . expect_no_checkbox ( sub_sub_project . id )
end
retry_block do
dropdown . set_filter_selected false
dropdown . expect_checkbox ( other_project . id , true )
dropdown . expect_checkbox ( other_sub_project . id )
dropdown . expect_checkbox ( other_sub_sub_project . id , true )
dropdown . expect_checkbox ( another_sub_sub_project . id )
dropdown . expect_checkbox ( project . id , true )
dropdown . expect_checkbox ( other_project . id )
dropdown . expect_checkbox ( sub_project . id )
dropdown . expect_checkbox ( sub_sub_project . id , true )
dropdown . expect_checkbox ( sub_sub_project . id )
end
end
end