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

Attempt to stabilize the `primerized_relations_spec`

Henriette Dargeaf91a89ac30c
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 bd7cb8c42a4..ea86ee42cb9 100644
--- a/spec/features/work_packages/details/relations/primerized_relations_spec.rb
+++ b/spec/features/work_packages/details/relations/primerized_relations_spec.rb
@@ -106,6 +106,9 @@ RSpec.describe "Primerized work package relations tab",
describe "rendering" do
it "renders the relations tab" do
scroll_to_element relations_panel
+
+ wait_for_network_idle
+
expect(page).to have_css(relations_panel_selector)
tabs.expect_counter("relations", 4)
@@ -120,6 +123,8 @@ RSpec.describe "Primerized work package relations tab",
it "can delete relations" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
relations_tab.remove_relation(relation_follows)
expect { relation_follows.reload }.to raise_error(ActiveRecord::RecordNotFound)
@@ -130,6 +135,8 @@ RSpec.describe "Primerized work package relations tab",
it "can delete children" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
relations_tab.remove_child(child_wp)
expect(child_wp.reload.parent).to be_nil
@@ -141,6 +148,8 @@ RSpec.describe "Primerized work package relations tab",
it "renders an edit form" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
relation_row = relations_tab.expect_relation(relation_follows)
relations_tab.add_description_to_relation(relation_follows, "Discovered relations have descriptions!")
@@ -164,6 +173,8 @@ RSpec.describe "Primerized work package relations tab",
it "does not have an edit action for children" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
child_row = relations_panel.find("[data-test-selector='op-relation-row-#{child_wp.id}']")
within(child_row) do
@@ -182,10 +193,18 @@ RSpec.describe "Primerized work package relations tab",
relation_type: Relation::TYPE_FOLLOWS)
end
+ before do
+ another_wp
+ relation_to
+ end
+
it "shows the correct related WorkPackage in the dialog (regression #59771)" do
scroll_to_element relations_panel
- relations_tab.open_relation_dialog(relation_to)
+ wait_for_network_idle
+
+ relations_tab.expect_relation(another_wp)
+ relations_tab.open_relation_dialog(another_wp)
within "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" do
expect(page).to have_field("Work package",
@@ -202,6 +221,8 @@ RSpec.describe "Primerized work package relations tab",
it "renders the new relation form for the selected type and creates the relation" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
relations_tab.add_relation(type: :precedes, relatable: wp_successor,
description: "Discovered relations have descriptions!")
relations_tab.expect_relation(wp_successor)
@@ -238,6 +259,8 @@ RSpec.describe "Primerized work package relations tab",
it "renders the new child form and creates the child relationship" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
tabs.expect_counter("relations", 4)
relations_tab.add_existing_child(not_yet_child_wp)
@@ -296,6 +319,8 @@ RSpec.describe "Primerized work package relations tab",
it "does not show options to add or edit relations" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
tabs.expect_counter("relations", 4)
relations_tab.expect_no_add_relation_button
@@ -311,6 +336,8 @@ RSpec.describe "Primerized work package relations tab",
it "does not show the option to delete the child" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
tabs.expect_counter("relations", 4)
# The menu is shown as the user can add a relation
@@ -332,6 +359,8 @@ RSpec.describe "Primerized work package relations tab",
it "does not show the option to edit the relation but only the child" do
scroll_to_element relations_panel
+ wait_for_network_idle
+
tabs.expect_counter("relations", 4)
# The menu is shown as the user can add a child
diff --git a/spec/support/components/work_packages/relations.rb b/spec/support/components/work_packages/relations.rb
index 246412fb152..79ee9f1274a 100644
--- a/spec/support/components/work_packages/relations.rb
+++ b/spec/support/components/work_packages/relations.rb
@@ -64,11 +64,11 @@ module Components
def find_row(relatable)
actual_relatable = find_relatable(relatable)
- page.find_test_selector("op-relation-row-#{actual_relatable.id}")
+ page.find_test_selector("op-relation-row-#{actual_relatable.id}", wait: 5)
end
def find_some_row(text:)
- page.find("[data-test-selector^='op-relation-row']", text:)
+ page.find("[data-test-selector^='op-relation-row']", text:, wait: 5)
end
def expect_row(work_package)