summaryrefslogtreecommitdiff
path: root/spec/features/projects/user_sees_sidebar_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-06-27 16:15:06 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-06-27 16:15:06 +0800
commit849f9995d97c85d88b36a40ee563f7dd51fdc3f1 (patch)
tree3523089d253b001f7e3b029266399e497407441b /spec/features/projects/user_sees_sidebar_spec.rb
parentef6b3e0271d226462bed5f899f3964cf5652978c (diff)
parent87f7597a4fb7852fc81f830158cdfd5fdec8fac4 (diff)
downloadgitlab-ce-849f9995d97c85d88b36a40ee563f7dd51fdc3f1.tar.gz
Merge remote-tracking branch 'upstream/master' into 14995-custom_wiki_sidebar
* upstream/master: (4180 commits) Enable frozen string literals for app/workers/*.rb Resolve "Search dropdown hides & shows when typing" Revert merge request widget button max height Update CHANGELOG.md for 11.0.2 Update external link icon in header user dropdown Added Diff Viewer to new VUE based MR page Fixed eslint failure in IDE spec helpers Use refs instead of querySelector. Show file in tree on WebIDE open Resolve "Remove unused bootstrap component CSS" Resolve "Explain what Groups are in the New Group page" [QA] Make sure we wait for the deploy key list to load Update _scopes_form.html.haml to remove duplicate information Use the branch instead of the tag to install port the EE changes Add index on deployable_type/id for deployments Add a helper to rename a column using a background migration Fix performance bottleneck when rendering large wiki pages Port Namespace#root_ancestor to CE Remove duplicate spec ...
Diffstat (limited to 'spec/features/projects/user_sees_sidebar_spec.rb')
-rw-r--r--spec/features/projects/user_sees_sidebar_spec.rb118
1 files changed, 118 insertions, 0 deletions
diff --git a/spec/features/projects/user_sees_sidebar_spec.rb b/spec/features/projects/user_sees_sidebar_spec.rb
new file mode 100644
index 00000000000..ee5734a9bf1
--- /dev/null
+++ b/spec/features/projects/user_sees_sidebar_spec.rb
@@ -0,0 +1,118 @@
+require 'spec_helper'
+
+describe 'Projects > User sees sidebar' do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :private, public_builds: false, namespace: user.namespace) }
+
+ context 'as owner' do
+ before do
+ sign_in(user)
+ end
+
+ context 'when snippets are disabled' do
+ before do
+ project.project_feature.update_attribute('snippets_access_level', ProjectFeature::DISABLED)
+ end
+
+ it 'does not display a "Snippets" link' do
+ visit project_path(project)
+
+ within('.nav-sidebar') do
+ expect(page).not_to have_content 'Snippets'
+ end
+ end
+ end
+ end
+
+ context 'as guest' do
+ let(:guest) { create(:user) }
+
+ before do
+ project.add_guest(guest)
+
+ sign_in(guest)
+ end
+
+ it 'shows allowed tabs only' do
+ visit project_path(project)
+
+ within('.nav-sidebar') do
+ expect(page).to have_content 'Project'
+ expect(page).to have_content 'Issues'
+ expect(page).to have_content 'Wiki'
+
+ expect(page).not_to have_content 'Repository'
+ expect(page).not_to have_content 'CI / CD'
+ expect(page).not_to have_content 'Merge Requests'
+ expect(page).not_to have_content 'Operations'
+ end
+ end
+
+ it 'shows build tab if builds are public' do
+ project.public_builds = true
+ project.save
+
+ visit project_path(project)
+
+ within('.nav-sidebar') do
+ expect(page).to have_content 'CI / CD'
+ end
+ end
+
+ it 'does not show fork button' do
+ visit project_path(project)
+
+ within('.count-buttons') do
+ expect(page).not_to have_link 'Fork'
+ end
+ end
+
+ it 'does not show clone path' do
+ visit project_path(project)
+
+ within('.project-repo-buttons') do
+ expect(page).not_to have_selector '.project-clone-holder'
+ end
+ end
+
+ describe 'project landing page' do
+ before do
+ project.project_feature.update!(
+ issues_access_level: ProjectFeature::DISABLED,
+ wiki_access_level: ProjectFeature::DISABLED
+ )
+ end
+
+ it 'does not show the project file list landing page' do
+ visit project_path(project)
+
+ expect(page).not_to have_selector '.project-stats'
+ expect(page).not_to have_selector '.project-last-commit'
+ expect(page).not_to have_selector '.project-show-files'
+ expect(page).to have_selector '.project-show-customize_workflow'
+ end
+
+ it 'shows the customize workflow when issues and wiki are disabled' do
+ visit project_path(project)
+
+ expect(page).to have_selector '.project-show-customize_workflow'
+ end
+
+ it 'shows the wiki when enabled' do
+ project.project_feature.update!(wiki_access_level: ProjectFeature::PRIVATE)
+
+ visit project_path(project)
+
+ expect(page).to have_selector '.project-show-wiki'
+ end
+
+ it 'shows the issues when enabled' do
+ project.project_feature.update!(issues_access_level: ProjectFeature::PRIVATE)
+
+ visit project_path(project)
+
+ expect(page).to have_selector '.issues-list'
+ end
+ end
+ end
+end