diff options
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/admin/admin_users_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/boards/modal_filter_spec.rb | 259 | ||||
-rw-r--r-- | spec/features/groups/merge_requests_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/merge_requests/widget_spec.rb | 53 | ||||
-rw-r--r-- | spec/features/projects/commit/builds_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/projects/pages_spec.rb | 60 | ||||
-rw-r--r-- | spec/features/projects/settings/merge_requests_settings_spec.rb | 5 | ||||
-rw-r--r-- | spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb | 12 | ||||
-rw-r--r-- | spec/features/security/project/internal_access_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/security/project/private_access_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/security/project/public_access_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/triggers_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/variables_spec.rb | 2 |
13 files changed, 409 insertions, 32 deletions
diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index a586f8d3184..c0807b8c507 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -211,7 +211,7 @@ describe "Admin::Users", feature: true do fill_in "user_email", with: "bigbang@mail.com" fill_in "user_password", with: "AValidPassword1" fill_in "user_password_confirmation", with: "AValidPassword1" - check "user_admin" + choose "user_access_level_admin" click_button "Save changes" end diff --git a/spec/features/boards/modal_filter_spec.rb b/spec/features/boards/modal_filter_spec.rb new file mode 100644 index 00000000000..1cf0d11d448 --- /dev/null +++ b/spec/features/boards/modal_filter_spec.rb @@ -0,0 +1,259 @@ +require 'rails_helper' + +describe 'Issue Boards add issue modal filtering', :feature, :js do + include WaitForAjax + include WaitForVueResource + + let(:project) { create(:empty_project, :public) } + let(:board) { create(:board, project: project) } + let(:planning) { create(:label, project: project, name: 'Planning') } + let!(:list1) { create(:list, board: board, label: planning, position: 0) } + let(:user) { create(:user) } + let(:user2) { create(:user) } + let!(:issue1) { create(:issue, project: project) } + + before do + project.team << [user, :master] + + login_as(user) + end + + it 'shows empty state when no results found' do + visit_board + + page.within('.add-issues-modal') do + find('.form-control').native.send_keys('testing empty state') + + wait_for_vue_resource + + expect(page).to have_content('There are no issues to show.') + end + end + + it 'restores filters when closing' do + visit_board + + page.within('.add-issues-modal') do + click_button 'Milestone' + + wait_for_ajax + + click_link 'Upcoming' + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 0) + + click_button 'Cancel' + end + + click_button('Add issues') + + page.within('.add-issues-modal') do + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 1) + end + end + + context 'author' do + let!(:issue) { create(:issue, project: project, author: user2) } + + before do + project.team << [user2, :developer] + + visit_board + end + + it 'filters by any author' do + page.within('.add-issues-modal') do + click_button 'Author' + + wait_for_ajax + + click_link 'Any Author' + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 2) + end + end + + it 'filters by selected user' do + page.within('.add-issues-modal') do + click_button 'Author' + + wait_for_ajax + + click_link user2.name + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 1) + end + end + end + + context 'assignee' do + let!(:issue) { create(:issue, project: project, assignee: user2) } + + before do + project.team << [user2, :developer] + + visit_board + end + + it 'filters by any assignee' do + page.within('.add-issues-modal') do + click_button 'Assignee' + + wait_for_ajax + + click_link 'Any Assignee' + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 2) + end + end + + it 'filters by unassigned' do + page.within('.add-issues-modal') do + click_button 'Assignee' + + wait_for_ajax + + click_link 'Unassigned' + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 1) + end + end + + it 'filters by selected user' do + page.within('.add-issues-modal') do + click_button 'Assignee' + + wait_for_ajax + + page.within '.dropdown-menu-user' do + click_link user2.name + end + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 1) + end + end + end + + context 'milestone' do + let(:milestone) { create(:milestone, project: project) } + let!(:issue) { create(:issue, project: project, milestone: milestone) } + + before do + visit_board + end + + it 'filters by any milestone' do + page.within('.add-issues-modal') do + click_button 'Milestone' + + wait_for_ajax + + click_link 'Any Milestone' + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 2) + end + end + + it 'filters by upcoming milestone' do + page.within('.add-issues-modal') do + click_button 'Milestone' + + wait_for_ajax + + click_link 'Upcoming' + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 0) + end + end + + it 'filters by selected milestone' do + page.within('.add-issues-modal') do + click_button 'Milestone' + + wait_for_ajax + + click_link milestone.name + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 1) + end + end + end + + context 'label' do + let(:label) { create(:label, project: project) } + let!(:issue) { create(:labeled_issue, project: project, labels: [label]) } + + before do + visit_board + end + + it 'filters by any label' do + page.within('.add-issues-modal') do + click_button 'Label' + + wait_for_ajax + + click_link 'Any Label' + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 2) + end + end + + it 'filters by no label' do + page.within('.add-issues-modal') do + click_button 'Label' + + wait_for_ajax + + click_link 'No Label' + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 1) + end + end + + it 'filters by label' do + page.within('.add-issues-modal') do + click_button 'Label' + + wait_for_ajax + + click_link label.title + + wait_for_vue_resource + + expect(page).to have_selector('.card', count: 1) + end + end + end + + def visit_board + visit namespace_project_board_path(project.namespace, project, board) + wait_for_vue_resource + + click_button('Add issues') + end +end diff --git a/spec/features/groups/merge_requests_spec.rb b/spec/features/groups/merge_requests_spec.rb index 78a11ffee99..b55078c3bf6 100644 --- a/spec/features/groups/merge_requests_spec.rb +++ b/spec/features/groups/merge_requests_spec.rb @@ -7,7 +7,7 @@ feature 'Group merge requests page', feature: true do include_examples 'project features apply to issuables', MergeRequest context 'archived issuable' do - let(:project_archived) { create(:project, :archived, group: group, merge_requests_access_level: ProjectFeature::ENABLED) } + let(:project_archived) { create(:project, :archived, :merge_requests_enabled, group: group) } let(:issuable_archived) { create(:merge_request, source_project: project_archived, target_project: project_archived, title: 'issuable of an archived project') } let(:access_level) { ProjectFeature::ENABLED } let(:user) { user_in_group } diff --git a/spec/features/merge_requests/widget_spec.rb b/spec/features/merge_requests/widget_spec.rb index 7d1805f5001..fb3a1ae4bd0 100644 --- a/spec/features/merge_requests/widget_spec.rb +++ b/spec/features/merge_requests/widget_spec.rb @@ -5,30 +5,53 @@ describe 'Merge request', :feature, :js do let(:project) { create(:project) } let(:user) { create(:user) } + let(:merge_request) { create(:merge_request, source_project: project) } before do project.team << [user, :master] login_as(user) + end - visit new_namespace_project_merge_request_path( - project.namespace, - project, - merge_request: { - source_project_id: project.id, - target_project_id: project.id, - source_branch: 'feature', - target_branch: 'master' - } - ) + context 'new merge request' do + before do + visit new_namespace_project_merge_request_path( + project.namespace, + project, + merge_request: { + source_project_id: project.id, + target_project_id: project.id, + source_branch: 'feature', + target_branch: 'master' + } + ) + end + + it 'shows widget status after creating new merge request' do + click_button 'Submit merge request' + + expect(find('.mr-state-widget')).to have_content('Checking ability to merge automatically') + + wait_for_ajax + + expect(page).to have_selector('.accept_merge_request') + end end - it 'shows widget status after creating new merge request' do - click_button 'Submit merge request' + context 'view merge request' do + let!(:environment) { create(:environment, project: project) } + let!(:deployment) { create(:deployment, environment: environment, ref: 'feature', sha: merge_request.diff_head_sha) } - expect(find('.mr-state-widget')).to have_content('Checking ability to merge automatically') + before do + visit namespace_project_merge_request_path(project.namespace, project, merge_request) + end - wait_for_ajax + it 'shows environments link' do + wait_for_ajax - expect(page).to have_selector('.accept_merge_request') + page.within('.mr-widget-heading') do + expect(page).to have_content("Deployed to #{environment.name}") + expect(find('.js-environment-link')[:href]).to include(environment.formatted_external_url) + end + end end end diff --git a/spec/features/projects/commit/builds_spec.rb b/spec/features/projects/commit/builds_spec.rb index 33f1c323af1..268d420c594 100644 --- a/spec/features/projects/commit/builds_spec.rb +++ b/spec/features/projects/commit/builds_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -feature 'project commit pipelines' do +feature 'project commit pipelines', js: true do given(:project) { create(:project) } background do diff --git a/spec/features/projects/pages_spec.rb b/spec/features/projects/pages_spec.rb new file mode 100644 index 00000000000..11793c0f303 --- /dev/null +++ b/spec/features/projects/pages_spec.rb @@ -0,0 +1,60 @@ +require 'spec_helper' + +feature 'Pages', feature: true do + given(:project) { create(:empty_project) } + given(:user) { create(:user) } + given(:role) { :master } + + background do + allow(Gitlab.config.pages).to receive(:enabled).and_return(true) + + project.team << [user, role] + + login_as(user) + end + + shared_examples 'no pages deployed' do + scenario 'does not see anything to destroy' do + visit namespace_project_pages_path(project.namespace, project) + + expect(page).not_to have_link('Remove pages') + expect(page).not_to have_text('Only the project owner can remove pages') + end + end + + context 'when user is the owner' do + background do + project.namespace.update(owner: user) + end + + context 'when pages deployed' do + background do + allow_any_instance_of(Project).to receive(:pages_deployed?) { true } + end + + scenario 'sees "Remove pages" link' do + visit namespace_project_pages_path(project.namespace, project) + + expect(page).to have_link('Remove pages') + end + end + + it_behaves_like 'no pages deployed' + end + + context 'when the user is not the owner' do + context 'when pages deployed' do + background do + allow_any_instance_of(Project).to receive(:pages_deployed?) { true } + end + + scenario 'sees "Only the project owner can remove pages" text' do + visit namespace_project_pages_path(project.namespace, project) + + expect(page).to have_text('Only the project owner can remove pages') + end + end + + it_behaves_like 'no pages deployed' + end +end diff --git a/spec/features/projects/settings/merge_requests_settings_spec.rb b/spec/features/projects/settings/merge_requests_settings_spec.rb index 034b75c2e51..6815039d5ed 100644 --- a/spec/features/projects/settings/merge_requests_settings_spec.rb +++ b/spec/features/projects/settings/merge_requests_settings_spec.rb @@ -12,13 +12,8 @@ feature 'Project settings > Merge Requests', feature: true, js: true do end context 'when Merge Request and Pipelines are initially enabled' do - before do - project.project_feature.update_attribute('merge_requests_access_level', ProjectFeature::ENABLED) - end - context 'when Pipelines are initially enabled' do before do - project.project_feature.update_attribute('builds_access_level', ProjectFeature::ENABLED) visit edit_project_path(project) end diff --git a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb index b4f5f6b3fc5..20219f3cc9a 100644 --- a/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb +++ b/spec/features/projects/wiki/user_views_wiki_in_project_page_spec.rb @@ -2,7 +2,6 @@ require 'spec_helper' describe 'Projects > Wiki > User views wiki in project page', feature: true do let(:user) { create(:user) } - let(:project) { create(:empty_project) } before do project.team << [user, :master] @@ -10,12 +9,11 @@ describe 'Projects > Wiki > User views wiki in project page', feature: true do end context 'when repository is disabled for project' do - before do - project.project_feature.update!( - repository_access_level: ProjectFeature::DISABLED, - merge_requests_access_level: ProjectFeature::DISABLED, - builds_access_level: ProjectFeature::DISABLED - ) + let(:project) do + create(:empty_project, + :repository_disabled, + :merge_requests_disabled, + :builds_disabled) end context 'when wiki homepage contains a link' do diff --git a/spec/features/security/project/internal_access_spec.rb b/spec/features/security/project/internal_access_spec.rb index 92d5a2fbc48..24af062d763 100644 --- a/spec/features/security/project/internal_access_spec.rb +++ b/spec/features/security/project/internal_access_spec.rb @@ -96,6 +96,20 @@ describe "Internal Project Access", feature: true do it { is_expected.to be_denied_for(:external) } end + describe "GET /:project_path/settings/ci_cd" do + subject { namespace_project_settings_ci_cd_path(project.namespace, project) } + + it { is_expected.to be_allowed_for(:admin) } + it { is_expected.to be_allowed_for(:owner).of(project) } + it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_denied_for(:developer).of(project) } + it { is_expected.to be_denied_for(:reporter).of(project) } + it { is_expected.to be_denied_for(:guest).of(project) } + it { is_expected.to be_denied_for(:user) } + it { is_expected.to be_denied_for(:visitor) } + it { is_expected.to be_denied_for(:external) } + end + describe "GET /:project_path/blob" do let(:commit) { project.repository.commit } subject { namespace_project_blob_path(project.namespace, project, File.join(commit.id, '.gitignore')) } diff --git a/spec/features/security/project/private_access_spec.rb b/spec/features/security/project/private_access_spec.rb index b616e488487..c511dcfa18e 100644 --- a/spec/features/security/project/private_access_spec.rb +++ b/spec/features/security/project/private_access_spec.rb @@ -92,8 +92,22 @@ describe "Private Project Access", feature: true do it { is_expected.to be_allowed_for(:reporter).of(project) } it { is_expected.to be_allowed_for(:guest).of(project) } it { is_expected.to be_denied_for(:user) } + it { is_expected.to be_denied_for(:visitor) } it { is_expected.to be_denied_for(:external) } + end + + describe "GET /:project_path/settings/ci_cd" do + subject { namespace_project_settings_ci_cd_path(project.namespace, project) } + + it { is_expected.to be_allowed_for(:admin) } + it { is_expected.to be_allowed_for(:owner).of(project) } + it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_denied_for(:developer).of(project) } + it { is_expected.to be_denied_for(:reporter).of(project) } + it { is_expected.to be_denied_for(:guest).of(project) } + it { is_expected.to be_denied_for(:user) } it { is_expected.to be_denied_for(:visitor) } + it { is_expected.to be_denied_for(:external) } end describe "GET /:project_path/blob" do diff --git a/spec/features/security/project/public_access_spec.rb b/spec/features/security/project/public_access_spec.rb index ded85e837f4..d8cc012c27e 100644 --- a/spec/features/security/project/public_access_spec.rb +++ b/spec/features/security/project/public_access_spec.rb @@ -96,6 +96,20 @@ describe "Public Project Access", feature: true do it { is_expected.to be_allowed_for(:external) } end + describe "GET /:project_path/settings/ci_cd" do + subject { namespace_project_settings_ci_cd_path(project.namespace, project) } + + it { is_expected.to be_allowed_for(:admin) } + it { is_expected.to be_allowed_for(:owner).of(project) } + it { is_expected.to be_allowed_for(:master).of(project) } + it { is_expected.to be_denied_for(:developer).of(project) } + it { is_expected.to be_denied_for(:reporter).of(project) } + it { is_expected.to be_denied_for(:guest).of(project) } + it { is_expected.to be_denied_for(:user) } + it { is_expected.to be_denied_for(:visitor) } + it { is_expected.to be_denied_for(:external) } + end + describe "GET /:project_path/pipelines" do subject { namespace_project_pipelines_path(project.namespace, project) } diff --git a/spec/features/triggers_spec.rb b/spec/features/triggers_spec.rb index 72354834c5a..4a7511589d6 100644 --- a/spec/features/triggers_spec.rb +++ b/spec/features/triggers_spec.rb @@ -7,7 +7,7 @@ describe 'Triggers' do before do @project = FactoryGirl.create :empty_project @project.team << [user, :master] - visit namespace_project_triggers_path(@project.namespace, @project) + visit namespace_project_settings_ci_cd_path(@project.namespace, @project) end context 'create a trigger' do diff --git a/spec/features/variables_spec.rb b/spec/features/variables_spec.rb index ff30ffd7820..9a4bc027004 100644 --- a/spec/features/variables_spec.rb +++ b/spec/features/variables_spec.rb @@ -10,7 +10,7 @@ describe 'Project variables', js: true do project.team << [user, :master] project.variables << variable - visit namespace_project_variables_path(project.namespace, project) + visit namespace_project_settings_ci_cd_path(project.namespace, project) end it 'shows list of variables' do |