Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

replace cukes with specs

ulfertseebaf414d98e
diff --git a/modules/backlogs/features/fixed_version_by_issue_hierarchy.feature b/modules/backlogs/features/fixed_version_by_issue_hierarchy.feature
deleted file mode 100644
index b3f48b962a7..00000000000
--- a/modules/backlogs/features/fixed_version_by_issue_hierarchy.feature
+++ /dev/null
@@ -1,122 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2020 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2017 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See docs/COPYRIGHT.rdoc for more details.
-#++
-
-Feature: The work_package hierarchy defines the allowed versions for each work_package dependent on the type
- As a team member
- I want to CRUD work_packages with a reliable target version system
- So that I know what target version an work_package can have or will be assigned
-
- Background:
- Given there is 1 project with:
- | name | ecookbook |
- | identifier | ecookbook |
- And I am working in project "ecookbook"
- And the project uses the following modules:
- | backlogs |
- And there is a role "scrum master"
- And the role "scrum master" may have the following rights:
- | view_master_backlog |
- | view_taskboards |
- | update_sprints |
- | view_wiki_pages |
- | edit_wiki_pages |
- | view_work_packages |
- | edit_work_packages |
- | manage_subtasks |
- | add_work_packages |
- | assign_versions |
- And there are the following issue status:
- | name | is_closed | is_default |
- | New | false | true |
- | In Progress | false | false |
- | Resolved | false | false |
- | Closed | true | false |
- | Rejected | true | false |
- And there is a default issuepriority
- And the backlogs module is initialized
- And the following types are configured to track stories:
- | Story |
- And the type "Task" is configured to track tasks
- And the project uses the following types:
- | Story |
- | Epic |
- | Task |
- | Bug |
- And the type "Task" has the default workflow for the role "scrum master"
- And there is 1 user with:
- | login | markus |
- | firstname | Markus |
- | Lastname | Master |
- And the user "markus" is a "scrum master"
- And the project has the following sprints:
- | name | start_date | effective_date |
- | Sprint 001 | 2010-01-01 | 2010-01-31 |
- | Sprint 002 | 2010-02-01 | 2010-02-28 |
- | Sprint 003 | 2010-03-01 | 2010-03-31 |
- | Sprint 004 | 2.weeks.ago | 1.week.from_now |
- | Sprint 005 | 3.weeks.ago | 2.weeks.from_now|
- And the project has the following stories in the following sprints:
- | subject | sprint |
- | Story A | Sprint 001 |
- | Story B | Sprint 001 |
- | Story C | Sprint 002 |
- And I am already logged in as "markus"
-
- @javascript
- Scenario: Creating a task, via the taskboard, as a subtask to a story sets the target version to the story´s version
- Given I am on the taskboard for "Sprint 001"
- When I click to add a new task for story "Story A"
- And I fill in "Task 0815" for "subject"
- And I press "OK"
- Then I should see "Task 0815" as a task to story "Story A"
- And the request on task "Task 0815" is finished
- And the task "Task 0815" should have "Sprint 001" as its target version
-
- @javascript
- Scenario: Stale Object Error when creating task via the taskboard without 'Remaining hours' after having created a task with 'Remaining hours' after having created a task without 'Remaining Hours' (bug 9057)
- Given I am on the taskboard for "Sprint 001"
- When I click to add a new task for story "Story A"
- And I fill in "Task1" for "subject"
- And I fill in "3" for "remaining hours"
- And I press "OK"
- And I click to add a new task for story "Story A"
- And I fill in "Task2" for "subject"
- And I press "OK"
- And I click to add a new task for story "Story A"
- And I fill in "Task3" for "subject"
- And I fill in "7" for "remaining hours"
- And I press "OK"
- And the request on task "Task1" is finished
- And the request on task "Task2" is finished
- And the request on task "Task3" is finished
- Then there should not be a saving error on task "Task3"
- And the task "Task1" should have "Sprint 001" as its target version
- And the task "Task2" should have "Sprint 001" as its target version
- And the task "Task3" should have "Sprint 001" as its target version
- And task Task1 should have remaining_hours set to 3
- And task Task3 should have remaining_hours set to 7
diff --git a/modules/backlogs/features/scrum_master.feature b/modules/backlogs/features/scrum_master.feature
index bc8cf127e22..d1d3495433e 100644
--- a/modules/backlogs/features/scrum_master.feature
+++ b/modules/backlogs/features/scrum_master.feature
@@ -138,18 +138,6 @@ Feature: Scrum Master
When I update the sprint
Then the server should return an update error
- @javascript
- Scenario: View tasks that have subtasks
- Given I am on the taskboard for "Sprint 005"
- Then I should see "Task 10" within "#tasks"
- And I should see "Task 11" within "#tasks"
- And I should not see "Subtask 1"
- And I should not see "Subtask 2"
- And I should not see "Subtask 3"
- And I should not see "Epic 1"
- And I should not see "Subfeature"
- And I should not see "Subsubtask"
-
@javascript
Scenario: Move a task with subtasks around in the taskboard
Given I am on the taskboard for "Sprint 005"
diff --git a/modules/backlogs/features/team_member.feature b/modules/backlogs/features/team_member.feature
index 94cba018803..0a80de7cddc 100644
--- a/modules/backlogs/features/team_member.feature
+++ b/modules/backlogs/features/team_member.feature
@@ -80,29 +80,6 @@ Feature: Team Member
| Impediment 2 | Sprint 001 | Story 2 |
And I am already logged in as "paul"
- @javascript
- Scenario: Create a task for a story
- Given I am on the taskboard for "Sprint 001"
- And I want to create a task for Story 1
- And I set the subject of the task to A Whole New Task
- When I create the task
- Then the request should complete successfully
- And the 1st task for Story 1 should be A Whole New Task
-
- @javascript
- Scenario: Update a task for a story
- Given I am on the taskboard for "Sprint 001"
- And I want to edit the task named Task 1
- And I set the subject of the task to Whoa there, Sparky
- When I update the task
- Then the request should complete successfully
- And the story named Story 1 should have 1 task named Whoa there, Sparky
-
- @javascript
- Scenario: View the burndown chart from the taskboard
- Given I am on the taskboard for "Sprint 002"
- Then I should see "Burndown Chart"
-
@javascript
Scenario: Copy estimate to remaining
Given I am on the taskboard for "Sprint 001"
diff --git a/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb b/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb
new file mode 100644
index 00000000000..7547febe188
--- /dev/null
+++ b/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb
@@ -0,0 +1,223 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2020 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2017 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See docs/COPYRIGHT.rdoc for more details.
+#++
+
+require 'spec_helper'
+require_relative '../support/pages/taskboard'
+
+describe 'Tasks on taskboard',
+ type: :feature,
+ js: true do
+ let!(:project) do
+ FactoryBot.create(:project,
+ types: [story, task, other_story],
+ enabled_module_names: %w(work_package_tracking backlogs))
+ end
+ let!(:story) { FactoryBot.create(:type_feature) }
+ let!(:other_story) { FactoryBot.create(:type) }
+ let!(:task) { FactoryBot.create(:type_task) }
+ let!(:priority) { FactoryBot.create(:default_priority) }
+ let!(:default_status) { FactoryBot.create(:status, is_default: true) }
+ let!(:other_status) { FactoryBot.create(:status) }
+ let!(:workflows) do
+ FactoryBot.create(:workflow,
+ old_status: default_status,
+ new_status: other_status,
+ role: role,
+ type_id: task.id)
+ end
+ let(:role) do
+ FactoryBot.create(:role,
+ permissions: %i(view_taskboards
+ add_work_packages
+ view_work_packages
+ edit_work_packages
+ manage_subtasks
+ assign_versions))
+
+ end
+ let!(:current_user) do
+ FactoryBot.create(:user,
+ member_in_project: project,
+ member_through_role: role)
+ end
+ let!(:story1) do
+ FactoryBot.create(:work_package,
+ project: project,
+ type: story,
+ status: default_status,
+ version: sprint,
+ position: 1,
+ story_points: 10)
+ end
+ let!(:story1_task) do
+ FactoryBot.create(:work_package,
+ project: project,
+ parent: story1,
+ type: task,
+ status: default_status,
+ version: sprint)
+ end
+ let!(:story1_task_subtask) do
+ FactoryBot.create(:work_package,
+ project: project,
+ parent: story1_task,
+ type: task,
+ status: default_status,
+ version: sprint)
+ end
+ let!(:other_work_package) do
+ FactoryBot.create(:work_package,
+ project: project,
+ type: FactoryBot.create(:type),
+ status: default_status,
+ version: sprint)
+ end
+ let!(:other_work_package_subtask) do
+ FactoryBot.create(:work_package,
+ project: project,
+ parent: other_work_package,
+ type: task,
+ status: default_status,
+ version: sprint)
+ end
+ let!(:story2) do
+ FactoryBot.create(:work_package,
+ project: project,
+ type: story,
+ status: default_status,
+ version: sprint,
+ position: 2,
+ story_points: 20)
+ end
+ let!(:sprint) do
+ FactoryBot.create(:version,
+ project: project,
+ start_date: Date.today - 10.days,
+ effective_date: Date.today + 10.days,
+ version_settings_attributes: [{ project: project, display: VersionSetting::DISPLAY_LEFT }])
+ end
+ let!(:other_project) do
+ FactoryBot.create(:project).tap do |p|
+ FactoryBot.create(:member,
+ principal: current_user,
+ project: p,
+ roles: [role])
+ end
+ end
+ let!(:story_in_other_project) do
+ FactoryBot.create(:work_package,
+ project: other_project,
+ type: story,
+ status: default_status,
+ version: sprint,
+ story_points: 10)
+
+ end
+ let!(:export_card_configurations) do
+ ExportCardConfiguration.create!(name: 'Default',
+ per_page: 1,
+ page_size: 'A4',
+ orientation: 'landscape',
+ rows: "group1:\n has_border: false\n rows:\n row1:\n height: 50\n priority: 1\n columns:\n id:\n has_label: false")
+ end
+ let(:taskboard_page) { Pages::Taskboard.new(project, sprint) }
+
+ before do
+ login_as current_user
+ allow(Setting)
+ .to receive(:plugin_openproject_backlogs)
+ .and_return('story_types' => [story.id.to_s, other_story.id.to_s],
+ 'task_type' => task.id.to_s)
+ end
+
+ it 'displays stories which are editable' do
+ taskboard_page.visit!
+
+ # All stories of the sprint are visible
+ taskboard_page
+ .expect_story(story1)
+
+ taskboard_page
+ .expect_story(story2)
+
+ # All tasks of the sprint are visible
+ taskboard_page
+ .expect_task(story1_task)
+
+ # Other work packages also assigned to the sprint are not visible
+ taskboard_page
+ .expect_work_package_not_visible(other_work_package)
+
+ # Tasks that have a non story as their parent are not visible
+ taskboard_page
+ .expect_work_package_not_visible(other_work_package_subtask)
+
+ # Tasks that have a task and not a story as their parent are not visible
+ taskboard_page
+ .expect_work_package_not_visible(story1_task_subtask)
+
+ # The task is in the first status column belonging to its parent story
+ taskboard_page
+ .expect_task_in_story_column(story1_task, story1, 1)
+
+ # Adding a task will have it added to the same sprint and belonging to the story
+ taskboard_page
+ .add_task(story1,
+ subject: "Added task",
+ assignee: current_user.name,
+ remaining_hours: 7)
+
+ added_task = WorkPackage.find_by(subject: "Added task")
+
+ expect(added_task.version)
+ .to eql sprint
+
+ expect(added_task.parent)
+ .to eql story1
+
+ # Added task will also be displayed
+ taskboard_page
+ .expect_task_in_story_column(added_task, story1, 1)
+
+ # Updating a task
+ taskboard_page
+ .update_task(story1_task,
+ subject: "Updated task",
+ assignee: current_user.name)
+
+ story1_task.reload
+
+ expect(story1_task.subject)
+ .to eql "Updated task"
+
+ # There is a button to the burndown chart
+ expect(page)
+ .to have_selector("a[href='#{backlogs_project_sprint_burndown_chart_path(project, sprint)}']",
+ text: 'Burndown Chart')
+ end
+end
diff --git a/modules/backlogs/spec/support/pages/taskboard.rb b/modules/backlogs/spec/support/pages/taskboard.rb
new file mode 100644
index 00000000000..4e637bd9e33
--- /dev/null
+++ b/modules/backlogs/spec/support/pages/taskboard.rb
@@ -0,0 +1,109 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2020 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2017 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See docs/COPYRIGHT.rdoc for more details.
+#++
+
+require 'support/pages/page'
+
+module Pages
+ class Taskboard < Page
+ attr_reader :project, :sprint
+
+ def initialize(project, sprint)
+ super()
+ @project = project
+ @sprint = sprint
+ end
+
+ def expect_story(story)
+ expect(page)
+ .to have_selector(story_selector(story))
+ end
+
+ def expect_task(task)
+ expect(page)
+ .to have_selector("#work_package_#{task.id}")
+ end
+
+ def expect_task_in_story_column(task, story, column)
+ within ".story_#{story.id} td:nth-of-type(#{column + 2})" do
+ expect(page)
+ .to have_selector("#work_package_#{task.id}")
+ end
+ end
+
+ def expect_work_package_not_visible(work_package)
+ expect(page)
+ .to have_no_content(work_package.subject)
+ end
+
+ def add_task(story, attributes)
+ find(".story_#{story.id} td.add_new").click
+
+ change_attributes_in_modal(attributes)
+
+ expect(page).to have_no_selector('.ui-dialog')
+ expect(page).to have_no_selector('#work_package_')
+ end
+
+ def update_task(story, attributes)
+ find("#work_package_#{story.id}").click
+
+ change_attributes_in_modal(attributes)
+
+ expect(page).to have_no_selector('.ui-dialog')
+
+ sleep(0.5)
+ end
+
+ def path
+ backlogs_project_sprint_taskboard_path(project, sprint)
+ end
+
+ private
+
+ def story_selector(story)
+ "#story_#{story.id}"
+ end
+
+ def change_attributes_in_modal(attributes)
+ within '.ui-dialog' do
+ attributes.each do |key, value|
+ case key
+ when :subject
+ fill_in 'subject', with: value
+ when :assignee
+ select value, from: 'assigned to'
+ when :remaining_hours
+ fill_in 'remaining hours', with: value
+ end
+ end
+
+ click_button 'OK'
+ end
+ end
+ end
+end