Commit 13f7415a authored by Rémy Coutable's avatar Rémy Coutable Committed by Robert Speicher

Address review feedback

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 2d54dfb2
require 'spec_helper'
feature 'Project Activity RSS' do
let(:user) { create(:user) }
let(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) }
let(:project) { create(:project, :public) }
let(:user) { project.owner }
let(:path) { activity_project_path(project) }
before do
......@@ -11,8 +11,7 @@ feature 'Project Activity RSS' do
context 'when signed in' do
before do
project.add_developer(user)
sign_in(user)
sign_in(project.owner)
visit path
end
......
......@@ -15,22 +15,7 @@ feature 'Projects > Activity > User sees activity' do
visit activity_project_path(project)
end
shared_examples 'push appears in activity' do
it 'shows the last push in the activity page', :js do
expect(page).to have_content "#{user.name} pushed new branch fix"
end
end
context 'when signed in' do
before do
project.add_developer(user)
sign_in(user)
end
it_behaves_like 'push appears in activity'
end
context 'when signed out' do
it_behaves_like 'push appears in activity'
end
end
require 'spec_helper'
require 'fileutils'
describe 'Projects > Files > User wants to add a Dockerfile file' do
before do
user = create(:user)
project = create(:project, :repository)
project.add_master(user)
sign_in user
sign_in project.owner
visit project_new_blob_path(project, 'master', file_name: 'Dockerfile')
end
it 'user can see Dockerfile dropdown' do
it 'user can pick a Dockerfile file from the dropdown', :js do
expect(page).to have_css('.dockerfile-selector')
end
it 'user can pick a Dockerfile file from the dropdown', :js do
find('.js-dockerfile-selector').click
wait_for_requests
......
require 'spec_helper'
describe 'Projects > Files > Download buttons in files tree' do
let(:user) { create(:user) }
let(:role) { :developer }
let(:status) { 'success' }
let(:project) { create(:project, :repository) }
let(:user) { project.creator }
let(:pipeline) do
create(:ci_pipeline,
project: project,
sha: project.commit.sha,
ref: project.default_branch,
status: status)
status: 'success')
end
let!(:build) do
......@@ -23,20 +21,16 @@ describe 'Projects > Files > Download buttons in files tree' do
before do
sign_in(user)
project.add_role(user, role)
end
project.add_developer(user)
describe 'when files tree' do
context 'with artifacts' do
before do
visit project_tree_path(project, project.default_branch)
end
context 'with artifacts' do
it 'shows download artifacts button' do
href = latest_succeeded_project_artifacts_path(project, "#{project.default_branch}/download", job: 'build')
expect(page).to have_link "Download '#{build.name}'", href: href
end
end
end
end
......@@ -2,9 +2,8 @@ require 'spec_helper'
describe 'Projects > Files > User uses soft wrap whilst editing file', :js do
before do
user = create(:user)
project = create(:project, :repository)
project.add_master(user)
user = project.owner
sign_in user
visit project_new_blob_path(project, 'master', file_name: 'test_file-name')
page.within('.file-editor.code') do
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Projects > Files > User wants to edit a file' do
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:user) { project.owner }
let(:commit_params) do
{
start_branch: project.default_branch,
......@@ -16,7 +16,6 @@ describe 'Projects > Files > User wants to edit a file' do
end
before do
project.add_master(user)
sign_in user
visit project_edit_blob_path(project,
File.join(project.default_branch, '.gitignore'))
......
require 'spec_helper'
describe 'Projects > Files > User views files page' do
let(:user) { create(:user) }
let(:project) { create(:forked_project_with_submodules) }
let(:user) { project.owner }
before do
project.add_master(user)
sign_in user
visit project_tree_path(project, project.repository.root_ref)
end
......
require 'spec_helper'
describe 'Projects > Files > Find file keyboard shortcuts', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
before do
project.add_master(user)
sign_in user
visit project_find_file_path(project, project.repository.root_ref)
......
......@@ -2,24 +2,23 @@ require 'spec_helper'
describe 'Projects > Files > User wants to add a .gitignore file' do
before do
user = create(:user)
project = create(:project, :repository)
project.add_master(user)
sign_in user
sign_in project.owner
visit project_new_blob_path(project, 'master', file_name: '.gitignore')
end
it 'user can see .gitignore dropdown' do
it 'user can pick a .gitignore file from the dropdown', :js do
expect(page).to have_css('.gitignore-selector')
end
it 'user can pick a .gitignore file from the dropdown', :js do
find('.js-gitignore-selector').click
wait_for_requests
within '.gitignore-selector' do
find('.dropdown-input-field').set('rails')
find('.dropdown-content li', text: 'Rails').click
end
wait_for_requests
expect(page).to have_css('.gitignore-selector .dropdown-toggle-text', text: 'Rails')
......
......@@ -2,24 +2,23 @@ require 'spec_helper'
describe 'Projects > Files > User wants to add a .gitlab-ci.yml file' do
before do
user = create(:user)
project = create(:project, :repository)
project.add_master(user)
sign_in user
sign_in project.owner
visit project_new_blob_path(project, 'master', file_name: '.gitlab-ci.yml')
end
it 'user can see .gitlab-ci.yml dropdown' do
it 'user can pick a template from the dropdown', :js do
expect(page).to have_css('.gitlab-ci-yml-selector')
end
it 'user can pick a template from the dropdown', :js do
find('.js-gitlab-ci-yml-selector').click
wait_for_requests
within '.gitlab-ci-yml-selector' do
find('.dropdown-input-field').set('Jekyll')
find('.dropdown-content li', text: 'Jekyll').click
end
wait_for_requests
expect(page).to have_css('.gitlab-ci-yml-selector .dropdown-toggle-text', text: 'Jekyll')
......
require 'spec_helper'
describe 'Projects > Files > Project owner creates a license file', :js do
let(:project_master) { create(:user) }
let(:project) { create(:project, :repository) }
let(:project_master) { project.owner }
before do
project.repository.delete_file(project_master, 'LICENSE',
message: 'Remove LICENSE', branch_name: 'master')
project.add_master(project_master)
sign_in(project_master)
visit project_path(project)
end
......
require 'spec_helper'
describe 'Projects > Files > Project owner sees a link to create a license file in empty project', :js do
let(:project_master) { create(:user) }
let(:project) { create(:project_empty_repo) }
let(:project_master) { project.owner }
before do
project.add_master(project_master)
sign_in(project_master)
end
......
......@@ -2,10 +2,9 @@ require 'spec_helper'
describe 'Projects > Files > Template type dropdown selector', :js do
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:user) { project.owner }
before do
project.add_master(user)
sign_in user
end
......
......@@ -2,10 +2,9 @@ require 'spec_helper'
describe 'Projects > Files > Template Undo Button', :js do
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:user) { project.owner }
before do
project.add_master(user)
sign_in user
end
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
# This is a regression test for https://gitlab.com/gitlab-org/gitlab-ce/issues/37569
describe 'Projects > Files > User browses a tree with a folder containing only a folder' do
let(:project) { create(:project, :empty_repo) }
let(:user) { project.creator }
let(:user) { project.owner }
before do
# We need to disable the tree.flat_path provided by Gitaly to reproduce the issue
......
......@@ -10,10 +10,9 @@ describe 'Projects > Files > User browses files' do
let(:project2_tree_path_root_ref) { project_tree_path(project2, project2.repository.root_ref) }
let(:tree_path_ref_6d39438) { project_tree_path(project, '6d39438') }
let(:tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) }
let(:user) { project.creator }
let(:user) { project.owner }
before do
project.add_master(user)
sign_in(user)
end
......
......@@ -2,10 +2,9 @@ require 'spec_helper'
describe 'Projects > Files > User browses LFS files' do
let(:project) { create(:project, :repository) }
let(:user) { project.creator }
let(:user) { project.owner }
before do
project.add_master(user)
sign_in(user)
end
......
require 'spec_helper'
describe 'Projects > Files > User searches for files' do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
before do
sign_in(user)
......@@ -10,11 +9,10 @@ describe 'Projects > Files > User searches for files' do
describe 'project main screen' do
context 'when project is empty' do
let(:empty_project) { create(:project) }
let(:project) { create(:project) }
before do
empty_project.add_developer(user)
visit project_path(empty_project)
visit project_path(project)
end
it 'does not show any result' do
......@@ -26,6 +24,8 @@ describe 'Projects > Files > User searches for files' do
end
context 'when project is not empty' do
let(:project) { create(:project, :repository) }
before do
project.add_developer(user)
visit project_path(project)
......@@ -38,16 +38,16 @@ describe 'Projects > Files > User searches for files' do
end
describe 'project tree screen' do
let(:project) { create(:project, :repository) }
before do
project.add_developer(user)
visit project_tree_path(project, project.default_branch)
end
it 'shows "Find file" button' do
it 'shows found files' do
expect(page).to have_selector('.tree-controls .shortcuts-find-file')
end
it 'shows found files' do
fill_in('search', with: 'coffee')
click_button('Go')
......
......@@ -6,11 +6,12 @@ describe 'Projects > Settings > LFS settings' do
context 'LFS enabled setting' do
before do
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
sign_in(admin)
end
it 'displays the correct elements', :js do
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
visit edit_project_path(project)
expect(page).to have_content('Git Large File Storage')
......
require 'spec_helper'
describe 'Projects > Show > User manages notifications' do
describe 'Projects > Show > User manages notifications', :js do
let(:project) { create(:project, :public, :repository) }
context 'when user is signed in', :js do
let(:user) { create(:user) }
before do
sign_in(user)
sign_in(project.owner)
visit project_path(project)
end
......@@ -19,5 +16,4 @@ describe 'Projects > Show > User manages notifications' do
expect(page).to have_content 'On mention'
end
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