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
ulfertsf2f72220c165
diff --git a/modules/backlogs/features/product_owner.feature b/modules/backlogs/features/product_owner.featureindex 35166a03497..43adaacd465 100644--- a/modules/backlogs/features/product_owner.feature+++ b/modules/backlogs/features/product_owner.feature@@ -90,17 +90,6 @@ Feature: Product Owner| Story B | Sprint 001 |And I am already logged in as "mathias"- # TODO: add to stories_in_backlog spec- @javascript- Scenario: Create a new story- When I go to the master backlog- And I want to create a story- And I set the backlog of the story to Product Backlog- And I set the subject of the story to A Whole New Story- And I create the story- Then the 1st story in the "Product Backlog" should be "A Whole New Story"- And all positions should be unique for each version-@javascriptScenario: Move a story to the topGiven I am on the master backlogdiff --git a/modules/backlogs/spec/features/stories_in_backlog_spec.rb b/modules/backlogs/spec/features/stories_in_backlog_spec.rbindex 011db5864b6..90b8b1104ae 100644--- a/modules/backlogs/spec/features/stories_in_backlog_spec.rb+++ b/modules/backlogs/spec/features/stories_in_backlog_spec.rb@@ -70,6 +70,7 @@ describe 'Stories in backlog',type: story,status: default_status,version: sprint,+ position: 1,story_points: 10)endlet!(:sprint_story1_task) do@@ -92,6 +93,7 @@ describe 'Stories in backlog',type: story,status: default_status,version: sprint,+ position: 2,story_points: 20)endlet!(:backlog_story1) do@@ -145,6 +147,32 @@ describe 'Stories in backlog',backlogs_page.expect_story_not_in_sprint(sprint_story1_task, sprint)+ backlogs_page+ .expect_stories_in_order(sprint, sprint_story1, sprint_story2)++ # Creating a story++ backlogs_page.click_in_backlog_menu(sprint, 'New Story')+ backlogs_page.edit_new_story(subject: 'New story',+ story_points: 10)++ new_story = WorkPackage.find_by(subject: 'New story')++ backlogs_page+ .expect_story_in_sprint(new_story, sprint)++ # All positions will be unique in the sprint+ expect(Story.where(version: sprint, type: story).pluck(:position))+ .to match_array([1,2,3])++ backlogs_page+ .expect_stories_in_order(sprint, new_story, sprint_story1, sprint_story2)++ # Creating the story will update the velocity+ backlogs_page+ .expect_velocity(sprint_story1, 40)++# Editing in a sprintbacklogs_page@@ -162,7 +190,7 @@ describe 'Stories in backlog',# Updating the story_points of a story will update the velocity of the sprintbacklogs_page- .expect_velocity(sprint_story1, 35)+ .expect_velocity(sprint_story1, 45)# Editing in the backlogdiff --git a/modules/backlogs/spec/support/pages/backlogs.rb b/modules/backlogs/spec/support/pages/backlogs.rbindex a8c2497f6f9..d74a54eda1b 100644--- a/modules/backlogs/spec/support/pages/backlogs.rb+++ b/modules/backlogs/spec/support/pages/backlogs.rb@@ -44,7 +44,7 @@ module Pagesenddef alter_attributes_in_edit_mode(story, attributes)- within_story(story) do+ edit_proc = ->() doattributes.each do |key, value|case keywhen :subject@@ -58,18 +58,27 @@ module Pagesendendend++ if story+ within_story(story, &edit_proc)+ else+ edit_proc.call+ endenddef save_story_from_edit_mode(story)- within_story(story) do+ save_proc = -> () dofind('input[name=subject]').native.send_key :returnexpect(page).not_to have_selector('input[name=subject]')end- expect(page)- .not_to have_selector("#{story_selector(story)}.ajax_indicator")+ if story+ within_story(story, &save_proc)+ else+ save_proc.call+ endenddef edit_story(story, attributes)@@ -80,14 +89,33 @@ module Pagessave_story_from_edit_mode(story)end+ def edit_new_story(attributes)+ within('.story.editing') do+ alter_attributes_in_edit_mode(nil, attributes)++ save_story_from_edit_mode(nil)+ end+ end++ def click_in_backlog_menu(backlog, item_name)+ within_backlog(backlog) do+ find('.header .menu-trigger').click+ find('.header .menu .item', text: item_name).click+ end+ end+def expect_story_in_sprint(story, sprint)- expect(page)- .to have_selector("#backlog_#{sprint.id} #{story_selector(story)}")+ within_backlog(sprint) do+ expect(page)+ .to have_selector("#{story_selector(story)}")+ endenddef expect_story_not_in_sprint(story, sprint)- expect(page)- .not_to have_selector("#backlog_#{sprint.id} #{story_selector(story)}")+ within_backlog(sprint) do+ expect(page)+ .not_to have_selector("#{story_selector(story)}")+ endenddef expect_for_story(story, attributes)@@ -126,6 +154,16 @@ module Pages.to have_selector("#backlog_#{backlog.id} .velocity", text: velocity.to_s)end+ def expect_stories_in_order(backlog, *stories)+ within_backlog(backlog) do+ ids = stories.map { |s| "story_#{s.id}" }+ existing_ids_in_order = all(ids.map { |id| "##{id}" }.join(', ')).map { |element| element[:id] }++ expect(existing_ids_in_order)+ .to eql(ids)+ end+ end+def pathbacklogs_project_backlogs_path(project)end@@ -136,6 +174,10 @@ module Pageswithin(story_selector(story), &block)end+ def within_backlog(backlog, &block)+ within("#backlog_#{backlog.id}", &block)+ end+def story_selector(story)"#story_#{story.id}"end