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

Split global recurring meeting feature specs

Alexander Brandon Colesbcea022d8aec
diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb
index 0ec3a738f39..90dac180904 100644
--- a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb
+++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_crud_spec.rb
@@ -74,7 +74,7 @@ RSpec.describe "Recurring meetings CRUD",
end
let(:current_user) { user }
- let(:show_page) { Pages::RecurringMeeting::Show.new(meeting) }
+ let(:show_page) { Pages::RecurringMeeting::Show.new(meeting, project:) }
let(:meetings_page) { Pages::Meetings::Index.new(project:) }
before do
@@ -85,7 +85,7 @@ RSpec.describe "Recurring meetings CRUD",
RecurringMeetings::InitNextOccurrenceJob.perform_now(meeting, meeting.first_occurrence.to_time)
end
- it "can delete a recurring meeting from the global show page and return to the index page" do
+ it "can delete a recurring meeting from the show page and return to the index page" do
show_page.visit!
show_page.delete_meeting_series
@@ -95,22 +95,6 @@ RSpec.describe "Recurring meetings CRUD",
click_on "Delete permanently"
end
- expect(page).to have_current_path meetings_path
-
- expect_flash(type: :success, message: "Successful deletion.")
- show_page.expect_no_meeting date: "12/31/2024 01:30 PM"
- end
-
- it "can delete a recurring meeting from the project show page and return to the index page" do
- show_page.visit_project!
-
- show_page.delete_meeting_series
- show_page.in_delete_recurring_dialog do
- page.check "I understand that this deletion cannot be reversed"
-
- click_on "Delete permanently"
- end
-
expect(page).to have_current_path project_meetings_path(project)
expect_flash(type: :success, message: "Successful deletion.")
@@ -131,7 +115,7 @@ RSpec.describe "Recurring meetings CRUD",
show_page.expect_open_meeting date: "01/07/2025 01:30 PM"
end
- it "can cancel an occurrence from the global show page" do
+ it "can cancel an occurrence from the show page" do
show_page.visit!
show_page.cancel_occurrence date: "12/31/2024 01:30 PM"
@@ -149,7 +133,7 @@ RSpec.describe "Recurring meetings CRUD",
show_page.expect_cancelled_meeting date: "12/31/2024 01:30 PM"
end
- it "can cancel a scheduled occurrence from the global show page" do
+ it "can cancel a scheduled occurrence from the show page" do
show_page.visit!
show_page.cancel_occurrence date: "01/07/2025 01:30 PM"
@@ -166,41 +150,6 @@ RSpec.describe "Recurring meetings CRUD",
show_page.expect_cancelled_meeting date: "01/07/2025 01:30 PM"
end
- it "can cancel an occurrence from the project show page" do
- show_page.visit_project!
-
- show_page.cancel_occurrence date: "12/31/2024 01:30 PM"
- show_page.in_delete_dialog do
- check "I understand that this deletion cannot be reversed"
-
- click_on "Delete permanently"
- end
-
- expect_flash(type: :success, message: "Successful cancellation.")
-
- expect(page).to have_current_path(show_page.project_path)
-
- show_page.expect_no_open_meeting date: "12/31/2024 01:30 PM"
- show_page.expect_cancelled_meeting date: "12/31/2024 01:30 PM"
- end
-
- it "can cancel a scheduled occurrence from the project show page" do
- show_page.visit_project!
-
- show_page.cancel_occurrence date: "01/07/2025 01:30 PM"
- show_page.in_delete_scheduled_dialog do
- check "I understand that this deletion cannot be reversed"
-
- click_on "Cancel occurrence"
- end
-
- expect_flash(type: :success, message: "Successful cancellation.")
-
- expect(page).to have_current_path(show_page.project_path)
-
- show_page.expect_cancelled_meeting date: "01/07/2025 01:30 PM"
- end
-
it "can edit the details of a recurring meeting" do
show_page.visit!
diff --git a/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_crud_spec.rb b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_crud_spec.rb
new file mode 100644
index 00000000000..407f401c018
--- /dev/null
+++ b/modules/meeting/spec/features/recurring_meetings/recurring_meeting_global_crud_spec.rb
@@ -0,0 +1,140 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 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-2013 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 COPYRIGHT and LICENSE files for more details.
+#++
+
+require "spec_helper"
+
+require_relative "../../support/pages/meetings/new"
+require_relative "../../support/pages/structured_meeting/show"
+require_relative "../../support/pages/recurring_meeting/show"
+require_relative "../../support/pages/meetings/index"
+
+RSpec.describe "Recurring meetings global CRUD",
+ :js,
+ with_flag: { recurring_meetings: true } do
+ include Components::Autocompleter::NgSelectAutocompleteHelpers
+
+ before_all do
+ travel_to(Date.new(2024, 12, 1))
+ end
+
+ after(:all) do # rubocop:disable RSpec/BeforeAfterAll
+ travel_back
+ end
+
+ shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) }
+ shared_let(:user) do
+ create :user,
+ lastname: "First",
+ preferences: { time_zone: "Etc/UTC" },
+ member_with_permissions: { project => %i[view_meetings create_meetings edit_meetings delete_meetings] }
+ end
+ shared_let(:other_user) do
+ create(:user,
+ lastname: "Second",
+ member_with_permissions: { project => %i[view_meetings] })
+ end
+ shared_let(:no_member_user) do
+ create(:user,
+ lastname: "Third")
+ end
+ shared_let(:meeting) do
+ create :recurring_meeting,
+ project:,
+ start_time: "2024-12-31T13:30:00Z",
+ duration: 1.5,
+ frequency: "weekly",
+ end_after: "specific_date",
+ end_date: "2025-01-15",
+ author: user
+ end
+
+ let(:current_user) { user }
+ let(:show_page) { Pages::RecurringMeeting::Show.new(meeting, project: nil) }
+ let(:meetings_page) { Pages::Meetings::Index.new(project: nil) }
+
+ before do
+ travel_to(Date.new(2024, 12, 1))
+ login_as current_user
+
+ # Assuming the first init job has run
+ RecurringMeetings::InitNextOccurrenceJob.perform_now(meeting, meeting.first_occurrence.to_time)
+ end
+
+ it "can delete a recurring meeting from the show page and return to the index page" do
+ show_page.visit!
+
+ show_page.delete_meeting_series
+ show_page.in_delete_recurring_dialog do
+ page.check "I understand that this deletion cannot be reversed"
+
+ click_on "Delete permanently"
+ end
+
+ expect(page).to have_current_path meetings_path
+
+ expect_flash(type: :success, message: "Successful deletion.")
+ show_page.expect_no_meeting date: "12/31/2024 01:30 PM"
+ end
+
+ it "can cancel an occurrence from the show page" do
+ show_page.visit!
+
+ show_page.cancel_occurrence date: "12/31/2024 01:30 PM"
+ show_page.in_delete_dialog do
+ check "I understand that this deletion cannot be reversed"
+
+ click_on "Delete permanently"
+ end
+
+ expect_flash(type: :success, message: "Successful cancellation.")
+
+ expect(page).to have_current_path(show_page.path)
+
+ show_page.expect_no_open_meeting date: "12/31/2024 01:30 PM"
+ show_page.expect_cancelled_meeting date: "12/31/2024 01:30 PM"
+ end
+
+ it "can cancel a scheduled occurrence from the show page" do
+ show_page.visit!
+
+ show_page.cancel_occurrence date: "01/07/2025 01:30 PM"
+ show_page.in_delete_scheduled_dialog do
+ check "I understand that this deletion cannot be reversed"
+
+ click_on "Cancel occurrence"
+ end
+
+ expect_flash(type: :success, message: "Successful cancellation.")
+
+ expect(page).to have_current_path(show_page.path)
+
+ show_page.expect_cancelled_meeting date: "01/07/2025 01:30 PM"
+ end
+end
diff --git a/modules/meeting/spec/support/pages/recurring_meeting/show.rb b/modules/meeting/spec/support/pages/recurring_meeting/show.rb
index 2bb19f2e69c..43524c8f67a 100644
--- a/modules/meeting/spec/support/pages/recurring_meeting/show.rb
+++ b/modules/meeting/spec/support/pages/recurring_meeting/show.rb
@@ -32,24 +32,18 @@ module Pages::RecurringMeeting
class Show < ::Pages::Meetings::Base
attr_accessor :meeting
- def initialize(meeting)
- super
+ def initialize(meeting, project: nil)
+ super(project)
self.meeting = meeting
end
- def visit_project!
- visit(project_path)
-
- wait_for_reload
- end
-
def path
- recurring_meeting_path(meeting)
- end
-
- def project_path
- project_recurring_meeting_path(meeting.project, meeting)
+ if project
+ project_recurring_meeting_path(project, meeting)
+ else
+ recurring_meeting_path(meeting)
+ end
end
def expect_scheduled_meeting(date:)