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
This commit is contained in:
Mark Lapierre 2019-05-01 14:17:00 +10:00
parent a5af21cf13
commit 99a4e97389
2 changed files with 3 additions and 11 deletions

View file

@ -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

View file

@ -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