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
[chore] added tests for both locations
Eric Schubertff0d4c75e6fa
diff --git a/spec/features/work_packages/tabs/activity_tab_spec.rb b/spec/features/work_packages/tabs/activity_tab_spec.rbindex 4d38706fc9c..3d2fb1e22ed 100644--- a/spec/features/work_packages/tabs/activity_tab_spec.rb+++ b/spec/features/work_packages/tabs/activity_tab_spec.rb@@ -1,3 +1,31 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2022 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 'features/work_packages/work_packages_page'@@ -34,7 +62,7 @@ describe 'Activity tab', js: true, selenium: true dowork_package.journals[0]end- let!(:note_1) do+ let!(:note1) doattributes = { subject: 'New subject', description: 'Some not so long description.' }alter_work_package_at(work_package,@@ -45,12 +73,12 @@ describe 'Activity tab', js: true, selenium: true dowork_package.journals.lastend- let!(:note_2) do+ let!(:note2) doattributes = { journal_notes: 'Another comment by a different user' }alter_work_package_at(work_package,attributes: attributes,- at: 1.days.ago.to_date.to_s(:db),+ at: 1.day.ago.to_date.to_s(:db),user: create(:admin))work_package.journals.last@@ -65,7 +93,7 @@ describe 'Activity tab', js: true, selenium: true doshared_examples 'shows activities in order' dolet(:journals) do- journals = [initial_note, note_1, note_2]+ journals = [initial_note, note1, note2]journalsend@@ -87,12 +115,12 @@ describe 'Activity tab', js: true, selenium: true doactivity = page.find("#activity-#{idx + 1}")- if journal.id != note_1.id+ if journal.id != note1.idexpect(activity).to have_selector('.op-user-activity--user-line', text: journal.user.name)expect(activity).to have_selector('.user-comment > .message', text: journal.notes, visible: :all)end- if activity == note_1+ if activity == note1expect(activity).to have_selector('.work-package-details-activities-messages .message',count: 2)expect(activity).to have_selector('.message',@@ -113,8 +141,7 @@ describe 'Activity tab', js: true, selenium: true docontext 'with permission' dolet(:role) do- create(:role, permissions: %i[view_work_packages- add_work_package_notes])+ create(:role, permissions: %i[view_work_packages add_work_package_notes])endlet(:user) docreate(:user,@@ -124,27 +151,29 @@ describe 'Activity tab', js: true, selenium: true docontext 'with ascending comments' dolet(:comments_in_reverse) { false }+it_behaves_like 'shows activities in order'endcontext 'with reversed comments' dolet(:comments_in_reverse) { true }+it_behaves_like 'shows activities in order'endit 'can deep link to an activity' do- visit "/work_packages/#{work_package.id}/activity#activity-#{note_2.id}"+ visit "/work_packages/#{work_package.id}/activity#activity-#{note2.id}"work_package_page.ensure_page_loadedexpect(page).to have_selector('.user-comment > .message',text: initial_comment)- expect(page.current_url).to match /\/work_packages\/#{work_package.id}\/activity#activity-#{note_2.id}/+ expect(page.current_url).to match /\/work_packages\/#{work_package.id}\/activity#activity-#{note2.id}/endit 'can toggle between activities and comments-only' doexpect(page).to have_selector('.work-package-details-activities-activity-contents', count: 3)- expect(page).to have_selector('.user-comment > .message', text: note_2.notes)+ expect(page).to have_selector('.user-comment > .message', text: note2.notes)# Show only commentsfind('.activity-comments--toggler').click@@ -152,7 +181,7 @@ describe 'Activity tab', js: true, selenium: true do# It should remove the middleexpect(page).to have_selector('.work-package-details-activities-activity-contents', count: 2)expect(page).to have_selector('.user-comment > .message', text: initial_comment)- expect(page).to have_selector('.user-comment > .message', text: note_2.notes)+ expect(page).to have_selector('.user-comment > .message', text: note2.notes)# Show all againfind('.activity-comments--toggler').click@@ -190,18 +219,20 @@ describe 'Activity tab', js: true, selenium: true doendit 'shows the activities, but does not allow commenting' do- expect(page).not_to have_selector('.work-packages--activity--add-comment', visible: true)+ expect(page).not_to have_selector('.work-packages--activity--add-comment', visible: :visible)endendend- context 'split screen' do+ context 'if on split screen' dolet(:work_package_page) { Pages::SplitWorkPackage.new(work_package, project) }+it_behaves_like 'activity tab'end- context 'full screen' do+ context 'if on full screen' dolet(:work_package_page) { Pages::FullWorkPackage.new(work_package) }+it_behaves_like 'activity tab'endenddiff --git a/spec/features/work_packages/tabs/files_tab_spec.rb b/spec/features/work_packages/tabs/files_tab_spec.rbnew file mode 100644index 00000000000..dc758ccfec8--- /dev/null+++ b/spec/features/work_packages/tabs/files_tab_spec.rb@@ -0,0 +1,75 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2022 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'++describe 'Files tab', js: true do+ let(:role) { create(:role, permissions: %i[view_work_packages edit_work_packages]) }+ let(:user) { create(:user, member_in_project: project, member_through_role: role) }+ let(:project) { create :project }+ let(:work_package) { create(:work_package, project: project) }+ let(:wp_page) { ::Pages::FullWorkPackage.new(work_package, project) }++ before do+ login_as(user)+ end++ describe 'navigation to new files tab from work package view' do+ before do+ wp_page.visit!+ end++ context 'if on work packages full view' do+ it 'must open files tab' do+ wp_page.switch_to_tab tab: 'activity'+ expect(page).not_to have_selector '.work-package--attachments--drop-box'++ files_link = wp_page.find('.work-packages--files-container .attributes-group--icon-indented-text a')+ files_link.click++ expect(page).to have_current_path project_work_package_path(project, work_package, 'files')+ expect(page).to have_selector '.work-package--attachments--drop-box'+ end+ end++ context 'if on work packages split view' do+ let(:wp_page) { ::Pages::SplitWorkPackage.new(work_package, project) }++ it 'must open files tab' do+ wp_page.switch_to_tab tab: 'overview'+ expect(page).not_to have_selector '.work-package--attachments--drop-box'++ files_link = wp_page.find('.work-packages--files-container .attributes-group--icon-indented-text a')+ files_link.click++ expect(page).to have_current_path project_work_packages_path(project) + "/details/#{work_package.id}/files"+ expect(page).to have_selector '.work-package--attachments--drop-box'+ end+ end+ end+end