Commit c3ad51a0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve search tests

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent ede08dbd
...@@ -128,7 +128,7 @@ p.time { ...@@ -128,7 +128,7 @@ p.time {
} }
.highlight_word { .highlight_word {
border-bottom: 2px solid #F90; background: #fafe3d;
} }
.thin_area{ .thin_area{
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
= link_to search_path(group_id: group.id, search: params[:search]) do = link_to search_path(group_id: group.id, search: params[:search]) do
= group.name = group.name
.dropdown.inline.prepend-left-10 .dropdown.inline.prepend-left-10.project-filter
%a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"} %a.dropdown-toggle.btn.btn-small{href: '#', "data-toggle" => "dropdown"}
%i.icon-tags %i.icon-tags
%span.light Project: %span.light Project:
......
.row .row
.col-sm-3 .col-sm-3
%ul.nav.nav-pills.nav-stacked %ul.nav.nav-pills.nav-stacked.search-filter
%li{class: ("active" if @scope == 'projects')} %li{class: ("active" if @scope == 'projects')}
= link_to search_filter_path(scope: 'projects') do = link_to search_filter_path(scope: 'projects') do
Projects Projects
......
.row .row
.col-sm-3 .col-sm-3
%ul.nav.nav-pills.nav-stacked %ul.nav.nav-pills.nav-stacked.search-filter
%li{class: ("active" if @scope == 'blobs')} %li{class: ("active" if @scope == 'blobs')}
= link_to search_filter_path(scope: 'blobs') do = link_to search_filter_path(scope: 'blobs') do
%i.icon-code %i.icon-code
......
%li %li
issue: %h4
= link_to [issue.project, issue] do = link_to [issue.project, issue] do
%span ##{issue.iid} %span.term.str-truncated= issue.title
%strong.term .pull-right ##{issue.iid}
= truncate issue.title, length: 50 %span.light
%span.light (#{issue.project.name_with_namespace}) #{issue.project.name_with_namespace}
- if issue.closed? - if issue.closed?
%span.label.label-danger Closed .pull-right
%span.label.label-danger Closed
@dashboard
Feature: Dashboard Search
Background:
Given I sign in as a user
And I own project "Shop"
And I visit dashboard search page
Scenario: I should see project I am looking for
Given I search for "Sho"
Then I should see "Shop" project link
@dashboard
Feature: Search
Background:
Given I sign in as a user
And I own project "Shop"
And I visit dashboard search page
Scenario: I should see project I am looking for
Given I search for "Sho"
Then I should see "Shop" project link
Scenario: I should see issues I am looking for
And project has issues
When I search for "Foo"
And I click "Issues" link
Then I should see "Foo" link
And I should not see "Bar" link
Scenario: I should see merge requests I am looking for
And project has merge requests
When I search for "Foo"
When I click "Merge requests" link
Then I should see "Foo" link
And I should not see "Bar" link
Scenario: I should see project code I am looking for
When I search for "rspec"
And I click project "Shop" link
Then I should see code results for project "Shop"
class DashboardSearch < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
Given 'I search for "Sho"' do
fill_in "dashboard_search", with: "Sho"
click_button "Search"
end
Then 'I should see "Shop" project link' do
page.should have_link "Shop"
end
Given 'I search for "Contibuting"' do
fill_in "dashboard_search", with: "Contibuting"
click_button "Search"
end
end
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
step 'I click "Issues" link' do
within '.search-filter' do
click_link 'Issues'
end
end
step 'I click project "Shop" link' do
within '.project-filter' do
click_link project.name_with_namespace
end
end
step 'I click "Merge requests" link' do
within '.search-filter' do
click_link 'Merge requests'
end
end
step 'I should see "Shop" project link' do
page.should have_link "Shop"
end
step 'I should see code results for project "Shop"' do
page.should have_content 'Update capybara, rspec-rails, poltergeist to recent versions'
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
step 'I should see "Foo" link' do
page.should have_link "Foo"
end
step 'I should not see "Bar" link' do
page.should_not have_link "Bar"
end
def project
@project ||= Project.find_by(name: "Shop")
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