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
Use test helpers
Henriette Dargea7f50b95310e
diff --git a/spec/support/components/work_packages/relations.rb b/spec/support/components/work_packages/relations.rbindex 24a7fbb7782..9e5510797a4 100644--- a/spec/support/components/work_packages/relations.rb+++ b/spec/support/components/work_packages/relations.rb@@ -55,12 +55,12 @@ module Componentsenddef expect_no_add_relation_button- expect(page).to have_no_css("[data-test-selector='new-relation-action-menu']")+ expect(page).not_to have_test_selector("new-relation-action-menu")enddef find_row(relatable)actual_relatable = find_relatable(relatable)- page.find("[data-test-selector='op-relation-row-#{actual_relatable.id}']")+ page.find_test_selector("op-relation-row-#{actual_relatable.id}")enddef find_some_row(text:)@@ -73,7 +73,7 @@ module Componentsdef expect_no_row(relatable)actual_relatable = find_relatable(relatable)- expect(page).to have_no_css("[data-test-selector='op-relation-row-#{actual_relatable.id}']")+ expect(page).not_to have_test_selector("op-relation-row-#{actual_relatable.id}")enddef remove_relation(relatable)@@ -94,12 +94,12 @@ module Componentsdef relatable_action_menu(relatable)actual_relatable = find_relatable(relatable)- page.find("[data-test-selector='op-relation-row-#{actual_relatable.id}-action-menu']")+ page.find_test_selector("op-relation-row-#{actual_relatable.id}-action-menu")enddef relatable_delete_button(relatable)actual_relatable = find_relatable(relatable)- page.find("[data-test-selector='op-relation-row-#{actual_relatable.id}-delete-button']")+ page.find_test_selector("op-relation-row-#{actual_relatable.id}-delete-button")enddef add_relation(type:, relatable:, description: nil)@@ -107,7 +107,7 @@ module Components# Open create formSeleniumHubWaiter.wait- page.find("[data-test-selector='new-relation-action-menu']").click+ page.find_test_selector("new-relation-action-menu").clicklabel_text_for_relation_type = I18n.t("#{i18n_namespace}.label_#{type}_singular")within page.find_by_id("new-relation-action-menu-list") do # Primer appends "list" to the menu id automatically@@ -121,7 +121,7 @@ module Componentsexpect(page).to have_text(modal_heading_label)# Enter the query and select the child- autocomplete_field = page.find("[data-test-selector='work-package-relation-form-to-id']")+ autocomplete_field = page.find_test_selector("work-package-relation-form-to-id")select_autocomplete(autocomplete_field,query: relatable.subject,results_selector: "body")@@ -150,8 +150,10 @@ module Componentsactual_relatable = find_relatable(relatable)relation_row = find_row(actual_relatable)- relation_row.find("[data-test-selector='op-relation-row-#{actual_relatable.id}-action-menu']").click- relation_row.find("[data-test-selector='op-relation-row-#{actual_relatable.id}-edit-button']").click+ within relation_row do+ page.find_test_selector("op-relation-row-#{actual_relatable.id}-action-menu").click+ page.find_test_selector("op-relation-row-#{actual_relatable.id}-edit-button").click+ endwait_for_reload if using_cuprite?@@ -176,8 +178,10 @@ module Componentsactual_relatable = find_relatable(relatable)relation_row = find_row(actual_relatable)- relation_row.find("[data-test-selector='op-relation-row-#{actual_relatable.id}-action-menu']").click- relation_row.find("[data-test-selector='op-relation-row-#{actual_relatable.id}-edit-button']").click+ within relation_row do+ page.find_test_selector("op-relation-row-#{actual_relatable.id}-action-menu").click+ page.find_test_selector("op-relation-row-#{actual_relatable.id}-edit-button").click+ endwait_for_reload if using_cuprite?@@ -212,7 +216,7 @@ module Components# Enter the query and select the childSeleniumHubWaiter.wait- autocomplete = find("[data-test-selector='wp-relations-autocomplete']")+ autocomplete = page.find_test_selector("wp-relations-autocomplete")select_autocomplete autocomplete,query:,results_selector: ".ng-dropdown-panel-items",@@ -220,13 +224,13 @@ module Componentsenddef expect_parent(work_package)- expect(page).to have_css '[data-test-selector="op-wp-breadcrumb-parent"]',+ expect(page).to have_test_selector "op-wp-breadcrumb-parent",text: work_package.subject,wait: 10enddef expect_no_parent- expect(page).to have_no_css '[data-test-selector="op-wp-breadcrumb-parent"]', wait: 10+ expect(page).not_to have_test_selector "op-wp-breadcrumb-parent", wait: 10enddef remove_parent@@ -239,7 +243,7 @@ module Componentsnext if page.has_selector?(".wp-relations--children .ng-input input")SeleniumHubWaiter.wait- find('[data-test-selector="op-wp-inline-create-reference"]',+ page.find_test_selector("op-wp-inline-create-reference",text: I18n.t("js.relation_buttons.add_existing_child")).click# Security check to be sure that the autocompleter has finished loading@@ -248,14 +252,14 @@ module Componentsenddef children_table- page.find("[data-test-selector='op-relation-group-children']")+ page.find_test_selector("op-relation-group-children")enddef add_existing_child(work_package)SeleniumHubWaiter.waitretry_block do- page.find("[data-test-selector='new-relation-action-menu']").click+ page.find_test_selector("new-relation-action-menu").clickwithin page.find_by_id("new-relation-action-menu-list") do # Primer appends "list" to the menu id automaticallyclick_link_or_button "Child"@@ -263,7 +267,7 @@ module Componentsendwithin "##{WorkPackageRelationsTab::AddWorkPackageChildFormComponent::DIALOG_ID}" do- autocomplete_field = page.find("[data-test-selector='work-package-child-form-id']")+ autocomplete_field = page.find_test_selector("work-package-child-form-id")select_autocomplete(autocomplete_field,query: work_package.subject,results_selector: "body")