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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
replace cuke with spec
ulfertseff9bd21bd65
diff --git a/modules/backlogs/app/services/impediments/create_service.rb b/modules/backlogs/app/services/impediments/create_service.rbindex 9b55411c3a2..bac49e5ecb8 100644--- a/modules/backlogs/app/services/impediments/create_service.rb+++ b/modules/backlogs/app/services/impediments/create_service.rb@@ -38,6 +38,6 @@ class Impediments::CreateServiceWorkPackages::CreateService.new(user: user)- .call(attributes.merge(work_package: Impediment.new).symbolize_keys)+ .call(**attributes.merge(work_package: Impediment.new).symbolize_keys)endenddiff --git a/modules/backlogs/app/services/impediments/update_service.rb b/modules/backlogs/app/services/impediments/update_service.rbindex 7b44372bce7..3dbe4c6a133 100644--- a/modules/backlogs/app/services/impediments/update_service.rb+++ b/modules/backlogs/app/services/impediments/update_service.rb@@ -38,6 +38,6 @@ class Impediments::UpdateServiceWorkPackages::UpdateService.new(user: user,model: impediment)- .call(attributes)+ .call(**attributes)endenddiff --git a/modules/backlogs/app/services/stories/create_service.rb b/modules/backlogs/app/services/stories/create_service.rbindex 429325e2db1..1ccb9d2550a 100644--- a/modules/backlogs/app/services/stories/create_service.rb+++ b/modules/backlogs/app/services/stories/create_service.rb@@ -36,7 +36,7 @@ class Stories::CreateServicedef call(attributes: {}, prev: nil)create_call = WorkPackages::CreateService.new(user: user)- .call(attributes.symbolize_keys)+ .call(**attributes.symbolize_keys)if create_call.success?create_call.result.move_after prevdiff --git a/modules/backlogs/app/services/stories/update_service.rb b/modules/backlogs/app/services/stories/update_service.rbindex b2b7cb76dad..e0222b41aa2 100644--- a/modules/backlogs/app/services/stories/update_service.rb+++ b/modules/backlogs/app/services/stories/update_service.rb@@ -38,7 +38,7 @@ class Stories::UpdateServicecreate_call = WorkPackages::UpdateService.new(user: user,model: story)- .call(attributes.symbolize_keys)+ .call(**attributes.symbolize_keys)if create_call.success? && prevcreate_call.result.move_after prevdiff --git a/modules/backlogs/app/services/tasks/create_service.rb b/modules/backlogs/app/services/tasks/create_service.rbindex d15d7b43020..cb94101e30a 100644--- a/modules/backlogs/app/services/tasks/create_service.rb+++ b/modules/backlogs/app/services/tasks/create_service.rb@@ -38,7 +38,7 @@ class Tasks::CreateServicecreate_call = WorkPackages::CreateService.new(user: user)- .call(attributes)+ .call(**attributes)if create_call.success?create_call.result.move_after prevdiff --git a/modules/backlogs/app/services/tasks/update_service.rb b/modules/backlogs/app/services/tasks/update_service.rbindex f5081491a94..a2f2a42a503 100644--- a/modules/backlogs/app/services/tasks/update_service.rb+++ b/modules/backlogs/app/services/tasks/update_service.rb@@ -38,7 +38,7 @@ class Tasks::UpdateServicecreate_call = WorkPackages::UpdateService.new(user: user,model: task)- .call(attributes)+ .call(**attributes)if create_call.success?create_call.result.move_after prevdiff --git a/modules/backlogs/app/views/rb_stories/_helpers.html.erb b/modules/backlogs/app/views/rb_stories/_helpers.html.erbindex 81006149895..3ede0079848 100644--- a/modules/backlogs/app/views/rb_stories/_helpers.html.erb+++ b/modules/backlogs/app/views/rb_stories/_helpers.html.erb@@ -42,13 +42,14 @@ See docs/COPYRIGHT.rdoc for more details.<% all_work_package_status.each do |old_status| %><select class="status_id helper" id="status_id_options_default_<%= old_status.id %>">- <option value="<%= default_work_package_status.id %>" class="<%= (default_work_package_status.is_closed? ? t(:label_closed_work_packages) + ' ' : "") %>">- <%= default_work_package_status.name %>- </option><% if old_status != default_work_package_status %><option value="<%= old_status.id %>" class="<%= (old_status.is_closed? ? t(:label_closed_work_packages) + ' ' : "") %>"><%= old_status.name %></option>+ <% else %>+ <option value="<%= default_work_package_status.id %>" class="<%= (default_work_package_status.is_closed? ? t(:label_closed_work_packages) + ' ' : "") %>">+ <%= default_work_package_status.name %>+ </option><% end %></select><% end %>diff --git a/modules/backlogs/features/edit_story_tracker_and_status.feature b/modules/backlogs/features/edit_story_tracker_and_status.featureindex 2c9a9709209..2a8fe4a02a3 100644--- a/modules/backlogs/features/edit_story_tracker_and_status.feature+++ b/modules/backlogs/features/edit_story_tracker_and_status.feature@@ -83,25 +83,6 @@ Feature: Edit story type and statusAnd I am already logged in as "romano"And I am on the master backlog- @javascript- Scenario: Display only statuses which are allowed by workflow- When I click on the text "Story A"-- And the available status of the story called "Story A" should be the following:- | New |- | Closed |-- When I select "Closed" from "status_id"- And I confirm the story form-- Then the displayed attributes of the story called "Story A" should be the following:- | Status | Closed |-- When I click on the text "Story A"-- Then the available status of the story called "Story A" should be the following:- | Closed |-@javascriptScenario: Select a status and change to a type that does not offer the statusWhen I click on the text "Story B"@@ -128,21 +109,3 @@ Feature: Edit story type and statusThen the displayed attributes of the story called "Story B" should be the following:| Status | New |-- @javascript- Scenario: Edit a story having no permission for the status of the current ticket- When the Type "Bug" has for the Role "manager" the following workflows:- | old_status | new_status |- | New | Resolved |- And I am on the master backlog- And I click on the text "Story C"-- Then the available status of the story called "Story C" should be the following:- | New |- | Resolved |-- When I select "Resolved" from "status_id"- And I confirm the story form-- Then the displayed attributes of the story called "Story C" should be the following:- | Status | Resolved |diff --git a/modules/backlogs/features/product_owner.feature b/modules/backlogs/features/product_owner.featureindex 9914cbe8d41..35166a03497 100644--- a/modules/backlogs/features/product_owner.feature+++ b/modules/backlogs/features/product_owner.feature@@ -90,14 +90,7 @@ Feature: Product Owner| Story B | Sprint 001 |And I am already logged in as "mathias"- @javascript- Scenario: View the product backlog- When I go to the master backlog- Then I should see the product backlog- And I should see 4 stories in the "Product Backlog"- And I should see 4 sprint backlogs- And I should see 2 product owner backlogs-+ # TODO: add to stories_in_backlog spec@javascriptScenario: Create a new storyWhen I go to the master backlog@@ -108,25 +101,6 @@ Feature: Product OwnerThen the 1st story in the "Product Backlog" should be "A Whole New Story"And all positions should be unique for each version- @javascript- Scenario: Update a story- Given I am on the master backlog- And I want to edit the story with subject Story 3- And I set the subject of the story to Relaxdiego was here- And I set the type of the story to Epic- When I update the story- Then the story should have a subject of Relaxdiego was here- And the story should have a type of Epic- And the story should be at position 3-- @javascript- Scenario: Close a story- Given I am on the master backlog- And I want to edit the story with subject Story 4- And I set the status of the story to Closed- When I update the story- Then the status of the story should be set as closed-@javascriptScenario: Move a story to the topGiven I am on the master backlogdiff --git a/modules/backlogs/features/scrum_master.feature b/modules/backlogs/features/scrum_master.featureindex 8d5b8248aaf..5ff987ea5d8 100644--- a/modules/backlogs/features/scrum_master.feature+++ b/modules/backlogs/features/scrum_master.feature@@ -119,15 +119,6 @@ Feature: Scrum Master| Subsubtask | Sprint 005 | Subfeature | Task |And I am already logged in as "markus"- @javascript- Scenario: View stories that have a parent ticket- Given I am on the master backlog- Then I should see 2 stories in "Sprint 005"- And I should not see "Epic 1"- And I should not see "Task 10"- And I should not see "Subtask 1"- And I should not see "Subfeature"-@javascriptScenario: Update sprint detailsGiven I am on the master backlogdiff --git a/modules/backlogs/features/shared_versions.feature b/modules/backlogs/features/shared_versions.featureindex ac7fc73d704..00068521073 100644--- a/modules/backlogs/features/shared_versions.feature+++ b/modules/backlogs/features/shared_versions.feature@@ -76,6 +76,7 @@ Feature: Shared VersionsGiven I am on the master backlogThen I should see "ParentSprint" within "#sprint_backlogs_container .backlog:first-child .sprint .name"+ # TODO: Add to stories_in_backlog spec@javascriptScenario: Only stories of current project are displayedGiven the project "parent" has the following stories in the following sprints:diff --git a/modules/backlogs/features/show_story.feature b/modules/backlogs/features/show_story.featuredeleted file mode 100644index f488342c37a..00000000000--- a/modules/backlogs/features/show_story.feature+++ /dev/null@@ -1,76 +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: Show story-- 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 |- | add_work_packages |- | edit_work_packages |- | manage_subtasks |- 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 |- And I am already logged in as "markus"-- @javascript- Scenario: Show work_package in modal box via click- When I go to the master backlog- And I click on the link for the story "Story A"- Then I should see "Story A" within "#content"diff --git a/modules/backlogs/spec/features/stories_in_backlog_spec.rb b/modules/backlogs/spec/features/stories_in_backlog_spec.rbindex f90ecac231d..011db5864b6 100644--- a/modules/backlogs/spec/features/stories_in_backlog_spec.rb+++ b/modules/backlogs/spec/features/stories_in_backlog_spec.rb@@ -40,19 +40,14 @@ describe 'Stories in backlog',let!(:story) { FactoryBot.create(:type_feature) }let!(:task) { FactoryBot.create(:type_task) }let!(:priority) { FactoryBot.create(:default_priority) }- let!(:status) { FactoryBot.create(:status, is_default: true) }+ let!(:default_status) { FactoryBot.create(:status, is_default: true) }let!(:other_status) { FactoryBot.create(:status) }let!(:workflows) doFactoryBot.create(:workflow,- old_status: status,+ old_status: default_status,new_status: other_status,role: role,type_id: story.id)- FactoryBot.create(:workflow,- old_status: status,- new_status: other_status,- role: role,- type_id: task.id)endlet(:role) doFactoryBot.create(:role,@@ -73,13 +68,29 @@ describe 'Stories in backlog',FactoryBot.create(:work_package,project: project,type: story,+ status: default_status,version: sprint,story_points: 10)end+ let!(:sprint_story1_task) do+ FactoryBot.create(:work_package,+ project: project,+ type: task,+ status: default_status,+ version: sprint)+ end+ let!(:sprint_story2_parent) do+ FactoryBot.create(:work_package,+ project: project,+ type: FactoryBot.create(:type),+ status: default_status,+ version: sprint)+ endlet!(:sprint_story2) doFactoryBot.create(:work_package,project: project,type: story,+ status: default_status,version: sprint,story_points: 20)end@@ -87,6 +98,7 @@ describe 'Stories in backlog',FactoryBot.create(:work_package,project: project,type: story,+ status: default_status,version: backlog)endlet!(:sprint) do@@ -116,10 +128,25 @@ describe 'Stories in backlog',backlogs_page.expect_velocity(sprint_story1, 30)- # Editing in a sprint+ # All stories are visible in their sprint/backlog+ # but non stories are not displayedbacklogs_page.expect_story_in_sprint(sprint_story1, sprint)+ backlogs_page+ .expect_story_in_sprint(sprint_story2, sprint)++ backlogs_page+ .expect_story_in_sprint(backlog_story1, backlog)++ backlogs_page+ .expect_story_not_in_sprint(sprint_story2_parent, sprint)++ backlogs_page+ .expect_story_not_in_sprint(sprint_story1_task, sprint)++ # Editing in a sprint+backlogs_page.edit_story(sprint_story1,subject: 'Altered story1',@@ -138,18 +165,47 @@ describe 'Stories in backlog',.expect_velocity(sprint_story1, 35)# Editing in the backlog+backlogs_page- .expect_story_in_sprint(backlog_story1, backlog)+ .enter_edit_story_mode(backlog_story1)++ # The available statuses include those available by the workflow:+ # Current and every reachable one+ backlogs_page+ .expect_status_options(backlog_story1,+ [default_status, other_status])backlogs_page- .edit_story(backlog_story1, subject: 'Altered backlog story1')+ .alter_attributes_in_edit_mode(backlog_story1,+ subject: 'Altered backlog story1',+ status: other_status.name)+ backlogs_page+ .save_story_from_edit_mode(backlog_story1)backlog_story1.reloadexpect(backlog_story1.subject).to eql 'Altered backlog story1'+ expect(backlog_story1.status)+ .to eql other_status++ backlogs_page+ .expect_for_story(backlog_story1,+ subject: 'Altered backlog story1',+ status: other_status.name)++ backlogs_page+ .enter_edit_story_mode(backlog_story1)++ # Since we switched to other status, only the current status is available now.+ backlogs_page+ .expect_status_options(backlog_story1,+ [other_status])++ # One can switch to the work package page by clicking on the id+ # Clicking on it will open the wp in another tab which seems to trip up selenium.backlogs_page- .expect_for_story(backlog_story1, subject: 'Altered backlog story1')+ .expect_story_link_to_wp_page(sprint_story1)endenddiff --git a/modules/backlogs/spec/support/pages/backlogs.rb b/modules/backlogs/spec/support/pages/backlogs.rbindex 77a19824bee..a8c2497f6f9 100644--- a/modules/backlogs/spec/support/pages/backlogs.rb+++ b/modules/backlogs/spec/support/pages/backlogs.rb@@ -37,21 +37,31 @@ module Pages@project = projectend- def edit_story(story, attributes)+ def enter_edit_story_mode(story)within_story(story) dofind('*', text: story.subject).click+ end+ end+ def alter_attributes_in_edit_mode(story, attributes)+ within_story(story) doattributes.each do |key, value|case keywhen :subjectfill_in 'subject', with: valuewhen :story_pointsfill_in 'story points', with: value+ when :status+ select value, from: 'status'elseraise NotImplementedErrorendend+ end+ end+ def save_story_from_edit_mode(story)+ within_story(story) dofind('input[name=subject]').native.send_key :returnexpect(page)@@ -62,11 +72,24 @@ module Pages.not_to have_selector("#{story_selector(story)}.ajax_indicator")end+ def edit_story(story, attributes)+ enter_edit_story_mode(story)++ alter_attributes_in_edit_mode(story, attributes)++ save_story_from_edit_mode(story)+ end+def expect_story_in_sprint(story, sprint)expect(page).to have_selector("#backlog_#{sprint.id} #{story_selector(story)}")end+ def expect_story_not_in_sprint(story, sprint)+ expect(page)+ .not_to have_selector("#backlog_#{sprint.id} #{story_selector(story)}")+ end+def expect_for_story(story, attributes)within_story(story) doattributes.each do |key, value|@@ -74,6 +97,9 @@ module Pageswhen :subjectexpect(page).to have_selector('div.subject', text: value)+ when :status+ expect(page)+ .to have_selector('div.status_id', text: value)elseraise NotImplementedErrorend@@ -81,6 +107,20 @@ module Pagesendend+ def expect_story_link_to_wp_page(story)+ within_story(story) do+ expect(page)+ .to have_link(story.id, href: work_package_path(story))+ end+ end++ def expect_status_options(story, statuses)+ within_story(story) do+ expect(all('.status_id option').map { |n| n.text.strip } )+ .to match_array(statuses.map(&:name))+ end+ end+def expect_velocity(backlog, velocity)expect(page).to have_selector("#backlog_#{backlog.id} .velocity", text: velocity.to_s)