Commit 8b4dc1d0 authored by Michael Kozono's avatar Michael Kozono

Extract `wait_for_issue_replication` for readability

And filter by issue title to make the method more deterministic.
parent 8ce82be9
......@@ -35,6 +35,10 @@ module QA
module Project
autoload :Show, 'qa/ee/page/project/show'
module Issue
autoload :Index, 'qa/ee/page/project/issue/index'
end
module Settings
autoload :ProtectedBranches, 'qa/ee/page/project/settings/protected_branches'
end
......
module QA
module EE
module Page
module Project
module Issue
module Index
def self.prepended(page)
page.module_eval do
view 'app/views/shared/issuable/_search_bar.html.haml' do
element :issue_filter_form, /form_tag.+class: 'filter-form /
element :issue_filter_input, /%input.form-control.filtered-search/
end
end
end
def wait_for_issue_replication(issue)
wait do
filter_by_title(issue.title)
page.has_content?(issue.title)
end
go_to_issue(issue.title)
end
def filter_by_title(title)
page.within('form.filter-form') do
fill_in class: 'filtered-search', with: title
end
end
end
end
end
end
end
end
......@@ -3,6 +3,8 @@ module QA
module Project
module Issue
class Index < Page::Base
prepend QA::EE::Page::Project::Issue::Index
view 'app/views/projects/issues/_issue.html.haml' do
element :issue_link, 'link_to issue.title'
end
......
......@@ -44,13 +44,7 @@ module QA
Page::Menu::Side.act { click_issues }
Page::Project::Issue::Index.perform do |index|
# wait for DB replication of issue
index.wait do
# we may want to filter by title here if the project is reused by other specs
page.has_content?(issue.title)
end
index.go_to_issue(issue.title)
index.wait_for_issue_replication(issue)
end
image_url = find('a[href$="banana_sample.gif"]')[:href]
......
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