From 99a4e97389eb7e9e5a8122a336d7541b46097339 Mon Sep 17 00:00:00 2001 From: Mark Lapierre Date: Wed, 1 May 2019 14:17:00 +1000 Subject: Check test result via an assertion As long as `has_no_branch?` is only called in an assertion it shouldn't matter if it could return false but still allow the test to continue. So we don't need the new wait method --- qa/qa/page/project/branches/show.rb | 10 +--------- .../3_create/repository/add_list_delete_branches_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/qa/qa/page/project/branches/show.rb b/qa/qa/page/project/branches/show.rb index ba00ecbd535..368e7ac7448 100644 --- a/qa/qa/page/project/branches/show.rb +++ b/qa/qa/page/project/branches/show.rb @@ -29,7 +29,7 @@ module QA def has_no_branch?(branch_name) within_element(:all_branches) do - has_no_css?(".js-branch-#{branch_name}") + has_no_css?(".js-branch-#{branch_name}", wait: Support::Waiter::DEFAULT_MAX_WAIT_TIME) end end @@ -46,14 +46,6 @@ module QA click_element(:delete_merged_branches) end end - - def wait_for_branch_not_present(branch_name) - branch_not_present = wait(reload: false) do - has_no_branch?(branch_name) - end - - raise "Expected branch `#{branch_name}` not to be present" unless branch_not_present - end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb index ac6458385d9..20793c82d20 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb @@ -72,7 +72,7 @@ module QA Page::Project::Branches::Show.perform do |branches_view| branches_view.delete_branch(third_branch) - branches_view.wait_for_branch_not_present(third_branch) + expect(branches_view).to have_no_branch(third_branch) end Page::Project::Branches::Show.perform(&:delete_merged_branches) @@ -83,7 +83,7 @@ module QA page.refresh Page::Project::Branches::Show.perform do |branches_view| - branches_view.wait_for_branch_not_present(second_branch) + expect(branches_view).to have_no_branch(second_branch) end end end -- cgit v1.2.1