Commit 2cd3043f authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch '26963-fix-empty-state-in-explore-projects-pages' into 'master'

Fix empty state message in explore projects pages

See merge request gitlab-org/gitlab!46860
parents 9fc33b59 90f4c61b
- is_explore_page = defined?(explore_page) && explore_page
= render 'shared/projects/list', projects: projects, user: current_user, explore_page: is_explore_page, pipeline_status: Feature.enabled?(:dashboard_pipeline_status, default_enabled: true)
= render 'shared/projects/list', projects: projects, user: current_user, explore_page: true, pipeline_status: Feature.enabled?(:dashboard_pipeline_status, default_enabled: true)
......@@ -10,4 +10,4 @@
= render 'explore/head'
= render 'explore/projects/nav' unless Feature.enabled?(:project_list_filter_bar) && current_user
= render 'projects', projects: @projects, explore_page: true
= render 'projects', projects: @projects
---
title: Fix empty state message in explore projects page
merge_request: 46860
author:
type: fixed
......@@ -59,7 +59,7 @@ RSpec.describe 'Dashboard shortcuts', :js do
find('body').send_keys([:shift, 'P'])
find('.nothing-here-block')
expect(page).to have_content("This user doesn't have any personal projects")
expect(page).to have_content('Explore public groups to find projects to contribute to.')
end
end
......
......@@ -3,65 +3,112 @@
require 'spec_helper'
RSpec.describe 'User explores projects' do
let_it_be(:archived_project) { create(:project, :archived) }
let_it_be(:internal_project) { create(:project, :internal) }
let_it_be(:private_project) { create(:project, :private) }
let_it_be(:public_project) { create(:project, :public) }
context 'when not signed in' do
context 'when viewing public projects' do
before do
visit(explore_projects_path)
context 'when some projects exist' do
let_it_be(:archived_project) { create(:project, :archived) }
let_it_be(:internal_project) { create(:project, :internal) }
let_it_be(:private_project) { create(:project, :private) }
let_it_be(:public_project) { create(:project, :public) }
context 'when not signed in' do
context 'when viewing public projects' do
before do
visit(explore_projects_path)
end
include_examples 'shows public projects'
end
include_examples 'shows public projects'
context 'when visibility is restricted to public' do
before do
stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC])
visit(explore_projects_path)
end
it 'redirects to login page' do
expect(page).to have_current_path(new_user_session_path)
end
end
end
context 'when visibility is restricted to public' do
context 'when signed in' do
let_it_be(:user) { create(:user) }
before do
stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC])
visit(explore_projects_path)
sign_in(user)
stub_feature_flags(project_list_filter_bar: false)
end
shared_examples 'empty search results' do
it 'shows correct empty state message', :js do
fill_in 'name', with: 'zzzzzzzzzzzzzzzzzzz'
expect(page).to have_content('Explore public groups to find projects to contribute to.')
end
end
it 'redirects to login page' do
expect(page).to have_current_path(new_user_session_path)
context 'when viewing public projects' do
before do
visit(explore_projects_path)
end
include_examples 'shows public and internal projects'
include_examples 'empty search results'
end
context 'when viewing most starred projects' do
before do
visit(starred_explore_projects_path)
end
include_examples 'shows public and internal projects'
include_examples 'empty search results'
end
context 'when viewing trending projects' do
before do
[archived_project, public_project].each { |project| create(:note_on_issue, project: project) }
TrendingProject.refresh!
visit(trending_explore_projects_path)
end
include_examples 'shows public projects'
include_examples 'empty search results'
end
end
end
context 'when signed in' do
let_it_be(:user) { create(:user) }
before do
sign_in(user)
context 'when there are no projects' do
shared_examples 'explore page empty state' do
it 'shows correct empty state message' do
expect(page).to have_content('Explore public groups to find projects to contribute to.')
end
end
context 'when viewing public projects' do
before do
visit(explore_projects_path)
visit explore_projects_path
end
include_examples 'shows public and internal projects'
it_behaves_like 'explore page empty state'
end
context 'when viewing most starred projects' do
before do
visit(starred_explore_projects_path)
visit starred_explore_projects_path
end
include_examples 'shows public and internal projects'
it_behaves_like 'explore page empty state'
end
context 'when viewing trending projects' do
before do
[archived_project, public_project].each { |project| create(:note_on_issue, project: project) }
TrendingProject.refresh!
visit(trending_explore_projects_path)
visit trending_explore_projects_path
end
include_examples 'shows public projects'
it_behaves_like 'explore page empty state'
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