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 meeting cukes
Oliver Günther992476aff469
diff --git a/modules/meeting/features/meeting_close.feature b/modules/meeting/features/meeting_close.featuredeleted file mode 100644index 29ac05a2f4b..00000000000--- a/modules/meeting/features/meeting_close.feature+++ /dev/null@@ -1,112 +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: Close and open meeting agendas-- Background:- Given there is 1 project with the following:- | identifier | dingens |- | name | dingens |- And the project "dingens" uses the following modules:- | meetings |- And there is 1 user with:- | login | alice |- | language | en |- And there is 1 user with:- | login | bob |- And there is a role "user"- And the user "alice" is a "user" in the project "dingens"- And there is 1 meeting in project "dingens" created by "bob" with:- | title | Bobs Meeting |-- @javascript- Scenario: Navigate to a meeting page with no permission to close meeting agendas- Given the role "user" may have the following rights:- | view_meetings |- When I am already logged in as "alice"- And I go to the show page of the meeting called "Bobs Meeting"- And I follow "Agenda"- Then I should not see "Close" within ".meeting_agenda"-- @javascript- Scenario: Navigate to a meeting page with permission to close the meeting agenda and go to the minutes- Given the role "user" may have the following rights:- | view_meetings |- | close_meeting_agendas |- When I am already logged in as "alice"- And I go to the show page of the meeting called "Bobs Meeting"- And I follow "Minutes" within ".scrollable-tabs"- Then I should not see "Edit" within ".meeting_minutes"- And I should see "Close the agenda to begin the Minutes" within ".meeting_minutes"-- @javascript- Scenario: Navigate to a meeting page with permission to close and close the meeting agenda copies the text and shows the meeting- Given the role "user" may have the following rights:- | view_meetings |- | close_meeting_agendas |- And the meeting "Bobs Meeting" has 1 agenda with:- | text | "blubber" |- When I am already logged in as "alice"- And I go to the show page of the meeting called "Bobs Meeting"- And I follow "Close" within ".meeting_agenda"- And I confirm the JS confirm dialog-- Then I should be on the show page of the meeting called "Bobs Meeting"- And the minutes should contain the following text:- | blubber |-- When I follow "Agenda"- Then I should not see "Close" within ".meeting_agenda"- And I should see "Open" within ".meeting_agenda"-- @javascript- Scenario: Navigate to a meeting page with permission to close and open the meeting agenda- Given the role "user" may have the following rights:- | view_meetings |- | close_meeting_agendas |- # This won't work because the needed "click on open" has a confirm() which cucumber doesn't seem to handle- # And the meeting "Bobs Meeting" has 1 agenda with:- # | locked | true |- When I am already logged in as "alice"- And I go to the show page of the meeting called "Bobs Meeting"- And I follow "Agenda"- # And I click on "Open"- Then I should not see "Open" within ".meeting_agenda"- And I should see "Close" within ".meeting_agenda"-- @javascript- Scenario: Navigate to a meeting page with a closed meeting agenda and permission to edit meeting agendas- Given the role "user" may have the following rights:- | view_meetings |- | create_meeting_agendas |- And the meeting "Bobs Meeting" has 1 agenda with:- | locked | true |- When I am already logged in as "alice"- And I go to the show page of the meeting called "Bobs Meeting"- And I follow "Agenda"- Then I should not see "Edit" within ".meeting_agenda"diff --git a/modules/meeting/features/step_definitions/meeting_steps.rb b/modules/meeting/features/step_definitions/meeting_steps.rbdeleted file mode 100644index 4004a6668d2..00000000000--- a/modules/meeting/features/step_definitions/meeting_steps.rb+++ /dev/null@@ -1,85 +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.-#++--Given /^there is (\d+) [Mm]eetings? in project "(.+)" created by "(.+)" with:$/ do |count, project, user, table|- count.to_i.times do- m = FactoryBot.build(:meeting)- m.project = Project.find_by_name(project)- m.author = User.find_by_login(user)- send_table_to_object(m, table)- end-end--Given /^the [Mm]eeting "(.+)" has 1 agenda with:$/ do |meeting, table|- m = Meeting.find_by_title(meeting)- ma = MeetingAgenda.find_by_meeting_id(m.id) || FactoryBot.build(:meeting_agenda, meeting: m)- send_table_to_object(ma, table)-end--Given /^the [Mm]eeting "(.+)" has 1 agenda$/ do |meeting|- m = Meeting.find_by_title(meeting)- m.agenda ||= FactoryBot.build(:meeting_agenda)- m.save!-end--Given /^the [Mm]eeting "(.+)" has minutes with:$/ do |meeting, table|- m = Meeting.find_by_title(meeting)- mm = MeetingMinutes.find_by_meeting_id(m.id) || FactoryBot.build(:meeting_minutes, meeting: m)- send_table_to_object(mm, table)-end--Given /^"(.+)" is invited to the [Mm]eeting "(.+)"$/ do |user, meeting|- m = Meeting.find_by_title(meeting)- p = m.participants.detect { |p| p.user_id = User.find_by_login(user).id } || FactoryBot.build(:meeting_participant, meeting: m)- p.invited = true- p.save-end--Given /^"(.+)" attended the [Mm]eeting "(.+)"$/ do |user, meeting|- m = Meeting.find_by_title(meeting)- p = m.participants.detect { |p| p.user_id = User.find_by_login(user).id } || FactoryBot.build(:meeting_participant, meeting: m)- p.attended = true- p.save-end--When /the agenda of the meeting "(.+)" changes meanwhile/ do |meeting|- m = Meeting.find_by_title(meeting)- m.agenda.text = 'oder oder?'- m.agenda.save!-end--Then /^the minutes should contain the following text:$/ do |table|- step %{I should see "#{table.raw.first.first}" within "#meeting_minutes-text"}-end--Then /^there should be a text edit toolbar for the "(.+)" field$/ do |field_id|- # second parent up- ancestor = find(:xpath, "//*[@id='#{field_id.gsub('#','')}']/../..")-- expect(ancestor).to have_selector('.jstElements')-enddiff --git a/modules/meeting/features/support/participant_steps.rb b/modules/meeting/features/support/participant_steps.rbdeleted file mode 100644index 2572afc8e68..00000000000--- a/modules/meeting/features/support/participant_steps.rb+++ /dev/null@@ -1,33 +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.-#++--Then(/^the user "(.*?)" should( not)? be available as a participant$/) do |login, negative|- user = User.find_by_login(login)-- step(%{I should#{negative} see "#{user.name}" within "#meeting-form table.form--matrix"})-enddiff --git a/modules/meeting/features/support/paths.rb b/modules/meeting/features/support/paths.rbdeleted file mode 100644index d67085e132d..00000000000--- a/modules/meeting/features/support/paths.rb+++ /dev/null@@ -1,56 +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.-#++--module MeetingNavigationHelpers- # Maps a name to a path. Used by the- #- # When /^I go to (.+)$/ do |page_name|- #- # step definition in web_steps.rb- #- def path_to(page_name)- case page_name- when /^the (\w+?) activity page for the [pP]roject "(.+?)"$/- project = get_project($2)- "/projects/#{project.identifier}/activity?show_#{$1}=1"-- when /^the show page (?:of|for) the meeting called "(.+?)"$/- meeting = Meeting.find_by_title($1)-- "/meetings/#{meeting.id}"- when /^the edit page (?:of|for) the meeting called "(.+?)"$/- meeting = Meeting.find_by_title($1)-- "/meetings/#{meeting.id}/edit"- else- super- end- end-end--World(MeetingNavigationHelpers)diff --git a/modules/meeting/spec/features/meetings_close_spec.rb b/modules/meeting/spec/features/meetings_close_spec.rbnew file mode 100644index 00000000000..5115eb941a4--- /dev/null+++ b/modules/meeting/spec/features/meetings_close_spec.rb@@ -0,0 +1,92 @@+#-- 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'++describe 'Meetings close', type: :feature do+ let(:project) { FactoryBot.create :project, enabled_module_names: %w[meetings] }+ let(:user) do+ FactoryBot.create(:user,+ member_in_project: project,+ member_with_permissions: permissions)+ end+ let(:other_user) do+ FactoryBot.create(:user,+ member_in_project: project,+ member_with_permissions: permissions)+ end++ let!(:meeting) { FactoryBot.create :meeting, project: project, title: 'Own awesome meeting!', author: user }+ let!(:meeting_agenda) { FactoryBot.create :meeting_agenda, meeting: meeting, text: "asdf" }++ before do+ login_as(user)+ end++ context 'with permission to close meetings', js: true do+ let(:permissions) { %i[view_meetings close_meeting_agendas] }++ it 'can delete own and other`s meetings' do+ visit meetings_path(project)++ click_link meeting.title++ # Go to minutes, expect uneditable+ find('.tabrow a', text: 'MINUTES').click++ expect(page).to have_selector('.button', text: 'Close the agenda to begin the Minutes')++ # Close the meeting+ find('.tabrow a', text: 'AGENDA').click+ find('.button', text: 'Close').click+ page.accept_confirm++ # Expect to be on minutes+ expect(page).to have_selector('.tabrow li.selected', text: 'MINUTES')++ # Copies the text+ expect(page).to have_selector('#meeting_minutes-text', text: 'asdf')++ # Go back to agenda, expect we can open it again+ find('.tabrow a', text: 'AGENDA').click+ find('.button', text: 'Open').click+ expect(page).to have_selector('.button', text: 'Close')+ end+ end++ context 'without permission to close meetings' do+ let(:permissions) { %i[view_meetings] }++ it 'cannot delete own and other`s meetings' do+ visit meetings_path(project)++ expect(page)+ .to have_no_link 'Close'+ end+ end+end