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
[fix] regression - file link removal (#12148)
Eric Schubert49c3ff1d2c59
diff --git a/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.html b/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.htmlindex 9f87546dacd..d9b1f7c4b98 100644--- a/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.html+++ b/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.html@@ -66,6 +66,7 @@<button*ngIf="allowEditing"class="spot-link"+ data-qa-selector="file-list--item-remove-floating-action"[title]="text.title.removeFileLink"(click)="confirmRemoveFileLink()">diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.html b/frontend/src/app/shared/components/storages/storage/storage.component.htmlindex e9183d19361..71ad94ef536 100644--- a/frontend/src/app/shared/components/storages/storage/storage.component.html+++ b/frontend/src/app/shared/components/storages/storage/storage.component.html@@ -41,7 +41,7 @@op-file-link-list-item[fileLink]="fileLink"[disabled]="disabled"- [allowEditing]="allowEditing$ | async"+ [allowEditing]="allowLinking"(removeFileLink)="removeFileLink(fileLink)"></li></ul>diff --git a/modules/storages/spec/features/create_file_links_spec.rb b/modules/storages/spec/features/create_file_links_spec.rbindex bbbc34a634a..33b824cb78c 100644--- a/modules/storages/spec/features/create_file_links_spec.rb+++ b/modules/storages/spec/features/create_file_links_spec.rb@@ -28,7 +28,7 @@require_relative '../spec_helper'-describe 'Creating file links in work package', js: true, webmock: true do+describe 'Managing file links in work package', js: true, webmock: true dolet(:permissions) { %i(view_work_packages edit_work_packages view_file_links manage_file_links) }let(:project) { create(:project) }let(:current_user) { create(:user, member_in_project: project, member_with_permissions: permissions) }@@ -62,7 +62,8 @@ describe 'Creating file links in work package', js: true, webmock: true doendlet(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }- let(:dialog) { Components::FilePickerDialog.new }+ let(:file_picker) { Components::FilePickerDialog.new }+ let(:confirmation_dialog) { Components::ConfirmationDialog.new }before doallow(OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)@@ -80,35 +81,46 @@ describe 'Creating file links in work package', js: true, webmock: true dowp_page.visit_tab! :filesend- describe 'with the file picker', with_flag: { storage_file_picking_select_all: true } do- it 'must enable the user to link existing files on the storage' do+ describe 'create with the file picker and delete', with_flag: { storage_file_picking_select_all: true } do+ it 'must enable the user to manage existing files on the storage' doexpect(wp_page.all('[data-qa-selector="file-list--item"]').size).to eq 1expect(wp_page).to have_selector('[data-qa-selector="file-list--item"]', text: file_link.name)wp_page.find('[data-qa-selector="op-storage--link-existing-file-button"]').click- dialog.expect_open- dialog.confirm_button_state(selection_count: 0)+ file_picker.expect_open+ file_picker.confirm_button_state(selection_count: 0)- dialog.select_file('Manual.pdf')- dialog.confirm_button_state(selection_count: 1)+ file_picker.select_file('Manual.pdf')+ file_picker.confirm_button_state(selection_count: 1)- dialog.enter_folder('Folder1')- dialog.has_list_item?(text: file_link.name, checked: true, disabled: true)- dialog.select_all- dialog.confirm_button_state(selection_count: 3)+ file_picker.enter_folder('Folder1')+ file_picker.has_list_item?(text: file_link.name, checked: true, disabled: true)+ file_picker.select_all+ file_picker.confirm_button_state(selection_count: 3)- dialog.select_file('notes.txt')- dialog.confirm_button_state(selection_count: 2)+ file_picker.select_file('notes.txt')+ file_picker.confirm_button_state(selection_count: 2)- dialog.use_breadcrumb(position: 'root')- dialog.has_list_item?(text: 'Manual.pdf', checked: true, disabled: false)+ file_picker.use_breadcrumb(position: 'root')+ file_picker.has_list_item?(text: 'Manual.pdf', checked: true, disabled: false)- dialog.confirm+ file_picker.confirmexpect(wp_page).to have_selector('[data-qa-selector="file-list--item"]', text: 'Manual.pdf')expect(wp_page).to have_selector('[data-qa-selector="file-list--item"]', text: 'logo.png')expect(wp_page).to have_selector('[data-qa-selector="file-list--item"]', text: file_link.name)+ expect(wp_page.all('[data-qa-selector="file-list--item"]').size).to eq 3++ wp_page.find('[data-qa-selector="file-list--item"]', text: 'logo.png').hover+ wp_page.within('[data-qa-selector="file-list--item"]', text: 'logo.png') do+ wp_page.find('[data-qa-selector="file-list--item-remove-floating-action"]').click+ end++ confirmation_dialog.confirm++ expect(wp_page).not_to have_selector('[data-qa-selector="file-list--item"]', text: 'logo.png')+ expect(wp_page.all('[data-qa-selector="file-list--item"]').size).to eq 2endendend