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

ulferts9a30eb1908e6
diff --git a/modules/backlogs/features/edit_story_tracker_and_status.feature b/modules/backlogs/features/edit_story_tracker_and_status.feature
deleted file mode 100644
index 2a8fe4a02a3..00000000000
--- a/modules/backlogs/features/edit_story_tracker_and_status.feature
+++ /dev/null
@@ -1,111 +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: Edit story type and status
- As a user
- I want to edit the type and the status of a story
- In consideration of existing workflows
- So that I can not make changes that are not permitted by the system
-
- 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 following types are configured to track stories:
- | Story |
- | Epic |
- | Bug |
- And the type "Task" is configured to track tasks
- And the project uses the following types:
- | Story |
- | Bug |
- | Task |
- And there is 1 user with:
- | login | romano |
- And there is a role "manager"
- And the user "romano" is a "manager"
- And the role "manager" may have the following rights:
- | view_master_backlog |
- | view_work_packages |
- | add_work_packages |
- | edit_work_packages |
- | manage_subtasks |
- And the project has the following sprints:
- | name | start_date | effective_date |
- | Sprint 001 | 2010-01-01 | 2010-01-31 |
- And there are the following issue status:
- | name | is_closed | is_default |
- | New | false | true |
- | Resolved | false | false |
- | Closed | true | false |
- | Rejected | true | false |
- And there is a default issuepriority
- And the project has the following stories in the following sprints:
- | subject | sprint | type | status | story_points |
- | Story A | Sprint 001 | Bug | New | 10 |
- | Story B | Sprint 001 | Story | New | 20 |
- | Story C | Sprint 001 | Bug | New | 20 |
- And the Type "Story" has for the Role "manager" the following workflows:
- | old_status | new_status |
- | New | Rejected |
- | Rejected | Closed |
- | Rejected | New |
- And the Type "Bug" has for the Role "manager" the following workflows:
- | old_status | new_status |
- | New | Closed |
- And I am already logged in as "romano"
- And I am on the master backlog
-
- @javascript
- Scenario: Select a status and change to a type that does not offer the status
- When I click on the text "Story B"
-
- Then the available status of the story called "Story B" should be the following:
- | New |
- | Rejected |
-
- When I select "Rejected" from "status_id"
- And I select "Bug" from "type_id"
-
- Then the editable attributes of the story called "Story B" should be the following:
- | Status | |
- And the available status of the story called "Story B" should be the following:
- | New |
-
- When I confirm the story form
- Then the error alert should show "Status can't be blank"
-
- When I press "OK"
- And I click on the text "Story B"
- And I select "New" from "status_id"
- And I confirm the story form
-
- Then the displayed attributes of the story called "Story B" should be the following:
- | Status | New |
diff --git a/modules/backlogs/features/scrum_master.feature b/modules/backlogs/features/scrum_master.feature
index 848c9445e2c..bc8cf127e22 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: Move a story from product backlog to sprint backlog
- Given I am on the master backlog
- When I move the story named Story 1 up to the 1st position of the sprint named Sprint 001
- Then the request should complete successfully
- When I move the story named Story 4 up to the 2nd position of the sprint named Sprint 001
- And I move the story named Story 2 up to the 1st position of the sprint named Sprint 002
- And I move the story named Story 4 up to the 1st position of the sprint named Sprint 001
- Then Story 4 should be in the 1st position of the sprint named Sprint 001
- And Story 1 should be in the 2nd position of the sprint named Sprint 001
- And Story 2 should be in the 1st position of the sprint named Sprint 002
-
@javascript
Scenario: View tasks that have subtasks
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 1dbcd6536ac..94cba018803 100644
--- a/modules/backlogs/features/team_member.feature
+++ b/modules/backlogs/features/team_member.feature
@@ -98,33 +98,11 @@ Feature: Team Member
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 backlogs dashboard
- Given I am on the master backlog
- And I open the "Sprint 002" backlogs menu
- Then I should see "Burndown Chart"
-
@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: View sprint stories in the work_packages tab
- Given I am on the master backlog
- When I view the stories of Sprint 001 in the work_packages tab
- Then I should be on the work packages index page of the project called "ecookbook"
- When I press "Filter"
- Then I should see "Sprint 001" within "#values-version"
-
- @javascript
- Scenario: View the project stories in the work_packages tab
- Given I am on the master backlog
- When I view the stories in the work_packages tab
- Then I should be on the work packages index page of the project called "ecookbook"
- When I press "Filter"
- Then I should see "Version" within "#filters"
-
@javascript
Scenario: Copy estimate to remaining
Given I am on the taskboard for "Sprint 001"
diff --git a/modules/backlogs/spec/features/stories_in_backlog_spec.rb b/modules/backlogs/spec/features/stories_in_backlog_spec.rb
index 4e2fab513c2..a96bb350bfd 100644
--- a/modules/backlogs/spec/features/stories_in_backlog_spec.rb
+++ b/modules/backlogs/spec/features/stories_in_backlog_spec.rb
@@ -34,10 +34,11 @@ describe 'Stories in backlog',
js: true do
let!(:project) do
FactoryBot.create(:project,
- types: [story, task],
+ 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) }
@@ -106,6 +107,8 @@ describe 'Stories in backlog',
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
@@ -143,7 +146,7 @@ describe 'Stories in backlog',
login_as current_user
allow(Setting)
.to receive(:plugin_openproject_backlogs)
- .and_return('story_types' => [story.id.to_s],
+ .and_return('story_types' => [story.id.to_s, other_story.id.to_s],
'task_type' => task.id.to_s)
end
@@ -220,9 +223,7 @@ describe 'Stories in backlog',
backlogs_page
.expect_velocity(sprint, 45)
- # Moving stories within the sprint via drag and drop
-
- # Moving to top
+ # Moving a story to top
backlogs_page
.drag_in_sprint(sprint_story1, new_story)
@@ -234,7 +235,7 @@ describe 'Stories in backlog',
expect(Story.where(version: sprint, type: story, project: project).pluck(:position))
.to match_array([1, 2, 3])
- # Moving to bottom
+ # Moving a story to bottom
backlogs_page
.drag_in_sprint(sprint_story1, sprint_story2, before: false)
@@ -246,7 +247,20 @@ describe 'Stories in backlog',
expect(Story.where(version: sprint, type: story, project: project).pluck(:position))
.to match_array([1, 2, 3])
- # Editing in the backlog
+ # Moving a story to from the backlog to the sprint (3nd position)
+
+ backlogs_page
+ .drag_in_sprint(backlog_story1, sprint_story2, before: false)
+
+ sleep(0.5)
+
+ backlogs_page
+ .expect_stories_in_order(sprint, new_story, sprint_story2, backlog_story1, sprint_story1)
+
+ expect(Story.where(version: sprint, type: story, project: project).pluck(:position))
+ .to match_array([1, 2, 3, 4])
+
+ # Available statuses when editing
backlogs_page
.enter_edit_story_mode(backlog_story1)
@@ -280,19 +294,47 @@ describe 'Stories in backlog',
backlogs_page
.enter_edit_story_mode(backlog_story1)
- # Since we switched to other status, only the current status is available now.
+ # Since we switched to other status, only the current status and the next one is available now.
backlogs_page
.expect_status_options(backlog_story1,
[other_status])
+ # Available statuses when editing and switching the type
+ backlogs_page
+ .alter_attributes_in_edit_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)
+
+ backlogs_page
+ .expect_for_story(backlog_story1,
+ subject: 'Altered backlog story1',
+ status: default_status.name,
+ type: other_story.name)
+
# The pdf export is reachable via the menu
backlogs_page
.click_in_backlog_menu(sprint, 'Export')
# Will download something that is currently not speced
+ # Clicking would lead to having the burndown chart opened in another tab
+ # which seems hard to test with selenium.
+ backlogs_page
+ .expect_in_backlog_menu(sprint, 'Burndown Chart')
+
# 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_story_link_to_wp_page(sprint_story1)
+
+ # Go to the index page of work packages within that sprint via the menu
+ backlogs_page
+ .click_in_backlog_menu(sprint, 'Stories/Tasks')
+
+ wp_table = Pages::WorkPackagesTable.new(project)
+
+ wp_table
+ .expect_work_package_listed(new_story, sprint_story2, backlog_story1, sprint_story1)
end
end
diff --git a/modules/backlogs/spec/support/pages/backlogs.rb b/modules/backlogs/spec/support/pages/backlogs.rb
index 79d9b597614..7c9a3c70a91 100644
--- a/modules/backlogs/spec/support/pages/backlogs.rb
+++ b/modules/backlogs/spec/support/pages/backlogs.rb
@@ -53,6 +53,8 @@ module Pages
fill_in 'story points', with: value
when :status
select value, from: 'status'
+ when :type
+ select value, from: 'type'
else
raise NotImplementedError
end
@@ -149,6 +151,9 @@ module Pages
when :status
expect(page)
.to have_selector('div.status_id', text: value)
+ when :type
+ expect(page)
+ .to have_selector('div.type_id', text: value)
else
raise NotImplementedError
end
@@ -187,6 +192,18 @@ module Pages
end
end
+ def expect_in_backlog_menu(backlog, item_name)
+ within_backlog(backlog) do
+ find('.header .menu-trigger').click
+
+ expect(page)
+ .to have_selector('.header .menu .item', text: item_name)
+
+ # Close it again for next test
+ find('.header .menu-trigger').click
+ end
+ end
+
def path
backlogs_project_backlogs_path(project)
end