Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajat Jain <rjain@gitlab.com>2019-01-09 12:02:44 +0300
committerRajat Jain <rjain@gitlab.com>2019-01-10 10:00:02 +0300
commitf9b54ae1131e3a83008c19d16d90ce05c50c528f (patch)
tree36fce0cf632ce6dc89f7a579b8185ec548898b67 /spec/features/groups
parentcfaa19f21ea4f01ef8e77fbacbdfd0e1b965a8aa (diff)
Make issuable empty state actionable
As per https://gitlab.com/gitlab-org/gitlab-ce/issues/25043, we want to make the empty state for issuables a little friendly. This applies during searching in opened state and in the closed state.
Diffstat (limited to 'spec/features/groups')
-rw-r--r--spec/features/groups/empty_states_spec.rb44
1 files changed, 41 insertions, 3 deletions
diff --git a/spec/features/groups/empty_states_spec.rb b/spec/features/groups/empty_states_spec.rb
index 8f5ca781b2c..e4eb0d355d1 100644
--- a/spec/features/groups/empty_states_spec.rb
+++ b/spec/features/groups/empty_states_spec.rb
@@ -23,14 +23,52 @@ describe 'Group empty states' do
end
context "the project has #{issuable_name}s" do
- before do
+ it 'does not display an empty state' do
create(issuable, project_relation => project)
visit path
+ expect(page).not_to have_selector('.empty-state')
end
- it 'does not display an empty state' do
- expect(page).not_to have_selector('.empty-state')
+ it "displays link to create new #{issuable} when no open #{issuable} is found" do
+ create("closed_#{issuable}", project_relation => project)
+ issuable_link_fn = "project_#{issuable}s_path"
+
+ visit public_send(issuable_link_fn, project)
+
+ page.within(find('.empty-state')) do
+ expect(page).to have_content(/There are no open #{issuable.to_s.humanize.downcase}/)
+ expect(page).to have_selector("#new_#{issuable}_body_link")
+ end
+ end
+
+ it 'displays link to create new issue when the current search gave no results' do
+ create(issuable, project_relation => project)
+
+ issuable_link_fn = "project_#{issuable}s_path"
+
+ visit public_send(issuable_link_fn, project, author_username: 'foo', scope: 'all', state: 'opened')
+
+ page.within(find('.empty-state')) do
+ expect(page).to have_content(/Sorry, your filter produced no results/)
+ new_issuable_path = issuable == :issue ? 'new_project_issue_path' : 'project_new_merge_request_path'
+
+ path = public_send(new_issuable_path, project)
+
+ expect(page).to have_selector("#new_#{issuable}_body_link[href='#{path}']")
+ end
+ end
+
+ it "displays conditional text when no closed #{issuable} is found" do
+ create(issuable, project_relation => project)
+
+ issuable_link_fn = "project_#{issuable}s_path"
+
+ visit public_send(issuable_link_fn, project, state: 'closed')
+
+ page.within(find('.empty-state')) do
+ expect(page).to have_content(/There are no closed #{issuable.to_s.humanize.downcase}/)
+ end
end
end