2014-08-27 03:48:51 -04:00
|
|
|
class Spinach::Features::Search < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedProject
|
|
|
|
|
|
|
|
step 'I search for "Sho"' do
|
|
|
|
fill_in "dashboard_search", with: "Sho"
|
|
|
|
click_button "Search"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I search for "Foo"' do
|
|
|
|
fill_in "dashboard_search", with: "Foo"
|
|
|
|
click_button "Search"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I search for "rspec"' do
|
|
|
|
fill_in "dashboard_search", with: "rspec"
|
|
|
|
click_button "Search"
|
|
|
|
end
|
|
|
|
|
2016-03-01 10:29:16 -05:00
|
|
|
step 'I search for "rspec" on project page' do
|
|
|
|
fill_in "search", with: "rspec"
|
|
|
|
click_button "Go"
|
|
|
|
end
|
|
|
|
|
2015-04-30 11:40:21 -04:00
|
|
|
step 'I search for "Wiki content"' do
|
|
|
|
fill_in "dashboard_search", with: "content"
|
|
|
|
click_button "Search"
|
|
|
|
end
|
|
|
|
|
2014-08-27 03:48:51 -04:00
|
|
|
step 'I click "Issues" link' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.search-filter' do
|
2014-08-27 03:48:51 -04:00
|
|
|
click_link 'Issues'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click project "Shop" link' do
|
2016-04-18 04:22:36 -04:00
|
|
|
click_button 'Project'
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.project-filter' do
|
2014-08-27 03:48:51 -04:00
|
|
|
click_link project.name_with_namespace
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click "Merge requests" link' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.search-filter' do
|
2014-08-27 03:48:51 -04:00
|
|
|
click_link 'Merge requests'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-13 10:48:21 -04:00
|
|
|
step 'I click "Milestones" link' do
|
|
|
|
page.within '.search-filter' do
|
|
|
|
click_link 'Milestones'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-30 11:40:21 -04:00
|
|
|
step 'I click "Wiki" link' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within '.search-filter' do
|
2015-04-30 11:40:21 -04:00
|
|
|
click_link 'Wiki'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-08-27 03:48:51 -04:00
|
|
|
step 'I should see "Shop" project link' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_link "Shop"
|
2014-08-27 03:48:51 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see code results for project "Shop"' do
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within('.results') do
|
|
|
|
page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions'
|
|
|
|
end
|
2014-08-27 03:48:51 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I search for "Contibuting"' do
|
|
|
|
fill_in "dashboard_search", with: "Contibuting"
|
|
|
|
click_button "Search"
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'project has issues' do
|
|
|
|
create(:issue, title: "Foo", project: project)
|
|
|
|
create(:issue, title: "Bar", project: project)
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'project has merge requests' do
|
|
|
|
create(:merge_request, title: "Foo", source_project: project, target_project: project)
|
|
|
|
create(:merge_request, :simple, title: "Bar", source_project: project, target_project: project)
|
|
|
|
end
|
|
|
|
|
2015-08-13 10:48:21 -04:00
|
|
|
step 'project has milestones' do
|
|
|
|
create(:milestone, title: "Foo", project: project)
|
|
|
|
create(:milestone, title: "Bar", project: project)
|
|
|
|
end
|
|
|
|
|
2014-12-08 19:22:28 -05:00
|
|
|
step 'I should see "Foo" link in the search results' do
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within('.results') do
|
|
|
|
find(:css, '.search-results').should have_link 'Foo'
|
|
|
|
end
|
2014-08-27 03:48:51 -04:00
|
|
|
end
|
|
|
|
|
2014-12-08 19:22:28 -05:00
|
|
|
step 'I should not see "Bar" link in the search results' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(find(:css, '.search-results')).not_to have_link 'Bar'
|
2014-08-27 03:48:51 -04:00
|
|
|
end
|
2015-04-30 11:40:21 -04:00
|
|
|
|
|
|
|
step 'I should see "test_wiki" link in the search results' do
|
2015-06-18 22:13:32 -04:00
|
|
|
page.within('.results') do
|
2016-03-08 23:50:34 -05:00
|
|
|
expect(find(:css, '.search-results')).to have_link 'test_wiki'
|
2015-06-18 22:13:32 -04:00
|
|
|
end
|
2015-04-30 11:40:21 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'project has Wiki content' do
|
|
|
|
@wiki = ::ProjectWiki.new(project, current_user)
|
|
|
|
@wiki.create_page("test_wiki", "Some Wiki content", :markdown, "first commit")
|
|
|
|
end
|
2016-03-01 10:29:16 -05:00
|
|
|
|
|
|
|
step 'project "Shop" is public' do
|
|
|
|
project.update_attributes(visibility_level: Project::PUBLIC)
|
|
|
|
end
|
2014-08-27 03:48:51 -04:00
|
|
|
end
|