diff options
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/admin/admin_runners_spec.rb | 27 | ||||
-rw-r--r-- | spec/features/atom/dashboard_issues_spec.rb | 11 | ||||
-rw-r--r-- | spec/features/atom/issues_spec.rb | 29 | ||||
-rw-r--r-- | spec/features/commits_spec.rb | 8 | ||||
-rw-r--r-- | spec/features/dashboard_issues_spec.rb | 20 | ||||
-rw-r--r-- | spec/features/issues/filter_issues_spec.rb | 34 | ||||
-rw-r--r-- | spec/features/merge_requests/edit_mr_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/projects/builds_spec.rb | 38 | ||||
-rw-r--r-- | spec/features/projects/features_visibility_spec.rb | 15 | ||||
-rw-r--r-- | spec/features/todos/todos_filtering_spec.rb | 53 |
10 files changed, 208 insertions, 41 deletions
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 2f82fafc13a..d92c66b689d 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -7,15 +7,16 @@ describe "Admin Runners" do describe "Runners page" do before do - runner = FactoryGirl.create(:ci_runner) + runner = FactoryGirl.create(:ci_runner, contacted_at: Time.now) pipeline = FactoryGirl.create(:ci_pipeline) FactoryGirl.create(:ci_build, pipeline: pipeline, runner_id: runner.id) visit admin_runners_path end - it { page.has_text? "Manage Runners" } - it { page.has_text? "To register a new runner" } - it { page.has_text? "Runners with last contact less than a minute ago: 1" } + it 'has all necessary texts' do + expect(page).to have_text "To register a new Runner" + expect(page).to have_text "Runners with last contact less than a minute ago: 1" + end describe 'search' do before do @@ -27,8 +28,10 @@ describe "Admin Runners" do search_form.click_button 'Search' end - it { expect(page).to have_content("runner-foo") } - it { expect(page).not_to have_content("runner-bar") } + it 'shows correct runner' do + expect(page).to have_content("runner-foo") + expect(page).not_to have_content("runner-bar") + end end end @@ -46,8 +49,10 @@ describe "Admin Runners" do end describe 'projects' do - it { expect(page).to have_content(@project1.name_with_namespace) } - it { expect(page).to have_content(@project2.name_with_namespace) } + it 'contains project names' do + expect(page).to have_content(@project1.name_with_namespace) + expect(page).to have_content(@project2.name_with_namespace) + end end describe 'search' do @@ -57,8 +62,10 @@ describe "Admin Runners" do search_form.click_button 'Search' end - it { expect(page).to have_content(@project1.name_with_namespace) } - it { expect(page).not_to have_content(@project2.name_with_namespace) } + it 'contains name of correct project' do + expect(page).to have_content(@project1.name_with_namespace) + expect(page).not_to have_content(@project2.name_with_namespace) + end end describe 'enable/create' do diff --git a/spec/features/atom/dashboard_issues_spec.rb b/spec/features/atom/dashboard_issues_spec.rb index 4dd9548cfc5..21ee6cedbae 100644 --- a/spec/features/atom/dashboard_issues_spec.rb +++ b/spec/features/atom/dashboard_issues_spec.rb @@ -19,6 +19,17 @@ describe "Dashboard Issues Feed", feature: true do expect(body).to have_selector('title', text: "#{user.name} issues") end + it "renders atom feed with url parameters" do + visit issues_dashboard_path(:atom, private_token: user.private_token, state: 'opened', assignee_id: user.id) + + link = find('link[type="application/atom+xml"]') + params = CGI::parse(URI.parse(link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('state' => ['opened']) + expect(params).to include('assignee_id' => [user.id.to_s]) + end + context "issue with basic fields" do let!(:issue2) { create(:issue, author: user, assignee: user, project: project2, description: 'test desc') } diff --git a/spec/features/atom/issues_spec.rb b/spec/features/atom/issues_spec.rb index 09c140868fb..863412d18eb 100644 --- a/spec/features/atom/issues_spec.rb +++ b/spec/features/atom/issues_spec.rb @@ -3,10 +3,14 @@ require 'spec_helper' describe 'Issues Feed', feature: true do describe 'GET /issues' do let!(:user) { create(:user) } + let!(:group) { create(:group) } let!(:project) { create(:project) } let!(:issue) { create(:issue, author: user, project: project) } - before { project.team << [user, :developer] } + before do + project.team << [user, :developer] + group.add_developer(user) + end context 'when authenticated' do it 'renders atom feed' do @@ -33,5 +37,28 @@ describe 'Issues Feed', feature: true do expect(body).to have_selector('entry summary', text: issue.title) end end + + it "renders atom feed with url parameters for project issues" do + visit namespace_project_issues_path(project.namespace, project, + :atom, private_token: user.private_token, state: 'opened', assignee_id: user.id) + + link = find('link[type="application/atom+xml"]') + params = CGI::parse(URI.parse(link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('state' => ['opened']) + expect(params).to include('assignee_id' => [user.id.to_s]) + end + + it "renders atom feed with url parameters for group issues" do + visit issues_group_path(group, :atom, private_token: user.private_token, state: 'opened', assignee_id: user.id) + + link = find('link[type="application/atom+xml"]') + params = CGI::parse(URI.parse(link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('state' => ['opened']) + expect(params).to include('assignee_id' => [user.id.to_s]) + end end end diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index cd53a485ef4..44646ffc602 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -77,9 +77,11 @@ describe 'Commits' do visit ci_status_path(pipeline) end - it { expect(page).to have_content pipeline.sha[0..7] } - it { expect(page).to have_content pipeline.git_commit_message } - it { expect(page).to have_content pipeline.git_author_name } + it 'shows pipeline`s data' do + expect(page).to have_content pipeline.sha[0..7] + expect(page).to have_content pipeline.git_commit_message + expect(page).to have_content pipeline.git_author_name + end end context 'Download artifacts' do diff --git a/spec/features/dashboard_issues_spec.rb b/spec/features/dashboard_issues_spec.rb index 9b54b5301e5..b898f9bc64f 100644 --- a/spec/features/dashboard_issues_spec.rb +++ b/spec/features/dashboard_issues_spec.rb @@ -44,6 +44,22 @@ describe "Dashboard Issues filtering", feature: true, js: true do expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_selector('.issue', count: 1) end + + it 'updates atom feed link' do + visit_issues(milestone_title: '', assignee_id: user.id) + + link = find('.nav-controls a', text: 'Subscribe') + params = CGI::parse(URI.parse(link[:href]).query) + auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) + auto_discovery_params = CGI::parse(URI.parse(auto_discovery_link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('milestone_title' => ['']) + expect(params).to include('assignee_id' => [user.id.to_s]) + expect(auto_discovery_params).to include('private_token' => [user.private_token]) + expect(auto_discovery_params).to include('milestone_title' => ['']) + expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + end end def show_milestone_dropdown @@ -51,7 +67,7 @@ describe "Dashboard Issues filtering", feature: true, js: true do expect(page).to have_selector('.dropdown-content', visible: true) end - def visit_issues - visit issues_dashboard_path + def visit_issues(*args) + visit issues_dashboard_path(*args) end end diff --git a/spec/features/issues/filter_issues_spec.rb b/spec/features/issues/filter_issues_spec.rb index 78208aed46d..2798db92f0f 100644 --- a/spec/features/issues/filter_issues_spec.rb +++ b/spec/features/issues/filter_issues_spec.rb @@ -4,6 +4,7 @@ describe 'Filter issues', feature: true do include WaitForAjax let!(:project) { create(:project) } + let!(:group) { create(:group) } let!(:user) { create(:user)} let!(:milestone) { create(:milestone, project: project) } let!(:label) { create(:label, project: project) } @@ -11,6 +12,7 @@ describe 'Filter issues', feature: true do before do project.team << [user, :master] + group.add_developer(user) login_as(user) create(:issue, project: project) end @@ -347,4 +349,36 @@ describe 'Filter issues', feature: true do end end end + + it 'updates atom feed link for project issues' do + visit namespace_project_issues_path(project.namespace, project, milestone_title: '', assignee_id: user.id) + + link = find('.nav-controls a', text: 'Subscribe') + params = CGI::parse(URI.parse(link[:href]).query) + auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) + auto_discovery_params = CGI::parse(URI.parse(auto_discovery_link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('milestone_title' => ['']) + expect(params).to include('assignee_id' => [user.id.to_s]) + expect(auto_discovery_params).to include('private_token' => [user.private_token]) + expect(auto_discovery_params).to include('milestone_title' => ['']) + expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + end + + it 'updates atom feed link for group issues' do + visit issues_group_path(group, milestone_title: '', assignee_id: user.id) + + link = find('.nav-controls a', text: 'Subscribe') + params = CGI::parse(URI.parse(link[:href]).query) + auto_discovery_link = find('link[type="application/atom+xml"]', visible: false) + auto_discovery_params = CGI::parse(URI.parse(auto_discovery_link[:href]).query) + + expect(params).to include('private_token' => [user.private_token]) + expect(params).to include('milestone_title' => ['']) + expect(params).to include('assignee_id' => [user.id.to_s]) + expect(auto_discovery_params).to include('private_token' => [user.private_token]) + expect(auto_discovery_params).to include('milestone_title' => ['']) + expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + end end diff --git a/spec/features/merge_requests/edit_mr_spec.rb b/spec/features/merge_requests/edit_mr_spec.rb index c77e719c5df..c46bd8d449f 100644 --- a/spec/features/merge_requests/edit_mr_spec.rb +++ b/spec/features/merge_requests/edit_mr_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' feature 'Edit Merge Request', feature: true do let(:user) { create(:user) } let(:project) { create(:project, :public) } - let(:merge_request) { create(:merge_request, :with_diffs, source_project: project) } + let(:merge_request) { create(:merge_request, :simple, source_project: project) } before do project.team << [user, :master] @@ -28,5 +28,17 @@ feature 'Edit Merge Request', feature: true do expect(page).to have_content 'Someone edited the merge request the same time you did' end + + it 'allows to unselect "Remove source branch"' do + merge_request.update(merge_params: { 'force_remove_source_branch' => '1' }) + expect(merge_request.merge_params['force_remove_source_branch']).to be_truthy + + visit edit_namespace_project_merge_request_path(project.namespace, project, merge_request) + uncheck 'Remove source branch when merge request is accepted' + + click_button 'Save changes' + + expect(page).to have_content 'Remove source branch' + end end end diff --git a/spec/features/projects/builds_spec.rb b/spec/features/projects/builds_spec.rb index 63a23a14f20..a8022a5361f 100644 --- a/spec/features/projects/builds_spec.rb +++ b/spec/features/projects/builds_spec.rb @@ -79,12 +79,14 @@ describe "Builds" do click_link "Cancel running" end - it { expect(page).to have_selector('.nav-links li.active', text: 'All') } - it { expect(page).to have_content 'canceled' } - it { expect(page).to have_content @build.short_sha } - it { expect(page).to have_content @build.ref } - it { expect(page).to have_content @build.name } - it { expect(page).not_to have_link 'Cancel running' } + it 'shows all necessary content' do + expect(page).to have_selector('.nav-links li.active', text: 'All') + expect(page).to have_content 'canceled' + expect(page).to have_content @build.short_sha + expect(page).to have_content @build.ref + expect(page).to have_content @build.name + expect(page).not_to have_link 'Cancel running' + end end describe "GET /:project/builds/:id" do @@ -93,10 +95,12 @@ describe "Builds" do visit namespace_project_build_path(@project.namespace, @project, @build) end - it { expect(page.status_code).to eq(200) } - it { expect(page).to have_content @commit.sha[0..7] } - it { expect(page).to have_content @commit.git_commit_message } - it { expect(page).to have_content @commit.git_author_name } + it 'shows commit`s data' do + expect(page.status_code).to eq(200) + expect(page).to have_content @commit.sha[0..7] + expect(page).to have_content @commit.git_commit_message + expect(page).to have_content @commit.git_author_name + end end context "Build from other project" do @@ -167,7 +171,7 @@ describe "Builds" do describe 'Variables' do before do - @trigger_request = create :ci_trigger_request_with_variables + @trigger_request = create :ci_trigger_request_with_variables @build = create :ci_build, pipeline: @commit, trigger_request: @trigger_request visit namespace_project_build_path(@project.namespace, @project, @build) end @@ -176,14 +180,14 @@ describe "Builds" do expect(page).to have_css('.reveal-variables') expect(page).not_to have_css('.js-build-variable') expect(page).not_to have_css('.js-build-value') - + click_button 'Reveal Variables' expect(page).not_to have_css('.reveal-variables') expect(page).to have_selector('.js-build-variable', text: 'TRIGGER_KEY_1') expect(page).to have_selector('.js-build-value', text: 'TRIGGER_VALUE_1') end - end + end end describe "POST /:project/builds/:id/cancel" do @@ -194,9 +198,11 @@ describe "Builds" do click_link "Cancel" end - it { expect(page.status_code).to eq(200) } - it { expect(page).to have_content 'canceled' } - it { expect(page).to have_content 'Retry' } + it 'loads the page and shows all needed controls' do + expect(page.status_code).to eq(200) + expect(page).to have_content 'canceled' + expect(page).to have_content 'Retry' + end end context "Build from other project" do diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index e796ee570b7..09aa6758b5c 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -183,4 +183,19 @@ describe 'Edit Project Settings', feature: true do end end end + + # Regression spec for https://gitlab.com/gitlab-org/gitlab-ce/issues/24056 + describe 'project statistic visibility' do + let!(:project) { create(:project, :private) } + + before do + project.team << [member, :guest] + login_as(member) + visit namespace_project_path(project.namespace, project) + end + + it "does not show project statistic for guest" do + expect(page).not_to have_selector('.project-stats') + end + end end diff --git a/spec/features/todos/todos_filtering_spec.rb b/spec/features/todos/todos_filtering_spec.rb index b9e66243d84..d1f2bc78884 100644 --- a/spec/features/todos/todos_filtering_spec.rb +++ b/spec/features/todos/todos_filtering_spec.rb @@ -36,17 +36,54 @@ describe 'Dashboard > User filters todos', feature: true, js: true do expect(page).not_to have_content project_2.name_with_namespace end - it 'filters by author' do - click_button 'Author' - within '.dropdown-menu-author' do - fill_in 'Search authors', with: user_1.name - click_link user_1.name + context "Author filter" do + it 'filters by author' do + click_button 'Author' + + within '.dropdown-menu-author' do + fill_in 'Search authors', with: user_1.name + click_link user_1.name + end + + wait_for_ajax + + expect(find('.todos-list')).to have_content user_1.name + expect(find('.todos-list')).not_to have_content user_2.name end - wait_for_ajax + it "shows only authors of existing todos" do + click_button 'Author' + + within '.dropdown-menu-author' do + # It should contain two users + "Any Author" + expect(page).to have_selector('.dropdown-menu-user-link', count: 3) + expect(page).to have_content(user_1.name) + expect(page).to have_content(user_2.name) + end + end - expect(find('.todos-list')).to have_content user_1.name - expect(find('.todos-list')).not_to have_content user_2.name + it "shows only authors of existing done todos" do + user_3 = create :user + user_4 = create :user + create(:todo, user: user_1, author: user_3, project: project_1, target: issue, action: 1, state: :done) + create(:todo, user: user_1, author: user_4, project: project_2, target: merge_request, action: 2, state: :done) + + project_1.team << [user_3, :developer] + project_2.team << [user_4, :developer] + + visit dashboard_todos_path(state: 'done') + + click_button 'Author' + + within '.dropdown-menu-author' do + # It should contain two users + "Any Author" + expect(page).to have_selector('.dropdown-menu-user-link', count: 3) + expect(page).to have_content(user_3.name) + expect(page).to have_content(user_4.name) + expect(page).not_to have_content(user_1.name) + expect(page).not_to have_content(user_2.name) + end + end end it 'filters by type' do |