From 39bac39c9d944250752333fd86ffed14866958a3 Mon Sep 17 00:00:00 2001 From: Christophe Bliard Date: Fri, 8 Sep 2023 08:20:36 +0200 Subject: [PATCH] Make team planner tests slightly faster - `search_user_to_add` call is useless as the `select_user_to_add` already does a search before the selection. - `click_add_user` does not need to wait when checking the input presence. As it is almost always absent, this save 5 seconds. --- modules/team_planner/spec/support/pages/team_planner.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/team_planner/spec/support/pages/team_planner.rb b/modules/team_planner/spec/support/pages/team_planner.rb index 7de934212f19..567518e192d3 100644 --- a/modules/team_planner/spec/support/pages/team_planner.rb +++ b/modules/team_planner/spec/support/pages/team_planner.rb @@ -227,14 +227,14 @@ def click_on_submit def add_assignee(name) click_add_user page.find('[data-qa-selector="tp-add-assignee"] input') - search_user_to_add name select_user_to_add name end def click_add_user - # Close the existing, if it is open - is_open = page.all('[data-qa-selector="tp-add-assignee"] input').first - page.find('[data-qa-selector="tp-assignee-add-button"]').click unless is_open + is_open = page.has_selector?('[data-qa-selector="tp-add-assignee"] input', wait: 0) + return if is_open + + page.find('[data-qa-selector="tp-assignee-add-button"]').click end def select_user_to_add(name)