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

[#41849] add data-qa-selector to new attachment html

Eric Schubert53e2cecaf7f3
diff --git a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.html b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.html
index a271bcfe5a7..6d41e400097 100644
--- a/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.html
+++ b/frontend/src/app/shared/components/attachments/attachment-list/attachment-list-item.html
@@ -13,6 +13,7 @@
[textContent]="attachment.fileName"
[title]="attachment.fileName"
class="spot-list--item-title op-files-tab--file-list-item-title"
+ data-qa-selector="op-files-tab--file-list-item-title"
></span>
<span
diff --git a/modules/meeting/spec/features/meetings_attachments_spec.rb b/modules/meeting/spec/features/meetings_attachments_spec.rb
index 79f8cbacda7..2c45a61b4f7 100644
--- a/modules/meeting/spec/features/meetings_attachments_spec.rb
+++ b/modules/meeting/spec/features/meetings_attachments_spec.rb
@@ -36,9 +36,9 @@ describe 'Add an attachment to a meeting (agenda)', js: true do
end
describe 'wysiwyg editor' do
- context 'on an existing page' do
+ context 'if on an existing page' do
it 'can upload an image via drag & drop' do
- target = find('.ck-content')
+ find('.ck-content')
editor.expect_button 'Insert image'
@@ -63,16 +63,17 @@ describe 'Add an attachment to a meeting (agenda)', js: true do
##
# Attach file manually
- expect(page).to have_no_selector('.work-package--attachments--filename')
+ expect(page).to have_no_selector('[data-qa-selector="op-files-tab--file-list-item-title"]')
attachments.attach_file_on_input(image_fixture.path)
expect(page).not_to have_selector('op-toasters-upload-progress')
- expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', wait: 5)
+ expect(page).to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'image.png', wait: 5)
##
# and via drag & drop
attachments.drag_and_drop_file(container, image_fixture.path)
expect(page).not_to have_selector('op-toasters-upload-progress')
- expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', count: 2, wait: 5)
+ expect(page)
+ .to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'image.png', count: 2, wait: 5)
end
end
end
diff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rb
index 6322ee148d0..ab21ec7a772 100644
--- a/spec/features/admin/attribute_help_texts_spec.rb
+++ b/spec/features/admin/attribute_help_texts_spec.rb
@@ -99,7 +99,7 @@ describe 'Attribute help texts', js: true do
# Expect files section to be present
expect(modal.modal_container).to have_selector('.form--fieldset-legend', text: 'ATTACHMENTS')
- expect(modal.modal_container).to have_selector('.work-package--attachments--filename')
+ expect(modal.modal_container).to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]')
modal.close!
diff --git a/spec/features/work_packages/attachments/attachment_upload_spec.rb b/spec/features/work_packages/attachments/attachment_upload_spec.rb
index a02e36c39a1..8bcaca63715 100644
--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb
+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb
@@ -189,7 +189,7 @@ describe 'Upload attachment to work package', js: true do
:center,
page.find('[data-qa-tab-id="files"]')
- expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', wait: 10)
+ expect(page).to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'image.png', wait: 10)
expect(page).not_to have_selector('op-toasters-upload-progress')
wp_page.expect_tab 'Files'
end
@@ -211,16 +211,17 @@ describe 'Upload attachment to work package', js: true do
##
# Attach file manually
- expect(page).to have_no_selector('.work-package--attachments--filename')
+ expect(page).to have_no_selector('[data-qa-selector="op-files-tab--file-list-item-title"]')
attachments.attach_file_on_input(image_fixture.path)
expect(page).not_to have_selector('op-toasters-upload-progress')
- expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', wait: 5)
+ expect(page).to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'image.png', wait: 5)
##
# and via drag & drop
attachments.drag_and_drop_file(container, image_fixture.path)
expect(page).not_to have_selector('op-toasters-upload-progress')
- expect(page).to have_selector('.work-package--attachments--filename', text: 'image.png', count: 2, wait: 5)
+ expect(page)
+ .to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'image.png', count: 2, wait: 5)
end
end
end
diff --git a/spec/features/work_packages/navigation_spec.rb b/spec/features/work_packages/navigation_spec.rb
index 548e253577c..7f948e7f5d0 100644
--- a/spec/features/work_packages/navigation_spec.rb
+++ b/spec/features/work_packages/navigation_spec.rb
@@ -259,7 +259,8 @@ describe 'Work package navigation', js: true, selenium: true do
full_view.ensure_page_loaded
full_view.switch_to_tab(tab: 'FILES')
- expect(page).to have_selector('.work-package--attachments--filename', text: 'attachment-first.pdf', wait: 10)
+ expect(page)
+ .to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'attachment-first.pdf', wait: 10)
end
end