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

Add test for updating Lag of a relation

Henriette Darge54c8e03a3ed1
diff --git a/spec/features/work_packages/details/relations/primerized_relations_spec.rb b/spec/features/work_packages/details/relations/primerized_relations_spec.rb
index 56bc66d3699..7fa9a423618 100644
--- a/spec/features/work_packages/details/relations/primerized_relations_spec.rb
+++ b/spec/features/work_packages/details/relations/primerized_relations_spec.rb
@@ -142,10 +142,13 @@ RSpec.describe "Primerized work package relations tab",
relation_row = relations_tab.expect_relation(relation_follows)
- relations_tab.add_description_to_relation(relation_follows, "Discovered relations have descriptions!")
+ relations_tab.edit_relation_description(relation_follows, "Discovered relations have descriptions!")
- # Reflects new description
+ relations_tab.edit_lag_of_relation(relation_follows, 5)
+
+ # Reflects new description and lag
expect(relation_row).to have_text("Discovered relations have descriptions!")
+ expect(relation_row).to have_text("5 days")
# Unchanged
tabs.expect_counter("relations", 4)
@@ -171,6 +174,17 @@ RSpec.describe "Primerized work package relations tab",
end
end
+ it "does not show the lag field for all relation types" do
+ scroll_to_element relations_panel
+
+ relations_tab.open_relation_dialog(relation_relates)
+
+ within "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" do
+ expect(page).to have_field("Work package", readonly: true)
+ expect(page).to have_no_field("Lag")
+ end
+ end
+
context "with the shown WorkPackage being the 'to' relation part" do
let(:another_wp) { create(:work_package, type: type2, subject: "related to main") }
diff --git a/spec/support/components/work_packages/relations.rb b/spec/support/components/work_packages/relations.rb
index 2c992d57434..cceac6de06a 100644
--- a/spec/support/components/work_packages/relations.rb
+++ b/spec/support/components/work_packages/relations.rb
@@ -168,7 +168,7 @@ module Components
find_row(target_wp)
end
- def add_description_to_relation(relatable, description)
+ def edit_relation_description(relatable, description)
open_relation_dialog(relatable)
within "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" do
@@ -183,14 +183,14 @@ module Components
end
end
- def edit_relation_description(relatable, description)
+ def edit_lag_of_relation(relatable, lag)
open_relation_dialog(relatable)
within "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" do
expect(page).to have_field("Work package", readonly: true)
- expect(page).to have_field("Description")
+ expect(page).to have_field("Lag")
- fill_in "Description", with: description
+ fill_in "Lag", with: lag
click_link_or_button "Save"