diff options
Diffstat (limited to 'spec/features/work_items')
-rw-r--r-- | spec/features/work_items/work_item_children_spec.rb | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/spec/features/work_items/work_item_children_spec.rb b/spec/features/work_items/work_item_children_spec.rb index 95774680a2b..10a1bf7541e 100644 --- a/spec/features/work_items/work_item_children_spec.rb +++ b/spec/features/work_items/work_item_children_spec.rb @@ -15,7 +15,6 @@ RSpec.describe 'Work item children', :js do sign_in(user) stub_feature_flags(work_items: true) - stub_feature_flags(work_items_hierarchy: true) visit project_issue_path(project, issue) @@ -49,6 +48,7 @@ RSpec.describe 'Work item children', :js do expect(page).not_to have_selector('[data-testid="add-links-form"]') click_button 'Add' + click_button 'New task' expect(page).to have_selector('[data-testid="add-links-form"]') @@ -58,9 +58,10 @@ RSpec.describe 'Work item children', :js do end end - it 'addss a child task', :aggregate_failures do + it 'adds a new child task', :aggregate_failures do page.within('[data-testid="work-item-links"]') do click_button 'Add' + click_button 'New task' expect(page).to have_button('Create task', disabled: true) fill_in 'Add a title', with: 'Task 1' @@ -78,6 +79,7 @@ RSpec.describe 'Work item children', :js do it 'removes a child task and undoing', :aggregate_failures do page.within('[data-testid="work-item-links"]') do click_button 'Add' + click_button 'New task' fill_in 'Add a title', with: 'Task 1' click_button 'Create task' wait_for_all_requests @@ -106,5 +108,29 @@ RSpec.describe 'Work item children', :js do expect(find('[data-testid="children-count"]')).to have_content('1') end end + + context 'with existing task' do + let_it_be(:task) { create(:work_item, :task, project: project) } + + it 'adds an existing child task', :aggregate_failures do + page.within('[data-testid="work-item-links"]') do + click_button 'Add' + click_button 'Existing task' + + expect(page).to have_button('Add task', disabled: true) + find('[data-testid="work-item-token-select-input"]').set(task.title) + wait_for_all_requests + click_button task.title + + expect(page).to have_button('Add task', disabled: false) + + click_button 'Add task' + + wait_for_all_requests + + expect(find('[data-testid="links-child"]')).to have_content(task.title) + end + end + end end end |