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
fixing attachement and edit_work_package specs, cleanup abstract_work_package page util
Jonas Jabarie6c4eee65f38
diff --git a/spec/features/work_packages/attachments/attachment_upload_spec.rb b/spec/features/work_packages/attachments/attachment_upload_spec.rbindex aabfdb0703c..fa1c220cb93 100644--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb@@ -43,6 +43,7 @@ RSpec.describe "Upload attachment to work package", :js, :selenium dolet(:project) { create(:project) }let(:work_package) { create(:work_package, project:, description: "Initial description") }let(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }+ let(:activity_tab) { Components::WorkPackages::Activities.new(work_package) }let(:attachments) { Components::Attachments.new }let(:field) { TextEditorField.new wp_page, "description" }let(:image_fixture) { UploadedFile.load_from("spec/fixtures/files/image.png") }@@ -59,6 +60,8 @@ RSpec.describe "Upload attachment to work package", :js, :selenium dobefore dowp_page.visit!wp_page.ensure_page_loaded+ wp_page.switch_to_tab(tab: "Activity")+ wp_page.wait_for_activity_tabendit "can upload an image via drag & drop" do@@ -76,14 +79,6 @@ RSpec.describe "Upload attachment to work package", :js, :selenium doendcontext "when editing comment" do- let(:selector) { ".work-packages--activity--add-comment" }- let(:comment_field) do- TextEditorField.new wp_page,- "comment",- selector:- end- let(:editor) { Components::WysiwygEditor.new ".work-packages--activity--add-comment" }-context "with a user that is not allowed to add images (Regression #28541)" dolet(:role) docreate(:project_role,@@ -92,15 +87,15 @@ RSpec.describe "Upload attachment to work package", :js, :selenium doit "can open the editor to add an image, but image upload is not shown" do# Add comment- comment_field.activate!+ activity_tab.open_new_comment_editor# Button should be hidden- editor.expect_no_button "Upload image from computer"+ activity_tab.ckeditor.expect_no_button "Upload image from computer"- editor.click_and_type_slowly "this is a comment!1"- comment_field.submit_by_click+ activity_tab.ckeditor.click_and_type_slowly "this is a comment!1"+ activity_tab.submit_comment- wp_page.expect_comment text: "this is a comment!1"+ activity_tab.expect_journal_notes text: "this is a comment!1"endend@@ -111,15 +106,15 @@ RSpec.describe "Upload attachment to work package", :js, :selenium doendit "can open the editor and image upload is shown" do- comment_field.activate!+ activity_tab.open_new_comment_editor- editor.expect_button "Upload image from computer"+ activity_tab.ckeditor.expect_button "Upload image from computer"- editor.click_and_type_slowly "this is a comment!2"- editor.drag_attachment image_fixture.path, "Some image caption"- comment_field.submit_by_click+ activity_tab.ckeditor.click_and_type_slowly "this is a comment!2"+ activity_tab.ckeditor.drag_attachment image_fixture.path, "Some image caption"+ activity_tab.submit_comment- wp_page.expect_comment text: "this is a comment!2"+ activity_tab.expect_journal_notes text: "this is a comment!2"endendend@@ -270,6 +265,9 @@ RSpec.describe "Upload attachment to work package", :js, :selenium dodescribe "attachment dropzone" doshared_examples "attachment dropzone common" doit "can drag something to the files tab and have it open" do+ wp_page.switch_to_tab(tab: "Activity")+ wp_page.wait_for_activity_tab+wp_page.expect_tab "Activity"attachments.drag_and_drop_file test_selector("op-attachments--drop-box"),image_fixture.path,diff --git a/spec/features/work_packages/edit_work_package_spec.rb b/spec/features/work_packages/edit_work_package_spec.rbindex e88cecee8f3..7893e28cccd 100644--- a/spec/features/work_packages/edit_work_package_spec.rb+++ b/spec/features/work_packages/edit_work_package_spec.rb@@ -217,18 +217,6 @@ RSpec.describe "edit work package", :js doendend- it "allows the user to add a comment to a work package" do- wp_page.ensure_page_loaded-- wp_page.trigger_edit_comment- wp_page.update_comment "hallo welt"-- wp_page.save_comment-- wp_page.expect_toast(message: "The comment was successfully added.")- wp_page.expect_comment text: "hallo welt"- end-it "updates the presented custom fields based on the selected type" dowp_page.ensure_page_loadeddiff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rbindex 99b0dac9d4a..1acafdd7f55 100644--- a/spec/support/pages/work_packages/abstract_work_package.rb+++ b/spec/support/pages/work_packages/abstract_work_package.rb@@ -85,16 +85,6 @@ module Pagesexpect(page).to have_css('[data-test-selector="op-wp-activity-tab"][data-stimulus-controller-connected="true"]')end- def expect_comment(**args)- subselector = args.delete(:subselector)-- retry_block do- unless page.has_selector?(".user-comment .message #{subselector}".strip, **args)- raise "Failed to find comment with #{args.inspect}. Retrying."- end- end- end-def expect_any_active_inline_edit_fieldexpect(page).to have_css(".inline-edit--active-field")end@@ -285,28 +275,10 @@ module Pagespage.click_button(I18n.t("js.button_edit"))end- def trigger_edit_comment- add_comment_container.find(".work-package-comment").click- end-- def update_comment(comment)- editor = ::Components::WysiwygEditor.new ".work-packages--activity--add-comment"- editor.click_and_type_slowly comment- end-- def save_comment- label = "Comment: Save"- add_comment_container.find(:xpath, "//button[@title='#{label}']").click- end-def save!page.click_button(I18n.t("js.button_save"))end- def add_comment_container- find(".work-packages--activity--add-comment")- end-def click_add_wp_buttonfind(".add-work-package:not([disabled])", text: "Work package").clickend