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

ulferts3122c00c4ce8
diff --git a/modules/backlogs/app/helpers/rb_master_backlogs_helper.rb b/modules/backlogs/app/helpers/rb_master_backlogs_helper.rb
index 5d6e30dcd1a..be0942a7f22 100644
--- a/modules/backlogs/app/helpers/rb_master_backlogs_helper.rb
+++ b/modules/backlogs/app/helpers/rb_master_backlogs_helper.rb
@@ -100,7 +100,7 @@ module RbMasterBacklogsHelper
def properties_link(backlog)
back_path = backlogs_project_backlogs_path(@project)
- version_path = edit_version_path(backlog.sprint, back_url: back_path)
+ version_path = edit_version_path(backlog.sprint, back_url: back_path, project_id: @project.id)
link_to(I18n.t(:'backlogs.properties'), version_path)
end
diff --git a/modules/backlogs/features/edit_version_from_menu.feature b/modules/backlogs/features/edit_version_from_menu.feature
deleted file mode 100644
index 26639847b86..00000000000
--- a/modules/backlogs/features/edit_version_from_menu.feature
+++ /dev/null
@@ -1,71 +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: Version Settings
- As a Project Admin
- I want to configure the backlogs plugin
- So that my team and I can work effectively
-
- Background:
- Given there is 1 project with:
- | name | ecookbook |
- And I am working in project "ecookbook"
- And the project uses the following modules:
- | backlogs |
- And the backlogs module is initialized
- And there is 1 user with:
- | login | padme |
- And there is a role "project admin"
- And the role "project admin" may have the following rights:
- | manage_versions |
- | view_master_backlog |
- And the user "padme" is a "project admin"
- And there is a default status with:
- | name | new |
- And the project has the following sprints:
- | name | start_date | effective_date |
- | Sprint 001 | 2010-01-01 | 2010-01-31 |
- And I am already logged in as "padme"
-
- @javascript
- Scenario: Moving the backlog via the menu
- Given I am on the master backlog
-
- When I open the "Sprint 001" backlogs menu
- And I follow "Properties" of the "Sprint 001" backlogs menu
-
- Then I should be on the edit page of the version "Sprint 001"
-
- When I select "right" from "Column in backlog"
- And I submit the form by the "Save" button
-
- Then I should be on the master backlog
- And the sprint "Sprint 001" should be displayed to the right
-
-
-
diff --git a/modules/backlogs/features/foldable_versions.feature b/modules/backlogs/features/foldable_versions.feature
deleted file mode 100644
index 2f197276e4c..00000000000
--- a/modules/backlogs/features/foldable_versions.feature
+++ /dev/null
@@ -1,101 +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: Foldable versions in master backlog
-
- Background:
- Given there is 1 project with:
- | name | 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 |
- 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 |
- | Task |
- And there is a default status with:
- | name | new |
- And there is a default issuepriority
- 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 |
- And the project has the following stories in the following sprints:
- | subject | sprint |
- | Story A | Sprint 001 |
- | Story B | Sprint 001 |
- | Story C | Sprint 001 |
- And I am already logged in as "markus"
-
- @javascript
- Scenario: Version are not folded by default and can be folded
- When I go to the master backlog
- Then I should see "Story A" within ".backlog"
-
- When I change the fold state of a version
- Then I should not see "Story A" within ".backlog"
-
- @javascript
- Scenario: Version fold status depends on users setting
- When I go to the my settings page
- And I check "Show versions folded"
- And I submit the form by the "Save" button
- Then I should see "Account was successfully updated"
-
- When I go to the master backlog
- Then I should not see "Story A" within ".backlog"
-
- When I change the fold state of a version
- Then I should see "Story A" within ".backlog"
-
- Then I go to the my settings page
- And I uncheck "Show versions folded"
- And I submit the form by the "Save" button
- Then I should see "Account was successfully updated"
-
- When I go to the master backlog
- Then I should see "Story A" within ".backlog"
-
- When I change the fold state of a version
- Then I should not see "Story A" within ".backlog"
diff --git a/modules/backlogs/features/scrum_master.feature b/modules/backlogs/features/scrum_master.feature
deleted file mode 100644
index f8e5bc0ed1c..00000000000
--- a/modules/backlogs/features/scrum_master.feature
+++ /dev/null
@@ -1,140 +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: Scrum Master
- As a scrum master
- I want to manage sprints and their stories
- So that they get done according the product owner´s requirements
-
- Background:
- Given there is 1 project with:
- | name | 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 |
- | add_work_packages |
- | view_wiki_pages |
- | edit_wiki_pages |
- | view_work_packages |
- | edit_work_packages |
- | manage_subtasks |
- | assign_versions |
- 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 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 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 product owner backlogs:
- | Product Backlog |
- | Wishlist |
- And the project has the following stories in the following backlogs:
- | subject | backlog |
- | Story 1 | Product Backlog |
- | Story 2 | Product Backlog |
- | Story 3 | Product Backlog |
- | Story 4 | Product Backlog |
- 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 the project has the following tasks:
- | subject | sprint | parent |
- | Task 1 | Sprint 001 | Story A |
- And the project has the following impediments:
- | subject | sprint | blocks |
- | Impediment 1 | Sprint 001 | Story A |
- And the project has the following work_packages:
- | subject | sprint | type |
- | Epic 1 | Sprint 005 | Epic |
- And the project has the following stories in the following sprints:
- | subject | sprint | parent |
- | Story D | Sprint 005 | Epic 1 |
- | Story E | Sprint 005 | Epic 1 |
- And the project has the following tasks:
- | subject | sprint | parent |
- | Task 10 | Sprint 005 | Story D |
- | Task 11 | Sprint 005 | Story D |
- | Subtask 1 | Sprint 005 | Task 10 |
- | Subtask 2 | Sprint 005 | Task 10 |
- | Subtask 3 | Sprint 005 | Task 11 |
- And the project has the following work_packages:
- | subject | sprint | parent | type |
- | Subfeature | Sprint 005 | Task 10 | Bug |
- | Subsubtask | Sprint 005 | Subfeature | Task |
- And I am already logged in as "markus"
-
- @javascript
- Scenario: Update sprint details
- Given I am on the master backlog
- And I want to edit the sprint named Sprint 001
- And I want to set the name of the sprint to sprint xxx
- And I want to set the start_date of the sprint to 2010-03-01
- And I want to set the effective_date of the sprint to 2010-03-20
- When I update the sprint
- Then the request should complete successfully
- And the sprint should be updated accordingly
-
- @javascript
- Scenario: Update sprint with no name
- Given I am on the master backlog
- And I want to edit the sprint named Sprint 001
- And I want to set the name of the sprint to an empty string
- When I update the sprint
- Then the server should return an update error
-
diff --git a/modules/backlogs/features/shared_versions.feature b/modules/backlogs/features/shared_versions.feature
deleted file mode 100644
index 2244daa209e..00000000000
--- a/modules/backlogs/features/shared_versions.feature
+++ /dev/null
@@ -1,77 +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: Shared Versions
- As a Team Members
- I want to use versions shared by other projects
- So that I can distribute work efficiently
-
- Background:
- Given there is 1 project with:
- | name | parent |
- And the project "parent" has the following sprints:
- | name | sharing | start_date | effective_date |
- | ParentSprint | system | 2010-01-01 | 2010-01-31 |
- And there is 1 project with:
- | name | child |
- And the project "child" uses the following modules:
- | backlogs |
- And the following types are configured to track stories:
- | story |
- | epic |
- And the type "task" is configured to track tasks
- And the project "parent" uses the following types:
- | story |
- | task |
- And the project "child" uses the following types:
- | story |
- | task |
- And I am working in project "child"
- And there is a default status with:
- | name | new |
- And there is a default issuepriority
- And there is 1 user with:
- | login | padme |
- And there is a role "project admin"
- And the role "project admin" may have the following rights:
- | manage_versions |
- | view_work_packages |
- | view_master_backlog |
- | add_work_packages |
- | edit_work_packages |
- | manage_subtasks |
- And the user "padme" is a "project admin"
- And the project has the following sprints:
- | name | start_date | effective_date |
- | ChildSprint | 2010-03-01 | 2010-03-31 |
- And I am already logged in as "padme"
-
- @javascript
- Scenario: Inherited Sprints are displayed
- Given I am on the master backlog
- Then I should see "ParentSprint" within "#sprint_backlogs_container .backlog:first-child .sprint .name"
diff --git a/modules/backlogs/features/user_settings.feature b/modules/backlogs/features/user_settings.feature
index 1b0e97bfbfa..3595348bb02 100644
--- a/modules/backlogs/features/user_settings.feature
+++ b/modules/backlogs/features/user_settings.feature
@@ -28,7 +28,6 @@
Feature: User settings
- @javascript
Scenario: A user can change its task color
Given there is 1 user with the following:
| login | bob |
diff --git a/modules/backlogs/features/version_settings.feature b/modules/backlogs/features/version_settings.feature
deleted file mode 100644
index da4e36bc734..00000000000
--- a/modules/backlogs/features/version_settings.feature
+++ /dev/null
@@ -1,128 +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: Version Settings
- As a Project Admin
- I want to configure the backlogs plugin
- So that my team and I can work effectively
-
- Background:
- Given there is 1 project with:
- | name | ecookbook |
- And I am working in project "ecookbook"
- And the project uses the following modules:
- | backlogs |
- And the backlogs module is initialized
- And there is 1 user with:
- | login | padme |
- And there is a role "project admin"
- And the role "project admin" may have the following rights:
- | manage_versions |
- | view_master_backlog |
- And the user "padme" is a "project admin"
- And there is a default status with:
- | name | new |
- 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 | 2010-03-01 | 2010-03-31 |
- And I am already logged in as "padme"
-
- @javascript
- Scenario: Inherited versions can also be configured to be displayed left, right or not at all
- Given there is 1 project with:
- | name | parent |
- And I am working in project "parent"
- And the project uses the following modules:
- | backlogs |
- And the project has the following sprints:
- | name | start_date | effective_date | sharing |
- | shared | 2010-01-01 | 2010-01-31 | system |
- And I am working in project "ecookbook"
-
- When I go to the settings/versions page of the project called "ecookbook"
-
- # Click on the edit link
- When I click on the element with class "icon-edit" within ".version.shared .buttons"
-
- Then the editable attributes of the version should be the following:
- | Column in backlog | left |
-
- When I select "right" from "Column in backlog"
- And I press "Save"
-
- Then I should be on the settings/versions page of the project called "ecookbook"
-
- @javascript
- Scenario: Setting "Column in backlog" to the different settings
- When I go to the edit page of the version called "Sprint 001"
- And I select "right" from "Column in backlog"
- And I press "Save"
- And I go to the edit page of the version called "Sprint 001"
-
- Then the editable attributes of the version should be the following:
- | Column in backlog | right |
-
- When I go to the edit page of the version called "Sprint 002"
- And I select "left" from "Column in backlog"
- And I press "Save"
- And I go to the edit page of the version called "Sprint 002"
-
- Then the editable attributes of the version should be the following:
- | Column in backlog | left |
-
- When I go to the edit page of the version called "Sprint 003"
- And I select "none" from "Column in backlog"
- And I press "Save"
- And I go to the edit page of the version called "Sprint 003"
-
- Then the editable attributes of the version should be the following:
- | Column in backlog | none |
-
- When I go to the master backlog of the project "ecookbook"
-
- Then I should see "Sprint 001" within "#owner_backlogs_container"
- And I should see "Sprint 002" within "#sprint_backlogs_container"
- And I should not see "Sprint 003" within "#owner_backlogs_container"
- And I should not see "Sprint 003" within "#sprint_backlogs_container"
-
- @javascript
- Scenario: There should be a version start date field
- When I go to the edit page of the version called "Sprint 001"
- Then the editable attributes of the version should be the following:
- | Start date | 2010-01-01 |
-
- @javascript
- Scenario: former sprint_start_date and start_date are the same
- When I go to the edit page of the version called "Sprint 001"
- And I fill in "2010-01-20" for "version_start_date"
- And I press "Save"
- And I go to the master backlog of the project "ecookbook"
- Then the start date of "Sprint 001" should be "2010-01-20"
diff --git a/modules/backlogs/spec/features/backlogs_in_backlog_view_spec.rb b/modules/backlogs/spec/features/backlogs_in_backlog_view_spec.rb
new file mode 100644
index 00000000000..a37edc08cc1
--- /dev/null
+++ b/modules/backlogs/spec/features/backlogs_in_backlog_view_spec.rb
@@ -0,0 +1,270 @@
+#-- 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/backlogs'
+
+describe 'Backlogs in backlog view',
+ type: :feature,
+ js: true do
+ let!(:project) do
+ FactoryBot.create(:project,
+ types: [story, task],
+ 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: story.id)
+ end
+ let(:role) do
+ FactoryBot.create(:role,
+ permissions: %i(view_master_backlog
+ add_work_packages
+ view_work_packages
+ edit_work_packages
+ manage_subtasks
+ manage_versions
+ update_sprints
+ assign_versions))
+
+ end
+ let!(:current_user) do
+ FactoryBot.create(:user,
+ member_in_project: project,
+ member_through_role: role)
+ 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!(:backlog) do
+ FactoryBot.create(:version,
+ project: project,
+ version_settings_attributes: [{ project: project, display: VersionSetting::DISPLAY_RIGHT }])
+ end
+ let!(:other_project) do
+ FactoryBot.create(:project)
+ end
+ let!(:other_project_sprint) do
+ FactoryBot.create(:version,
+ project: other_project,
+ sharing: 'system',
+ start_date: Date.today - 10.days,
+ effective_date: Date.today + 10.days)
+ end
+ let!(:sprint_story1) do
+ FactoryBot.create(:work_package,
+ project: project,
+ type: story,
+ status: default_status,
+ version: sprint,
+ position: 1,
+ story_points: 10)
+ end
+ let(:backlogs_page) { Pages::Backlogs.new(project) }
+
+ before do
+ login_as current_user
+ allow(Setting)
+ .to receive(:plugin_openproject_backlogs)
+ .and_return('story_types' => [story.id.to_s],
+ 'task_type' => task.id.to_s)
+ end
+
+ it 'displays stories which are editable' do
+ backlogs_page.visit!
+
+ backlogs_page
+ .expect_sprint(sprint)
+
+ # Shared versions are also displayed as a sprint.
+ # Without version settings, it is displayed as a sprint
+ backlogs_page
+ .expect_sprint(other_project_sprint)
+
+ backlogs_page
+ .expect_backlog(backlog)
+
+ # Versions can be folded
+ backlogs_page
+ .expect_story_in_sprint(sprint_story1, sprint)
+
+ backlogs_page
+ .fold_backlog(sprint)
+
+ backlogs_page
+ .expect_story_not_in_sprint(sprint_story1, sprint)
+
+ # The backlogs can be folded by default
+ visit my_settings_path
+
+ check 'Show versions folded'
+
+ click_button 'Save'
+
+ backlogs_page.visit!
+
+ backlogs_page
+ .expect_story_not_in_sprint(sprint_story1, sprint)
+
+ backlogs_page
+ .fold_backlog(sprint)
+
+ backlogs_page
+ .expect_story_in_sprint(sprint_story1, sprint)
+
+ # Alter the attributes of the sprint
+ sleep(0.5)
+ backlogs_page
+ .edit_backlog(sprint, name: '')
+
+ backlogs_page
+ .expect_and_dismiss_error("Name can't be blank.")
+
+ sleep(0.2)
+
+ backlogs_page
+ .edit_backlog(sprint,
+ name: 'New sprint name',
+ start_date: Date.today + 5.days,
+ effective_date: Date.today + 20.days)
+
+ sleep(0.5)
+
+ sprint.reload
+
+ expect(sprint.name)
+ .to eql 'New sprint name'
+
+ expect(sprint.start_date)
+ .to eql Date.today + 5.days
+
+ expect(sprint.effective_date)
+ .to eql Date.today + 20.days
+
+ # Alter displaying a sprints as a backlog
+
+ backlogs_page
+ .click_in_backlog_menu(sprint, 'Properties')
+
+ select 'right', from: 'Column in backlog'
+
+ click_button 'Save'
+
+ backlogs_page
+ .expect_and_dismiss_notification(message: "Successful update.")
+
+ backlogs_page
+ .expect_backlog(sprint)
+
+ # The others are unchanged
+ backlogs_page
+ .expect_backlog(backlog)
+
+ backlogs_page
+ .expect_sprint(other_project_sprint)
+
+ # Alter displaying a backlog as a sprint
+ backlogs_page
+ .click_in_backlog_menu(backlog, 'Properties')
+
+ select 'left', from: 'Column in backlog'
+
+ click_button 'Save'
+
+ backlogs_page
+ .expect_and_dismiss_notification(message: "Successful update.")
+
+ # Now works as a sprint instead of a backlog
+ backlogs_page
+ .expect_sprint(backlog)
+
+ # The others are unchanged
+ backlogs_page
+ .expect_backlog(sprint)
+
+ backlogs_page
+ .expect_sprint(other_project_sprint)
+
+ # Alter displaying a version not at all
+ backlogs_page
+ .click_in_backlog_menu(backlog, 'Properties')
+
+ select 'none', from: 'Column in backlog'
+
+ click_button 'Save'
+
+ backlogs_page
+ .expect_and_dismiss_notification(message: "Successful update.")
+
+ # the disabled backlog/sprint is no longer visible
+ expect(page)
+ .not_to have_content(backlog.name)
+
+ # The others are unchanged
+ backlogs_page
+ .expect_backlog(sprint)
+
+ backlogs_page
+ .expect_sprint(other_project_sprint)
+
+ # Inherited versions can also be modified
+ backlogs_page
+ .click_in_backlog_menu(other_project_sprint, 'Properties')
+
+ select 'none', from: 'Column in backlog'
+
+ click_button 'Save'
+
+ backlogs_page
+ .expect_and_dismiss_notification(message: "Successful update.")
+
+ # the disabled backlog/sprint is no longer visible
+ expect(page)
+ .not_to have_content(other_project_sprint.name)
+
+ # The others are unchanged
+ backlogs_page
+ .expect_backlog(sprint)
+
+ expect(page)
+ .not_to have_content(backlog.name)
+ end
+end
diff --git a/modules/backlogs/spec/features/stories_in_backlog_spec.rb b/modules/backlogs/spec/features/stories_in_backlog_spec.rb
index a96bb350bfd..23ecea08315 100644
--- a/modules/backlogs/spec/features/stories_in_backlog_spec.rb
+++ b/modules/backlogs/spec/features/stories_in_backlog_spec.rb
@@ -272,9 +272,9 @@ describe 'Stories in backlog',
[default_status, other_status])
backlogs_page
- .alter_attributes_in_edit_mode(backlog_story1,
- subject: 'Altered backlog story1',
- status: other_status.name)
+ .alter_attributes_in_edit_story_mode(backlog_story1,
+ subject: 'Altered backlog story1',
+ status: other_status.name)
backlogs_page
.save_story_from_edit_mode(backlog_story1)
@@ -301,8 +301,8 @@ describe 'Stories in backlog',
# Available statuses when editing and switching the type
backlogs_page
- .alter_attributes_in_edit_mode(backlog_story1,
- type: other_story)
+ .alter_attributes_in_edit_story_mode(backlog_story1,
+ type: other_story)
# This will result in an error as the current status is not available
backlogs_page
.save_story_from_edit_mode(backlog_story1)
diff --git a/modules/backlogs/spec/support/pages/backlogs.rb b/modules/backlogs/spec/support/pages/backlogs.rb
index 7c9a3c70a91..84eb7d44e18 100644
--- a/modules/backlogs/spec/support/pages/backlogs.rb
+++ b/modules/backlogs/spec/support/pages/backlogs.rb
@@ -43,7 +43,13 @@ module Pages
end
end
- def alter_attributes_in_edit_mode(story, attributes)
+ def enter_edit_backlog_mode(backlog)
+ within_backlog(backlog) do
+ find('.start_date.editable').click
+ end
+ end
+
+ def alter_attributes_in_edit_story_mode(story, attributes)
edit_proc = ->() do
attributes.each do |key, value|
case key
@@ -68,6 +74,23 @@ module Pages
end
end
+ def alter_attributes_in_edit_backlog_mode(backlog, attributes)
+ within_backlog(backlog) do
+ attributes.each do |key, value|
+ case key
+ when :name
+ find('input[name=name]').set value
+ when :start_date
+ find('input[name=start_date]').set value
+ when :effective_date
+ find('input[name=effective_date]').set value
+ else
+ raise NotImplementedError
+ end
+ end
+ end
+ end
+
def save_story_from_edit_mode(story)
save_proc = -> () do
find('input[name=subject]').native.send_key :return
@@ -83,17 +106,34 @@ module Pages
end
end
+ def save_backlog_from_edit_mode(backlog)
+ within_backlog(backlog) do
+ find('input[name=name]').native.send_key :return
+
+ expect(page)
+ .to have_selector('.start_date.editable')
+ end
+ end
+
+ def edit_backlog(backlog, attributes)
+ enter_edit_backlog_mode(backlog)
+
+ alter_attributes_in_edit_backlog_mode(backlog, attributes)
+
+ save_backlog_from_edit_mode(backlog)
+ end
+
def edit_story(story, attributes)
enter_edit_story_mode(story)
- alter_attributes_in_edit_mode(story, attributes)
+ alter_attributes_in_edit_story_mode(story, attributes)
save_story_from_edit_mode(story)
end
def edit_new_story(attributes)
within('.story.editing') do
- alter_attributes_in_edit_mode(nil, attributes)
+ alter_attributes_in_edit_story_mode(nil, attributes)
save_story_from_edit_mode(nil)
end
@@ -127,6 +167,22 @@ module Pages
.perform
end
+ def fold_backlog(backlog)
+ within_backlog(backlog) do
+ find('.toggler').click
+ end
+ end
+
+ def expect_sprint(sprint)
+ expect(page)
+ .to have_selector("#sprint_backlogs_container #{backlog_selector(sprint)}")
+ end
+
+ def expect_backlog(sprint)
+ expect(page)
+ .to have_selector("#owner_backlogs_container #{backlog_selector(sprint)}")
+ end
+
def expect_story_in_sprint(story, sprint)
within_backlog(sprint) do
expect(page)
@@ -204,6 +260,15 @@ module Pages
end
end
+ def expect_and_dismiss_error(message)
+ within '.ui-dialog' do
+ expect(page)
+ .to have_content message
+
+ click_button('OK')
+ end
+ end
+
def path
backlogs_project_backlogs_path(project)
end
@@ -215,11 +280,19 @@ module Pages
end
def within_backlog(backlog, &block)
- within("#backlog_#{backlog.id}", &block)
+ within(backlog_selector(backlog), &block)
+ end
+
+ def backlog_selector(backlog)
+ "#backlog_#{backlog.id}"
end
def story_selector(story)
"#story_#{story.id}"
end
+
+ def notification_type
+ :ruby
+ end
end
end
diff --git a/spec/support/pages/page.rb b/spec/support/pages/page.rb
index 07ad19791c6..ee59e610bf2 100644
--- a/spec/support/pages/page.rb
+++ b/spec/support/pages/page.rb
@@ -104,7 +104,11 @@ module Pages
end
def dismiss_notification!
- page.find('.notification-box--close').click
+ if notification_type == :angular
+ page.find('.notification-box--close').click
+ else
+ page.find('.flash .icon-close').click
+ end
end
def expect_no_notification(type: :success, message: nil)