Commit f15f9970 authored by Mark Lapierre's avatar Mark Lapierre

Wait for branches to not be present

When testing if branches are deleted, wait for the branch element
to not be present. Do the same for both checks (second and third
branches).
parent ee4ccd31
...@@ -27,11 +27,9 @@ module QA ...@@ -27,11 +27,9 @@ module QA
finished_loading? finished_loading?
end end
def has_branch_title?(branch_title) def has_no_branch?(branch_name)
within_element(:all_branches) do within_element(:all_branches) do
within(".item-title") do has_no_css?(".js-branch-#{branch_name}")
has_text?(branch_title)
end
end end
end end
...@@ -49,13 +47,12 @@ module QA ...@@ -49,13 +47,12 @@ module QA
end end
end end
def wait_for_texts_not_to_be_visible(texts) def wait_for_branch_not_present(branch_name)
text_not_visible = wait do branch_not_present = wait(reload: false) do
texts.all? do |text| has_no_branch?(branch_name)
has_no_text?(text)
end
end end
raise "Expected text(s) #{texts} not to be visible" unless text_not_visible
raise "Expected branch `#{branch_name}` not to be present" unless branch_not_present
end end
end end
end end
......
...@@ -72,10 +72,9 @@ module QA ...@@ -72,10 +72,9 @@ module QA
Page::Project::Branches::Show.perform do |branches_view| Page::Project::Branches::Show.perform do |branches_view|
branches_view.delete_branch(third_branch) branches_view.delete_branch(third_branch)
branches_view.wait_for_branch_not_present(third_branch)
end end
expect(page).not_to have_content(third_branch)
Page::Project::Branches::Show.perform(&:delete_merged_branches) Page::Project::Branches::Show.perform(&:delete_merged_branches)
expect(page).to have_content( expect(page).to have_content(
...@@ -84,8 +83,7 @@ module QA ...@@ -84,8 +83,7 @@ module QA
page.refresh page.refresh
Page::Project::Branches::Show.perform do |branches_view| Page::Project::Branches::Show.perform do |branches_view|
branches_view.wait_for_texts_not_to_be_visible([commit_message_of_second_branch]) branches_view.wait_for_branch_not_present(second_branch)
expect(branches_view).not_to have_branch_title(second_branch)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment