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 bd7cb8c42a4c..db6920208ed7 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 @@ def label_for_relation_type(relation_type) 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 @@ def label_for_relation_type(relation_type) 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 @@ def label_for_relation_type(relation_type) 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 @@ def label_for_relation_type(relation_type) 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 @@ def label_for_relation_type(relation_type) 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,9 +193,17 @@ def label_for_relation_type(relation_type) 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 + wait_for_network_idle + + relations_tab.expect_relation(relation_to) relations_tab.open_relation_dialog(relation_to) within "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" do @@ -202,6 +221,8 @@ def label_for_relation_type(relation_type) 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 @@ def label_for_relation_type(relation_type) 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 @@ def label_for_relation_type(relation_type) 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 @@ def label_for_relation_type(relation_type) 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 @@ def label_for_relation_type(relation_type) 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 246412fb1520..79ee9f1274ac 100644 --- a/spec/support/components/work_packages/relations.rb +++ b/spec/support/components/work_packages/relations.rb @@ -64,11 +64,11 @@ def expect_no_add_relation_button 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)