From a57bf9bd39816cebec5da3da35a1aabbf7462069 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre Date: Thu, 18 Feb 2016 20:25:46 -0200 Subject: Rename menu item and page 'Task queue' to 'Tasks' --- app/views/dashboard/tasks/index.html.haml | 4 +- app/views/layouts/header/_default.html.haml | 2 +- app/views/layouts/nav/_dashboard.html.haml | 12 +-- features/dashboard/task_queue.feature | 38 --------- features/dashboard/tasks.feature | 38 +++++++++ features/steps/dashboard/task_queue.rb | 128 ---------------------------- features/steps/dashboard/tasks.rb | 128 ++++++++++++++++++++++++++++ 7 files changed, 175 insertions(+), 175 deletions(-) delete mode 100644 features/dashboard/task_queue.feature create mode 100644 features/dashboard/tasks.feature delete mode 100644 features/steps/dashboard/task_queue.rb create mode 100644 features/steps/dashboard/tasks.rb diff --git a/app/views/dashboard/tasks/index.html.haml b/app/views/dashboard/tasks/index.html.haml index 16e7b4ae0c5..949006be886 100644 --- a/app/views/dashboard/tasks/index.html.haml +++ b/app/views/dashboard/tasks/index.html.haml @@ -1,5 +1,5 @@ -- page_title "Task Queue" -- header_title "Task Queue", dashboard_tasks_path +- page_title "Tasks" +- header_title "Tasks", dashboard_tasks_path .top-area %ul.nav-links diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index d3aec9ae202..3d55c4bba1b 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -22,7 +22,7 @@ = link_to admin_root_path, title: 'Admin Area', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do = icon('wrench fw') %li - = link_to dashboard_tasks_path, title: 'Task Queue', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do + = link_to dashboard_tasks_path, title: 'Tasks', data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do %span.badge.tasks-pending-count = tasks_pending_count - if current_user.can_create_project? diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index 0b59577ad66..586eff002df 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -4,6 +4,12 @@ = icon('home fw') %span Projects + = nav_link(controller: :tasks) do + = link_to dashboard_tasks_path, title: 'Tasks' do + = icon('bell fw') + %span + Tasks + %span.count= number_with_delimiter(tasks_pending_count) = nav_link(path: 'dashboard#activity') do = link_to activity_dashboard_path, class: 'shortcuts-activity', title: 'Activity' do = icon('dashboard fw') @@ -31,12 +37,6 @@ %span Merge Requests %span.count= number_with_delimiter(current_user.assigned_merge_requests.opened.count) - = nav_link(path: 'dashboard#tasks') do - = link_to dashboard_tasks_path, title: 'Task Queue' do - = icon('bell fw') - %span - Task Queue - %span.count= number_with_delimiter(tasks_pending_count) = nav_link(controller: :snippets) do = link_to dashboard_snippets_path, title: 'Snippets' do = icon('clipboard fw') diff --git a/features/dashboard/task_queue.feature b/features/dashboard/task_queue.feature deleted file mode 100644 index 8972a148289..00000000000 --- a/features/dashboard/task_queue.feature +++ /dev/null @@ -1,38 +0,0 @@ -@dashboard -Feature: Dashboard Task Queue - Background: - Given I sign in as a user - And I own project "Shop" - And "John Doe" is a developer of project "Shop" - And "Mary Jane" is a developer of project "Shop" - And "Mary Jane" owns private project "Enterprise" - And I am a developer of project "Enterprise" - And I have pending tasks - And I visit dashboard task queue page - - @javascript - Scenario: I mark pending tasks as done - Then I should see pending tasks assigned to me - And I mark the pending task as done - And I click on the "Done" tab - Then I should see all tasks marked as done - - @javascript - Scenario: I filter by project - Given I filter by "Enterprise" - Then I should not see tasks - - @javascript - Scenario: I filter by author - Given I filter by "John Doe" - Then I should not see tasks related to "Mary Jane" in the list - - @javascript - Scenario: I filter by type - Given I filter by "Issue" - Then I should not see tasks related to "Merge Requests" in the list - - @javascript - Scenario: I filter by action - Given I filter by "Mentioned" - Then I should not see tasks related to "Assignments" in the list diff --git a/features/dashboard/tasks.feature b/features/dashboard/tasks.feature new file mode 100644 index 00000000000..9d4f386f7dd --- /dev/null +++ b/features/dashboard/tasks.feature @@ -0,0 +1,38 @@ +@dashboard +Feature: Dashboard Tasks + Background: + Given I sign in as a user + And I own project "Shop" + And "John Doe" is a developer of project "Shop" + And "Mary Jane" is a developer of project "Shop" + And "Mary Jane" owns private project "Enterprise" + And I am a developer of project "Enterprise" + And I have pending tasks + And I visit dashboard task queue page + + @javascript + Scenario: I mark pending tasks as done + Then I should see pending tasks assigned to me + And I mark the pending task as done + And I click on the "Done" tab + Then I should see all tasks marked as done + + @javascript + Scenario: I filter by project + Given I filter by "Enterprise" + Then I should not see tasks + + @javascript + Scenario: I filter by author + Given I filter by "John Doe" + Then I should not see tasks related to "Mary Jane" in the list + + @javascript + Scenario: I filter by type + Given I filter by "Issue" + Then I should not see tasks related to "Merge Requests" in the list + + @javascript + Scenario: I filter by action + Given I filter by "Mentioned" + Then I should not see tasks related to "Assignments" in the list diff --git a/features/steps/dashboard/task_queue.rb b/features/steps/dashboard/task_queue.rb deleted file mode 100644 index 6ff0aff6c21..00000000000 --- a/features/steps/dashboard/task_queue.rb +++ /dev/null @@ -1,128 +0,0 @@ -class Spinach::Features::DashboardTaskQueue < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - include SharedUser - include Select2Helper - - step '"John Doe" is a developer of project "Shop"' do - project.team << [john_doe, :developer] - end - - step 'I am a developer of project "Enterprise"' do - enterprise.team << [current_user, :developer] - end - - step '"Mary Jane" is a developer of project "Shop"' do - project.team << [john_doe, :developer] - end - - step 'I have pending tasks' do - create(:task, user: current_user, project: project, author: mary_jane, target: issue, action: Task::MENTIONED) - create(:task, user: current_user, project: project, author: john_doe, target: issue, action: Task::ASSIGNED) - note = create(:note, author: john_doe, noteable: issue, note: "#{current_user.to_reference} Wdyt?") - create(:task, user: current_user, project: project, author: john_doe, target: issue, action: Task::MENTIONED, note: note) - create(:task, user: current_user, project: project, author: john_doe, target: merge_request, action: Task::ASSIGNED) - end - - step 'I should see pending tasks assigned to me' do - expect(page).to have_content 'Tasks 4' - expect(page).to have_content 'Done 0' - - expect(page).to have_link project.name_with_namespace - should_see_task(1, "John Doe assigned merge request ##{merge_request.iid}", merge_request.title) - should_see_task(2, "John Doe mentioned you on issue ##{issue.iid}", "#{current_user.to_reference} Wdyt?") - should_see_task(3, "John Doe assigned issue ##{issue.iid}", issue.title) - should_see_task(4, "Mary Jane mentioned you on issue ##{issue.iid}", issue.title) - end - - step 'I mark the pending task as done' do - page.within('.task:nth-child(1)') do - click_link 'Done' - end - - expect(page).to have_content 'Task was successfully marked as done.' - expect(page).to have_content 'Tasks 3' - expect(page).to have_content 'Done 1' - should_not_see_task "John Doe assigned merge request ##{merge_request.iid}" - end - - step 'I click on the "Done" tab' do - click_link 'Done 1' - end - - step 'I should see all tasks marked as done' do - expect(page).to have_link project.name_with_namespace - should_see_task(1, "John Doe assigned merge request ##{merge_request.iid}", merge_request.title, false) - end - - step 'I filter by "Enterprise"' do - select2(enterprise.id, from: "#project_id") - end - - step 'I filter by "John Doe"' do - select2(john_doe.id, from: "#author_id") - end - - step 'I filter by "Issue"' do - select2('Issue', from: "#type") - end - - step 'I filter by "Mentioned"' do - select2("#{Task::MENTIONED}", from: '#action_id') - end - - step 'I should not see tasks' do - expect(page).to have_content 'No tasks to show' - end - - step 'I should not see tasks related to "Mary Jane" in the list' do - should_not_see_task "Mary Jane mentioned you on issue ##{issue.iid}" - end - - step 'I should not see tasks related to "Merge Requests" in the list' do - should_not_see_task "John Doe assigned merge request ##{merge_request.iid}" - end - - step 'I should not see tasks related to "Assignments" in the list' do - should_not_see_task "John Doe assigned merge request ##{merge_request.iid}" - should_not_see_task "John Doe assigned issue ##{issue.iid}" - end - - def should_see_task(position, title, body, pending = true) - page.within(".task:nth-child(#{position})") do - expect(page).to have_content title - expect(page).to have_content body - - if pending - expect(page).to have_link 'Done' - else - expect(page).to_not have_link 'Done' - end - end - end - - def should_not_see_task(title) - expect(page).not_to have_content title - end - - def john_doe - @john_doe ||= user_exists("John Doe", { username: "john_doe" }) - end - - def mary_jane - @mary_jane ||= user_exists("Mary Jane", { username: "mary_jane" }) - end - - def enterprise - @enterprise ||= Project.find_by(name: 'Enterprise') - end - - def issue - @issue ||= create(:issue, assignee: current_user, project: project) - end - - def merge_request - @merge_request ||= create(:merge_request, assignee: current_user, source_project: project) - end -end diff --git a/features/steps/dashboard/tasks.rb b/features/steps/dashboard/tasks.rb new file mode 100644 index 00000000000..556aa41bad9 --- /dev/null +++ b/features/steps/dashboard/tasks.rb @@ -0,0 +1,128 @@ +class Spinach::Features::DashboardTasks < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + include SharedUser + include Select2Helper + + step '"John Doe" is a developer of project "Shop"' do + project.team << [john_doe, :developer] + end + + step 'I am a developer of project "Enterprise"' do + enterprise.team << [current_user, :developer] + end + + step '"Mary Jane" is a developer of project "Shop"' do + project.team << [john_doe, :developer] + end + + step 'I have pending tasks' do + create(:task, user: current_user, project: project, author: mary_jane, target: issue, action: Task::MENTIONED) + create(:task, user: current_user, project: project, author: john_doe, target: issue, action: Task::ASSIGNED) + note = create(:note, author: john_doe, noteable: issue, note: "#{current_user.to_reference} Wdyt?") + create(:task, user: current_user, project: project, author: john_doe, target: issue, action: Task::MENTIONED, note: note) + create(:task, user: current_user, project: project, author: john_doe, target: merge_request, action: Task::ASSIGNED) + end + + step 'I should see pending tasks assigned to me' do + expect(page).to have_content 'Tasks 4' + expect(page).to have_content 'Done 0' + + expect(page).to have_link project.name_with_namespace + should_see_task(1, "John Doe assigned merge request ##{merge_request.iid}", merge_request.title) + should_see_task(2, "John Doe mentioned you on issue ##{issue.iid}", "#{current_user.to_reference} Wdyt?") + should_see_task(3, "John Doe assigned issue ##{issue.iid}", issue.title) + should_see_task(4, "Mary Jane mentioned you on issue ##{issue.iid}", issue.title) + end + + step 'I mark the pending task as done' do + page.within('.task:nth-child(1)') do + click_link 'Done' + end + + expect(page).to have_content 'Task was successfully marked as done.' + expect(page).to have_content 'Tasks 3' + expect(page).to have_content 'Done 1' + should_not_see_task "John Doe assigned merge request ##{merge_request.iid}" + end + + step 'I click on the "Done" tab' do + click_link 'Done 1' + end + + step 'I should see all tasks marked as done' do + expect(page).to have_link project.name_with_namespace + should_see_task(1, "John Doe assigned merge request ##{merge_request.iid}", merge_request.title, false) + end + + step 'I filter by "Enterprise"' do + select2(enterprise.id, from: "#project_id") + end + + step 'I filter by "John Doe"' do + select2(john_doe.id, from: "#author_id") + end + + step 'I filter by "Issue"' do + select2('Issue', from: "#type") + end + + step 'I filter by "Mentioned"' do + select2("#{Task::MENTIONED}", from: '#action_id') + end + + step 'I should not see tasks' do + expect(page).to have_content 'No tasks to show' + end + + step 'I should not see tasks related to "Mary Jane" in the list' do + should_not_see_task "Mary Jane mentioned you on issue ##{issue.iid}" + end + + step 'I should not see tasks related to "Merge Requests" in the list' do + should_not_see_task "John Doe assigned merge request ##{merge_request.iid}" + end + + step 'I should not see tasks related to "Assignments" in the list' do + should_not_see_task "John Doe assigned merge request ##{merge_request.iid}" + should_not_see_task "John Doe assigned issue ##{issue.iid}" + end + + def should_see_task(position, title, body, pending = true) + page.within(".task:nth-child(#{position})") do + expect(page).to have_content title + expect(page).to have_content body + + if pending + expect(page).to have_link 'Done' + else + expect(page).to_not have_link 'Done' + end + end + end + + def should_not_see_task(title) + expect(page).not_to have_content title + end + + def john_doe + @john_doe ||= user_exists("John Doe", { username: "john_doe" }) + end + + def mary_jane + @mary_jane ||= user_exists("Mary Jane", { username: "mary_jane" }) + end + + def enterprise + @enterprise ||= Project.find_by(name: 'Enterprise') + end + + def issue + @issue ||= create(:issue, assignee: current_user, project: project) + end + + def merge_request + @merge_request ||= create(:merge_request, assignee: current_user, source_project: project) + end +end -- cgit v1.2.1