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

Fix cukes in backlogs due to js cucumber

Oliver Günther2258309baa1b
diff --git a/features/support/env.rb b/features/support/env.rb
index 09c358f64d5..9638ea5257a 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -135,7 +135,7 @@ Cucumber::Rails::Database.javascript_strategy = :truncation
# Remove any modal dialog remaining from the scenarios which finish in an unclean state
Before do |_scenario|
- page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertOpenError
+ page.driver.browser.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoSuchAlertError
end
Before do
diff --git a/features/support/selenium_with_firebug.rb b/features/support/selenium_with_firebug.rb
deleted file mode 100644
index 44826f8ea8e..00000000000
--- a/features/support/selenium_with_firebug.rb
+++ /dev/null
@@ -1,56 +0,0 @@
-#-- encoding: UTF-8
-#-- 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.
-#++
-
-Capybara.register_driver :selenium_with_firebug do |app|
- Capybara::Selenium::Driver
- profile = Selenium::WebDriver::Firefox::Profile.new
- profile.add_extension(File.expand_path('../firebug-1.11.4.xpi', __FILE__))
- profile.add_extension(File.expand_path('../firepath-0.9.7-fx.xpi', __FILE__))
-
- # Prevent "Welcome!" tab
- profile['extensions.firebug.currentVersion'] = '999'
-
- # Enable for all sites.
- profile['extensions.firebug.allPagesActivation'] = 'on'
-
- # Enable all features.
- ['console', 'net', 'script'].each do |feature|
- profile["extensions.firebug.#{feature}.enableSites"] = true
- end
-
- profile['intl.accept_languages'] = 'en,en-us'
-
- Capybara::Selenium::Driver.new(app,
- browser: :firefox,
- profile: profile)
-end
-
-Before '@firebug' do
- Capybara.current_driver = :selenium_with_firebug
-end
diff --git a/frontend/src/app/modules/backlogs/openproject-backlogs.routes.ts b/frontend/src/app/modules/backlogs/openproject-backlogs.routes.ts
index e730021740c..f2b1dd9e42a 100644
--- a/frontend/src/app/modules/backlogs/openproject-backlogs.routes.ts
+++ b/frontend/src/app/modules/backlogs/openproject-backlogs.routes.ts
@@ -36,4 +36,10 @@ export const BACKLOGS_ROUTES:Ng2StateDeclaration[] = [
url: '/backlogs',
component: BacklogsPageComponent
},
+ {
+ name: 'backlogs_sprint',
+ parent: 'root',
+ url: '/sprints/{sprintId:int}/taskboard',
+ component: BacklogsPageComponent
+ },
];
diff --git a/frontend/src/app/modules/router/openproject.routes.ts b/frontend/src/app/modules/router/openproject.routes.ts
index ef42f0b59f4..ce951b3d851 100644
--- a/frontend/src/app/modules/router/openproject.routes.ts
+++ b/frontend/src/app/modules/router/openproject.routes.ts
@@ -69,6 +69,12 @@ export const OPENPROJECT_ROUTES:Ng2StateDeclaration[] = [
url: '/backlogs',
loadChildren: () => import('../backlogs/openproject-backlogs.module').then(m => m.OpenprojectBacklogsModule)
},
+ {
+ name: 'backlogs_sprint.**',
+ parent: 'root',
+ url: '/sprints',
+ loadChildren: () => import('../backlogs/openproject-backlogs.module').then(m => m.OpenprojectBacklogsModule)
+ },
{
name: 'reporting.**',
parent: 'root',
@@ -156,8 +162,8 @@ export function initializeUiRouterListeners(injector:Injector) {
let wpBase = document.querySelector(appBaseSelector);
// Uncomment to trace route changes
- // const uiRouter = injector.get(UIRouter);
- // uiRouter.trace.enable();
+ const uiRouter = injector.get(UIRouter);
+ uiRouter.trace.enable();
// Apply classes from bodyClasses in each state definition
// This was defined as onEnter, onExit functions in each state before
diff --git a/modules/backlogs/features/common.feature b/modules/backlogs/features/common.feature
index fecfa1e94d5..2a494feae40 100644
--- a/modules/backlogs/features/common.feature
+++ b/modules/backlogs/features/common.feature
@@ -57,16 +57,19 @@ Feature: Common
And the user "paul" is a "team member"
And I am already logged in as "paul"
+ @javascript
Scenario: View the master backlog
Given I am on the overview page of the project
And I follow "Backlogs"
Then I should be on the master backlog
+ @javascript
Scenario: View the product backlog
When I go to the master backlog
- Then the request should complete successfully
+ Then I should see "Backlogs" within "#content"
+ @javascript
Scenario: View the product backlog without any stories
Given there are no stories in the project
When I go to the master backlog
- Then the request should complete successfully
+ Then I should see "Backlogs" within "#content"
diff --git a/modules/backlogs/features/product_owner.feature b/modules/backlogs/features/product_owner.feature
index 70044ac5a9d..1d48a665226 100644
--- a/modules/backlogs/features/product_owner.feature
+++ b/modules/backlogs/features/product_owner.feature
@@ -91,6 +91,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
@@ -98,6 +99,7 @@ Feature: Product Owner
And I should see 4 sprint backlogs
And I should see 2 product owner backlogs
+ @javascript
Scenario: Create a new story
When I go to the master backlog
And I want to create a story
@@ -107,6 +109,7 @@ Feature: Product Owner
Then 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
@@ -117,6 +120,7 @@ Feature: Product Owner
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
@@ -124,16 +128,19 @@ Feature: Product Owner
When I update the story
Then the status of the story should be set as closed
+ @javascript
Scenario: Move a story to the top
Given I am on the master backlog
When I move the 3rd story to the 1st position
Then the 1st story in the "Product Backlog" should be "Story 3"
+ @javascript
Scenario: Move a story to the bottom
Given I am on the master backlog
When I move the 2nd story to the last position
Then the 4th story in the "Product Backlog" should be "Story 2"
+ @javascript
Scenario: Move a story down
Given I am on the master backlog
When I move the 2nd story to the 3rd position
@@ -141,6 +148,7 @@ Feature: Product Owner
And the 3rd story in the "Product Backlog" should be "Story 2"
And the 4th story in the "Product Backlog" should be "Story 4"
+ @javascript
Scenario: Move a story up
Given I am on the master backlog
When I move the 4th story to the 2nd position
diff --git a/modules/backlogs/features/scrum_master.feature b/modules/backlogs/features/scrum_master.feature
index 70869df00d3..e74859cdd83 100644
--- a/modules/backlogs/features/scrum_master.feature
+++ b/modules/backlogs/features/scrum_master.feature
@@ -120,6 +120,7 @@ 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"
@@ -218,6 +219,7 @@ Feature: Scrum Master
And the impediment "Bad Company" should signal unsuccessful saving
And the error alert should show "IDs of blocked work packages must contain the ID of at least one ticket"
+ @javascript
Scenario: Update sprint details
Given I am on the master backlog
And I want to edit the sprint named Sprint 001
@@ -228,6 +230,7 @@ Feature: Scrum Master
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
@@ -235,6 +238,7 @@ 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
@@ -246,6 +250,7 @@ Feature: Scrum Master
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: Move a story down in a sprint
Given I am on the master backlog
When I move the story named Story A below Story B
@@ -253,6 +258,7 @@ Feature: Scrum Master
And Story A should be in the 2nd position of the sprint named Sprint 001
And Story B should be the higher item of Story A
+ @javascript
Scenario: View tasks that have subtasks
Given I am on the taskboard for "Sprint 005"
Then I should see "Task 10" within "#tasks"
@@ -264,6 +270,7 @@ Feature: Scrum Master
And I should not see "Subfeature"
And I should not see "Subsubtask"
+ @javascript
Scenario: Move stories around in the backlog that have a parent ticket
Given I am on the master backlog
When I move the story named Story D below Story E
@@ -285,6 +292,7 @@ Feature: Scrum Master
And I should see "Subfeature" within ".work-package-table--container table"
And I should see "Subsubtask" within ".work-package-table--container table"
+ @javascript
Scenario: Move a task with subtasks around in the taskboard
Given I am on the taskboard for "Sprint 005"
When I move the task named Task 10 below Task 11
diff --git a/modules/backlogs/features/shared_versions.feature b/modules/backlogs/features/shared_versions.feature
index 9e782de0b72..6654b9b3364 100644
--- a/modules/backlogs/features/shared_versions.feature
+++ b/modules/backlogs/features/shared_versions.feature
@@ -72,10 +72,12 @@ Feature: Shared Versions
| 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"
+ @javascript
Scenario: Only stories of current project are displayed
Given the project "parent" has the following stories in the following sprints:
| subject | backlog |
diff --git a/modules/backlogs/features/step_definitions/_then_steps.rb b/modules/backlogs/features/step_definitions/_then_steps.rb
index 87b607b7b5c..4fbfe3c1fab 100644
--- a/modules/backlogs/features/step_definitions/_then_steps.rb
+++ b/modules/backlogs/features/step_definitions/_then_steps.rb
@@ -108,11 +108,11 @@ Then /^(.+) should be the higher (story|item|task) of (.+)$/ do |higher_subject,
end
Then /^the request should complete successfully$/ do
- page.driver.response.status.should == 200
+ RequestStore[:response].status.should == 200
end
Then /^the request should fail$/ do
- page.driver.response.status.should == 401
+ RequestStore[:response].status.should == 401
end
Then /^the (\d+)(?:st|nd|rd|th) story in (?:the )?"(.+?)" should be "(.+)"$/ do |position, version_name, subject|
@@ -148,7 +148,7 @@ Then /^the (\d+)(?:st|nd|rd|th) task for (.+) should be (.+)$/ do |position, sto
end
Then /^the server should return an update error$/ do
- page.driver.response.status.should == 400
+ RequestStore[:response].status.should == 400
end
Then /^the server should return (\d+) updated (.+)$/ do |count, object_type|
diff --git a/modules/backlogs/features/step_definitions/_when_steps.rb b/modules/backlogs/features/step_definitions/_when_steps.rb
index 6382a76d845..ca891e577c0 100644
--- a/modules/backlogs/features/step_definitions/_when_steps.rb
+++ b/modules/backlogs/features/step_definitions/_when_steps.rb
@@ -26,20 +26,36 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
+def perform_post(url, params = {})
+ session = page.get_rack_session
+ driver = Capybara.current_driver
+ begin
+ Capybara.current_driver = :rack_test
+ page.set_rack_session(session)
+ RequestStore[:response] = page.driver.post(url, params)
+ rescue StandardError => e
+ warn "Failed to perform rack request: #{e}"
+ raise e
+ ensure
+ Capybara.current_driver = driver
+ page.set_rack_session(session)
+ end
+end
+
When /^I create the impediment$/ do
- page.driver.post backlogs_project_sprint_impediments_url(
+ perform_post backlogs_project_sprint_impediments_url(
*@impediment_params.values_at('project_id', 'version_id')
), @impediment_params.except('author_id', 'author')
end
When /^I create the story$/ do
- page.driver.post backlogs_project_sprint_stories_url(
+ perform_post backlogs_project_sprint_stories_url(
*@story_params.values_at('project_id', 'version_id')
), @story_params.except('author_id', 'author')
end
When /^I create the task$/ do
- page.driver.post backlogs_project_sprint_tasks_url(
+ perform_post backlogs_project_sprint_tasks_url(
*@task_params.values_at('project_id', 'version_id')
), @task_params.except('author_id', 'author')
end
@@ -62,7 +78,7 @@ When /^I move the (story|item|task) named (.+) below (.+)$/ do |type, story_subj
project = Project.find(attributes['project_id'])
sprint = prev.version
- page.driver.post polymorphic_url(
+ perform_post polymorphic_url(
[:backlogs, project, sprint.becomes(Sprint), story]
), attributes.merge('_method' => 'put')
end
@@ -82,7 +98,7 @@ When /^I move the story named (.+) (up|down) to the (\d+)(?:st|nd|rd|th) positio
stories[position - (direction == 'up' ? 2 : 1)].id
end
- page.driver.post backlogs_project_sprint_story_url(
+ perform_post backlogs_project_sprint_story_url(
*attributes.values_at('project_id', 'version_id', 'id')
), attributes.merge('_method' => 'put')
end
@@ -105,7 +121,7 @@ When /^I move the (\d+)(?:st|nd|rd|th) story to the (\d+|last)(?:st|nd|rd|th)? p
@story = Story.find(story.text.to_i)
- page.driver.post backlogs_project_sprint_story_url(
+ perform_post backlogs_project_sprint_story_url(
@project.id,
@story.version_id,
@story.id
@@ -113,25 +129,25 @@ When /^I move the (\d+)(?:st|nd|rd|th) story to the (\d+|last)(?:st|nd|rd|th)? p
end
When /^I update the impediment$/ do
- page.driver.post backlogs_project_sprint_impediment_url(
+ perform_post backlogs_project_sprint_impediment_url(
*@impediment_params.values_at('project_id', 'version_id', 'id')
), @impediment_params.merge('_method' => 'put')
end
When /^I update the sprint$/ do
- page.driver.post backlogs_project_sprint_url(
+ perform_post backlogs_project_sprint_url(
*@sprint_params.values_at('project_id', 'id')
), @sprint_params.merge('_method' => 'put')
end
When /^I update the story$/ do
- page.driver.post backlogs_project_sprint_story_url(
+ perform_post backlogs_project_sprint_story_url(
*@story_params.values_at('project_id', 'version_id', 'id')
), @story_params.merge('_method' => 'put')
end
When /^I update the task$/ do
- page.driver.post backlogs_project_sprint_task_url(
+ perform_post backlogs_project_sprint_task_url(
*@task_params.values_at('project_id', 'version_id', 'id')
), @task_params.merge('_method' => 'put')
end
diff --git a/modules/backlogs/features/team_member.feature b/modules/backlogs/features/team_member.feature
index c1ffa84a2fb..501e771abeb 100644
--- a/modules/backlogs/features/team_member.feature
+++ b/modules/backlogs/features/team_member.feature
@@ -81,6 +81,7 @@ 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
@@ -89,6 +90,7 @@ Feature: Team Member
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
@@ -97,6 +99,7 @@ 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 a taskboard
Given I am on the taskboard for "Sprint 001"
Then I should see the taskboard
@@ -128,6 +131,7 @@ Feature: Team Member
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"
And I want to create a task for Story 1
@@ -137,6 +141,7 @@ Feature: Team Member
Then the request should complete successfully
And task A Whole New Task should have remaining_hours set to 3
+ @javascript
Scenario: Copy remaining to estimate
Given I am on the taskboard for "Sprint 001"
And I want to create a task for Story 1
@@ -146,6 +151,7 @@ Feature: Team Member
Then the request should complete successfully
And task A Whole New Task should have estimated_hours set to 3
+ @javascript
Scenario: Set both estimate and remaining
Given I am on the taskboard for "Sprint 001"
And I want to create a task for Story 1
diff --git a/modules/backlogs/features/user_settings.feature b/modules/backlogs/features/user_settings.feature
index 3595348bb02..1b0e97bfbfa 100644
--- a/modules/backlogs/features/user_settings.feature
+++ b/modules/backlogs/features/user_settings.feature
@@ -28,6 +28,7 @@
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
index d7a671e7a46..8ac9ec56547 100644
--- a/modules/backlogs/features/version_settings.feature
+++ b/modules/backlogs/features/version_settings.feature
@@ -55,6 +55,7 @@ Feature: Version Settings
| Sprint 004 | 2010-03-01 | 2010-03-31 |
And I am already logged in as "padme"
+ @javascript
Scenario: Creating a new version
When I go to the versions/new page of the project called "ecookbook"
And I fill in "version_name" with "Sprint X"
@@ -63,6 +64,7 @@ Feature: Version Settings
And I should see "Successful creation." within "div.notice"
And I should see "Sprint X"
+ @javascript
Scenario: One can select whether versions are displayed left or right (left is default) in the backlogs page
When I go to the edit page of the version called "Sprint 001"
@@ -74,6 +76,7 @@ Feature: Version Settings
Then I should be on the settings/versions page of the project called "ecookbook"
+ @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 |
@@ -98,6 +101,7 @@ Feature: Version Settings
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"
@@ -130,11 +134,13 @@ Feature: Version Settings
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"
diff --git a/spec/features/versions/project_settings_index_spec.rb b/spec/features/versions/project_settings_index_spec.rb
index 2442e5705ac..7670b24539c 100644
--- a/spec/features/versions/project_settings_index_spec.rb
+++ b/spec/features/versions/project_settings_index_spec.rb
@@ -46,6 +46,7 @@ feature 'project settings index', type: :feature do
login_as(user)
end
+ @javascript
scenario 'see versions listed in semver order' do
visit settings_versions_project_path(project)