diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/frontend/fixtures | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/frontend/fixtures')
39 files changed, 153 insertions, 343 deletions
diff --git a/spec/frontend/fixtures/abuse_reports.rb b/spec/frontend/fixtures/abuse_reports.rb index 48b055fcda5..f5524a10033 100644 --- a/spec/frontend/fixtures/abuse_reports.rb +++ b/spec/frontend/fixtures/abuse_reports.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe Admin::AbuseReportsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers + include AdminModeHelper let(:admin) { create(:admin) } let!(:abuse_report) { create(:abuse_report) } @@ -18,6 +19,7 @@ RSpec.describe Admin::AbuseReportsController, '(JavaScript fixtures)', type: :co before do sign_in(admin) + enable_admin_mode!(admin) end it 'abuse_reports/abuse_reports_list.html' do diff --git a/spec/frontend/fixtures/admin_users.rb b/spec/frontend/fixtures/admin_users.rb index f068ada53e1..e0fecbdb1aa 100644 --- a/spec/frontend/fixtures/admin_users.rb +++ b/spec/frontend/fixtures/admin_users.rb @@ -5,12 +5,14 @@ require 'spec_helper' RSpec.describe Admin::UsersController, '(JavaScript fixtures)', type: :controller do include StubENV include JavaScriptFixturesHelpers + include AdminModeHelper let(:admin) { create(:admin) } before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) + enable_admin_mode!(admin) end render_views diff --git a/spec/frontend/fixtures/application_settings.rb b/spec/frontend/fixtures/application_settings.rb index 6156e6a43bc..ebccecb32ba 100644 --- a/spec/frontend/fixtures/application_settings.rb +++ b/spec/frontend/fixtures/application_settings.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe Admin::ApplicationSettingsController, '(JavaScript fixtures)', type: :controller do include StubENV include JavaScriptFixturesHelpers + include AdminModeHelper let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} @@ -13,6 +14,7 @@ RSpec.describe Admin::ApplicationSettingsController, '(JavaScript fixtures)', ty before do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') sign_in(admin) + enable_admin_mode!(admin) end render_views diff --git a/spec/frontend/fixtures/autocomplete_sources.rb b/spec/frontend/fixtures/autocomplete_sources.rb index 8858d69a939..9ff0f959c11 100644 --- a/spec/frontend/fixtures/autocomplete_sources.rb +++ b/spec/frontend/fixtures/autocomplete_sources.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Projects::AutocompleteSourcesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let_it_be(:admin) { create(:admin) } + let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group, name: 'frontend-fixtures') } let_it_be(:project) { create(:project, namespace: group, path: 'autocomplete-sources-project') } let_it_be(:issue) { create(:issue, project: project) } @@ -15,7 +15,8 @@ RSpec.describe Projects::AutocompleteSourcesController, '(JavaScript fixtures)', end before do - sign_in(admin) + group.add_owner(user) + sign_in(user) end it 'autocomplete_sources/labels.json' do diff --git a/spec/frontend/fixtures/blob.rb b/spec/frontend/fixtures/blob.rb index a365ee805af..b112886b2ca 100644 --- a/spec/frontend/fixtures/blob.rb +++ b/spec/frontend/fixtures/blob.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe Projects::BlobController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } + let(:user) { project.owner } render_views @@ -16,7 +16,7 @@ RSpec.describe Projects::BlobController, '(JavaScript fixtures)', type: :control end before do - sign_in(admin) + sign_in(user) allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon') end diff --git a/spec/frontend/fixtures/boards.rb b/spec/frontend/fixtures/boards.rb deleted file mode 100644 index 90e2ca4db63..00000000000 --- a/spec/frontend/fixtures/boards.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Projects::BoardsController, '(JavaScript fixtures)', type: :controller do - include JavaScriptFixturesHelpers - - let(:admin) { create(:admin) } - let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} - let(:project) { create(:project, :repository, namespace: namespace, path: 'boards-project') } - - render_views - - before(:all) do - clean_frontend_fixtures('boards/') - end - - before do - sign_in(admin) - end - - it 'boards/show.html' do - get(:index, params: { - namespace_id: project.namespace, - project_id: project - }) - - expect(response).to be_successful - end -end diff --git a/spec/frontend/fixtures/branches.rb b/spec/frontend/fixtures/branches.rb index df2d1af7ecf..f3b3633347d 100644 --- a/spec/frontend/fixtures/branches.rb +++ b/spec/frontend/fixtures/branches.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe 'Branches (JavaScript fixtures)' do include JavaScriptFixturesHelpers - let_it_be(:admin) { create(:admin) } let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let_it_be(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } + let_it_be(:user) { project.owner } before(:all) do clean_frontend_fixtures('branches/') @@ -22,7 +22,7 @@ RSpec.describe 'Branches (JavaScript fixtures)' do render_views before do - sign_in(admin) + sign_in(user) end it 'branches/new_branch.html' do @@ -44,7 +44,7 @@ RSpec.describe 'Branches (JavaScript fixtures)' do # - "master": default, protected # - "markdown": non-default, protected # - "many_files": non-default, not protected - get api("/projects/#{project.id}/repository/branches?search=ma", admin) + get api("/projects/#{project.id}/repository/branches?search=ma", user) expect(response).to be_successful end diff --git a/spec/frontend/fixtures/clusters.rb b/spec/frontend/fixtures/clusters.rb index d0940c7dc7f..b37aa137504 100644 --- a/spec/frontend/fixtures/clusters.rb +++ b/spec/frontend/fixtures/clusters.rb @@ -5,10 +5,10 @@ require 'spec_helper' RSpec.describe Projects::ClustersController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace) } let(:cluster) { create(:cluster, :provided_by_gcp, projects: [project]) } + let(:user) { project.owner } render_views @@ -17,7 +17,7 @@ RSpec.describe Projects::ClustersController, '(JavaScript fixtures)', type: :con end before do - sign_in(admin) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/commit.rb b/spec/frontend/fixtures/commit.rb index 9175a757b73..ff62a8286fc 100644 --- a/spec/frontend/fixtures/commit.rb +++ b/spec/frontend/fixtures/commit.rb @@ -6,14 +6,12 @@ RSpec.describe 'Commit (JavaScript fixtures)' do include JavaScriptFixturesHelpers let_it_be(:project) { create(:project, :repository) } - let_it_be(:user) { create(:user) } + let_it_be(:user) { project.owner } let_it_be(:commit) { project.commit("master") } before(:all) do clean_frontend_fixtures('commit/') clean_frontend_fixtures('api/commits/') - - project.add_maintainer(user) end before do diff --git a/spec/frontend/fixtures/deploy_keys.rb b/spec/frontend/fixtures/deploy_keys.rb index e87600e9d24..5c24c071792 100644 --- a/spec/frontend/fixtures/deploy_keys.rb +++ b/spec/frontend/fixtures/deploy_keys.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers + include AdminModeHelper let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} @@ -17,7 +18,10 @@ RSpec.describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :c end before do + # Using an admin for these fixtures because they are used for verifying a frontend + # component that would normally get its data from `Admin::DeployKeysController` sign_in(admin) + enable_admin_mode!(admin) end after do diff --git a/spec/frontend/fixtures/emojis.rb b/spec/frontend/fixtures/emojis.rb deleted file mode 100644 index b95c7632917..00000000000 --- a/spec/frontend/fixtures/emojis.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Emojis (JavaScript fixtures)', type: :request do - include JavaScriptFixturesHelpers - - before(:all) do - clean_frontend_fixtures('emojis/') - end - - it 'emojis/emojis.json' do |example| - get '/-/emojis/1/emojis.json' - - expect(response).to be_successful - end -end diff --git a/spec/frontend/fixtures/freeze_period.rb b/spec/frontend/fixtures/freeze_period.rb index 193bd0c3ef2..09e4f969e1d 100644 --- a/spec/frontend/fixtures/freeze_period.rb +++ b/spec/frontend/fixtures/freeze_period.rb @@ -4,10 +4,10 @@ require 'spec_helper' RSpec.describe 'Freeze Periods (JavaScript fixtures)' do include JavaScriptFixturesHelpers - include Ci::PipelineSchedulesHelper + include TimeZoneHelper - let_it_be(:admin) { create(:admin) } let_it_be(:project) { create(:project, :repository, path: 'freeze-periods-project') } + let_it_be(:user) { project.owner } before(:all) do clean_frontend_fixtures('api/freeze-periods/') @@ -34,16 +34,18 @@ RSpec.describe 'Freeze Periods (JavaScript fixtures)' do create(:ci_freeze_period, project: project, freeze_start: '0 12 * * 1-5', freeze_end: '0 1 5 * *', cron_timezone: 'Etc/UTC') create(:ci_freeze_period, project: project, freeze_start: '0 12 * * 1-5', freeze_end: '0 16 * * 6', cron_timezone: 'Europe/Berlin') - get api("/projects/#{project.id}/freeze_periods", admin) + get api("/projects/#{project.id}/freeze_periods", user) expect(response).to be_successful end end - describe Ci::PipelineSchedulesHelper, '(JavaScript fixtures)' do + describe TimeZoneHelper, '(JavaScript fixtures)' do let(:response) { timezone_data.to_json } it 'api/freeze-periods/timezone_data.json' do + # Looks empty but does things + # More info: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38525/diffs#note_391048415 end end end diff --git a/spec/frontend/fixtures/groups.rb b/spec/frontend/fixtures/groups.rb index 9f0b2c73c93..42aad9f187e 100644 --- a/spec/frontend/fixtures/groups.rb +++ b/spec/frontend/fixtures/groups.rb @@ -5,20 +5,20 @@ require 'spec_helper' RSpec.describe 'Groups (JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } + let(:user) { create(:user) } let(:group) { create(:group, name: 'frontend-fixtures-group', runners_token: 'runnerstoken:intabulasreferre')} - render_views - before(:all) do clean_frontend_fixtures('groups/') end before do - group.add_maintainer(admin) - sign_in(admin) + group.add_owner(user) + sign_in(user) end + render_views + describe GroupsController, '(JavaScript fixtures)', type: :controller do it 'groups/edit.html' do get :edit, params: { id: group } diff --git a/spec/frontend/fixtures/issues.rb b/spec/frontend/fixtures/issues.rb index baea87be45f..a027247bd0d 100644 --- a/spec/frontend/fixtures/issues.rb +++ b/spec/frontend/fixtures/issues.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin, feed_token: 'feedtoken:coldfeed') } + let(:user) { create(:user, feed_token: 'feedtoken:coldfeed') } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'issues-project') } @@ -16,9 +16,8 @@ RSpec.describe Projects::IssuesController, '(JavaScript fixtures)', type: :contr end before do - stub_feature_flags(vue_issue_header: false) - - sign_in(admin) + project.add_maintainer(user) + sign_in(user) end after do @@ -42,17 +41,6 @@ RSpec.describe Projects::IssuesController, '(JavaScript fixtures)', type: :contr render_issue(create(:closed_issue, project: project)) end - it 'issues/issue-with-task-list.html' do - issue = create(:issue, project: project, description: '- [ ] Task List Item') - render_issue(issue) - end - - it 'issues/issue_with_comment.html' do - issue = create(:issue, project: project) - create(:note, project: project, noteable: issue, note: '- [ ] Task List Item').save - render_issue(issue) - end - it 'issues/issue_list.html' do create(:issue, project: project) diff --git a/spec/frontend/fixtures/jobs.rb b/spec/frontend/fixtures/jobs.rb index 64197a62301..22179c790bd 100644 --- a/spec/frontend/fixtures/jobs.rb +++ b/spec/frontend/fixtures/jobs.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'builds-project') } + let(:user) { project.owner } let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id) } let!(:build_with_artifacts) { create(:ci_build, :success, :artifacts, :trace_artifact, pipeline: pipeline, stage: 'test', artifacts_expire_at: Time.now + 18.months) } let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline, stage: 'build') } @@ -22,28 +22,17 @@ RSpec.describe Projects::JobsController, '(JavaScript fixtures)', type: :control render_views before(:all) do - clean_frontend_fixtures('builds/') clean_frontend_fixtures('jobs/') end before do - sign_in(admin) + sign_in(user) end after do remove_repository(project) end - it 'builds/build-with-artifacts.html' do - get :show, params: { - namespace_id: project.namespace.to_param, - project_id: project, - id: build_with_artifacts.to_param - } - - expect(response).to be_successful - end - it 'jobs/delayed.json' do get :show, params: { namespace_id: project.namespace.to_param, diff --git a/spec/frontend/fixtures/labels.rb b/spec/frontend/fixtures/labels.rb index 2b7babb2e52..d7ca2aff18c 100644 --- a/spec/frontend/fixtures/labels.rb +++ b/spec/frontend/fixtures/labels.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'Labels (JavaScript fixtures)' do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } + let(:user) { create(:user) } let(:group) { create(:group, name: 'frontend-fixtures-group' )} let(:project) { create(:project_empty_repo, namespace: group, path: 'labels-project') } @@ -25,28 +25,10 @@ RSpec.describe 'Labels (JavaScript fixtures)' do remove_repository(project) end - describe Groups::LabelsController, '(JavaScript fixtures)', type: :controller do - render_views - - before do - sign_in(admin) - end - - it 'labels/group_labels.json' do - get :index, params: { - group_id: group - }, format: 'json' - - expect(response).to be_successful - end - end - describe API::Helpers::LabelHelpers, type: :request do include JavaScriptFixturesHelpers include ApiHelpers - let(:user) { create(:user) } - before do group.add_owner(user) end @@ -62,7 +44,8 @@ RSpec.describe 'Labels (JavaScript fixtures)' do render_views before do - sign_in(admin) + group.add_owner(user) + sign_in(user) end it 'labels/project_labels.json' do diff --git a/spec/frontend/fixtures/merge_requests.rb b/spec/frontend/fixtures/merge_requests.rb index 6f281b26e6d..acce3891ada 100644 --- a/spec/frontend/fixtures/merge_requests.rb +++ b/spec/frontend/fixtures/merge_requests.rb @@ -5,15 +5,15 @@ require 'spec_helper' RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') } + let(:user) { project.owner } # rubocop: disable Layout/TrailingWhitespace let(:description) do <<~MARKDOWN.strip_heredoc - [ ] Task List Item - - [ ] + - [ ] - [ ] Task List Item 2 MARKDOWN end @@ -55,7 +55,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: end before do - sign_in(admin) + sign_in(user) allow(Discussion).to receive(:build_discussion_id).and_return(['discussionid:ceterumcenseo']) end @@ -64,7 +64,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: end it 'merge_requests/merge_request_of_current_user.html' do - merge_request.update(author: admin) + merge_request.update(author: user) render_merge_request(merge_request) end @@ -75,38 +75,20 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: render_merge_request(merge_request) end - it 'merge_requests/merged_merge_request.html' do - expect_next_instance_of(MergeRequest) do |merge_request| - allow(merge_request).to receive(:source_branch_exists?).and_return(true) - allow(merge_request).to receive(:can_remove_source_branch?).and_return(true) - end - render_merge_request(merged_merge_request) - end - it 'merge_requests/diff_comment.html' do - create(:diff_note_on_merge_request, project: project, author: admin, position: position, noteable: merge_request) - create(:note_on_merge_request, author: admin, project: project, noteable: merge_request) + create(:diff_note_on_merge_request, project: project, author: user, position: position, noteable: merge_request) + create(:note_on_merge_request, author: user, project: project, noteable: merge_request) render_merge_request(merge_request) end - it 'merge_requests/merge_request_with_comment.html' do - create(:note_on_merge_request, author: admin, project: project, noteable: merge_request, note: '- [ ] Task List Item') - render_merge_request(merge_request) - end - - it 'merge_requests/discussions.json' do - create(:discussion_note_on_merge_request, project: project, author: admin, position: position, noteable: merge_request) - render_discussions_json(merge_request) - end - it 'merge_requests/diff_discussion.json' do - create(:diff_note_on_merge_request, project: project, author: admin, position: position, noteable: merge_request) + create(:diff_note_on_merge_request, project: project, author: user, position: position, noteable: merge_request) render_discussions_json(merge_request) end it 'merge_requests/resolved_diff_discussion.json' do - note = create(:discussion_note_on_merge_request, :resolved, project: project, author: admin, position: position, noteable: merge_request) - create(:system_note, project: project, author: admin, noteable: merge_request, discussion_id: note.discussion.id) + note = create(:discussion_note_on_merge_request, :resolved, project: project, author: user, position: position, noteable: merge_request) + create(:system_note, project: project, author: user, noteable: merge_request, discussion_id: note.discussion.id) render_discussions_json(merge_request) end @@ -129,7 +111,7 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: context 'with mentions' do let(:group) { create(:group) } - let(:description) { "@#{group.full_path} @all @#{admin.username}" } + let(:description) { "@#{group.full_path} @all @#{user.username}" } it 'merge_requests/merge_request_with_mentions.html' do render_merge_request(merge_request) diff --git a/spec/frontend/fixtures/merge_requests_diffs.rb b/spec/frontend/fixtures/merge_requests_diffs.rb index 63bd02d0fbd..6e07ef679f5 100644 --- a/spec/frontend/fixtures/merge_requests_diffs.rb +++ b/spec/frontend/fixtures/merge_requests_diffs.rb @@ -5,9 +5,9 @@ require 'spec_helper' RSpec.describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'merge-requests-project') } + let(:user) { project.owner } let(:merge_request) { create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item') } let(:path) { "files/ruby/popen.rb" } let(:position) do @@ -25,7 +25,7 @@ RSpec.describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)' end before do - sign_in(admin) + sign_in(user) end after do @@ -40,18 +40,6 @@ RSpec.describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)' render_merge_request(merge_request, commit_id: project.commit.sha) end - it 'merge_request_diffs/inline_changes_tab_with_comments.json' do - create(:diff_note_on_merge_request, project: project, author: admin, position: position, noteable: merge_request) - create(:note_on_merge_request, author: admin, project: project, noteable: merge_request) - render_merge_request(merge_request) - end - - it 'merge_request_diffs/parallel_changes_tab_with_comments.json' do - create(:diff_note_on_merge_request, project: project, author: admin, position: position, noteable: merge_request) - create(:note_on_merge_request, author: admin, project: project, noteable: merge_request) - render_merge_request(merge_request, view: 'parallel') - end - private def render_merge_request(merge_request, view: 'inline', **extra_params) diff --git a/spec/frontend/fixtures/pipeline_schedules.rb b/spec/frontend/fixtures/pipeline_schedules.rb index e47bb25ec0a..a7d43fdbe62 100644 --- a/spec/frontend/fixtures/pipeline_schedules.rb +++ b/spec/frontend/fixtures/pipeline_schedules.rb @@ -5,11 +5,11 @@ require 'spec_helper' RSpec.describe Projects::PipelineSchedulesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :public, :repository) } - let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: admin) } - let!(:pipeline_schedule_populated) { create(:ci_pipeline_schedule, project: project, owner: admin) } + let(:user) { project.owner } + let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) } + let!(:pipeline_schedule_populated) { create(:ci_pipeline_schedule, project: project, owner: user) } let!(:pipeline_schedule_variable1) { create(:ci_pipeline_schedule_variable, key: 'foo', value: 'foovalue', pipeline_schedule: pipeline_schedule_populated) } let!(:pipeline_schedule_variable2) { create(:ci_pipeline_schedule_variable, key: 'bar', value: 'barvalue', pipeline_schedule: pipeline_schedule_populated) } @@ -20,7 +20,7 @@ RSpec.describe Projects::PipelineSchedulesController, '(JavaScript fixtures)', t end before do - sign_in(admin) + sign_in(user) end it 'pipeline_schedules/edit.html' do diff --git a/spec/frontend/fixtures/pipelines.rb b/spec/frontend/fixtures/pipelines.rb index 93e2c19fc27..4270e38afcb 100644 --- a/spec/frontend/fixtures/pipelines.rb +++ b/spec/frontend/fixtures/pipelines.rb @@ -5,7 +5,6 @@ require 'spec_helper' RSpec.describe Projects::PipelinesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'pipelines-project') } let(:commit) { create(:commit, project: project) } @@ -22,7 +21,7 @@ RSpec.describe Projects::PipelinesController, '(JavaScript fixtures)', type: :co end before do - sign_in(admin) + sign_in(user) end it 'pipelines/pipelines.json' do diff --git a/spec/frontend/fixtures/projects.rb b/spec/frontend/fixtures/projects.rb index d0cedb0ef86..aa2f7dbed36 100644 --- a/spec/frontend/fixtures/projects.rb +++ b/spec/frontend/fixtures/projects.rb @@ -7,11 +7,11 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do runners_token = 'runnerstoken:intabulasreferre' - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, namespace: namespace, path: 'builds-project', runners_token: runners_token) } let(:project_with_repo) { create(:project, :repository, description: 'Code and stuff') } let(:project_variable_populated) { create(:project, namespace: namespace, path: 'builds-project2', runners_token: runners_token) } + let(:user) { project.owner } render_views @@ -20,8 +20,8 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do end before do - project.add_maintainer(admin) - sign_in(admin) + project_with_repo.add_maintainer(user) + sign_in(user) allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon') end @@ -30,15 +30,6 @@ RSpec.describe 'Projects (JavaScript fixtures)', type: :controller do end describe ProjectsController, '(JavaScript fixtures)', type: :controller do - it 'projects/dashboard.html' do - get :show, params: { - namespace_id: project.namespace.to_param, - id: project - } - - expect(response).to be_successful - end - it 'projects/overview.html' do get :show, params: { namespace_id: project_with_repo.namespace.to_param, diff --git a/spec/frontend/fixtures/prometheus_service.rb b/spec/frontend/fixtures/prometheus_service.rb index 8c923d91d08..3a59ecf3868 100644 --- a/spec/frontend/fixtures/prometheus_service.rb +++ b/spec/frontend/fixtures/prometheus_service.rb @@ -5,10 +5,10 @@ require 'spec_helper' RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') } let!(:service) { create(:prometheus_service, project: project) } + let(:user) { project.owner } render_views @@ -17,7 +17,7 @@ RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :con end before do - sign_in(admin) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/raw.rb b/spec/frontend/fixtures/raw.rb index 337067121d0..cf51f2389bc 100644 --- a/spec/frontend/fixtures/raw.rb +++ b/spec/frontend/fixtures/raw.rb @@ -10,19 +10,17 @@ RSpec.describe 'Raw files', '(JavaScript fixtures)' do let(:response) { @blob.data.force_encoding('UTF-8') } before(:all) do - clean_frontend_fixtures('blob/balsamiq/') clean_frontend_fixtures('blob/notebook/') clean_frontend_fixtures('blob/pdf/') + clean_frontend_fixtures('blob/text/') + clean_frontend_fixtures('blob/binary/') + clean_frontend_fixtures('blob/images/') end after do remove_repository(project) end - it 'blob/balsamiq/test.bmpr' do - @blob = project.repository.blob_at('b89b56d79', 'files/images/balsamiq.bmpr') - end - it 'blob/notebook/basic.json' do @blob = project.repository.blob_at('6d85bb69', 'files/ipython/basic.ipynb') end @@ -38,4 +36,16 @@ RSpec.describe 'Raw files', '(JavaScript fixtures)' do it 'blob/pdf/test.pdf' do @blob = project.repository.blob_at('e774ebd33', 'files/pdf/test.pdf') end + + it 'blob/text/README.md' do + @blob = project.repository.blob_at('e774ebd33', 'README.md') + end + + it 'blob/images/logo-white.png' do + @blob = project.repository.blob_at('e774ebd33', 'files/images/logo-white.png') + end + + it 'blob/binary/Gemfile.zip' do + @blob = project.repository.blob_at('e774ebd33', 'Gemfile.zip') + end end diff --git a/spec/frontend/fixtures/search.rb b/spec/frontend/fixtures/search.rb index 7819d0774a7..264ce7d010c 100644 --- a/spec/frontend/fixtures/search.rb +++ b/spec/frontend/fixtures/search.rb @@ -7,7 +7,7 @@ RSpec.describe SearchController, '(JavaScript fixtures)', type: :controller do render_views - let_it_be(:user) { create(:admin) } + let_it_be(:user) { create(:user) } before(:all) do clean_frontend_fixtures('search/') @@ -66,9 +66,13 @@ RSpec.describe SearchController, '(JavaScript fixtures)', type: :controller do offset: 0) end + before do + project.add_developer(user) + end + it 'search/blob_search_result.html' do - expect_next_instance_of(SearchService) do |search_service| - expect(search_service).to receive(:search_objects).and_return(blobs) + allow_next_instance_of(SearchServicePresenter) do |search_service| + allow(search_service).to receive(:search_objects).and_return(blobs) end get :show, params: { diff --git a/spec/frontend/fixtures/services.rb b/spec/frontend/fixtures/services.rb index 43230301296..7472af802f3 100644 --- a/spec/frontend/fixtures/services.rb +++ b/spec/frontend/fixtures/services.rb @@ -5,10 +5,10 @@ require 'spec_helper' RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'services-project') } let!(:service) { create(:custom_issue_tracker_service, project: project) } + let(:user) { project.owner } render_views @@ -17,7 +17,7 @@ RSpec.describe Projects::ServicesController, '(JavaScript fixtures)', type: :con end before do - sign_in(admin) + sign_in(user) end after do diff --git a/spec/frontend/fixtures/snippet.rb b/spec/frontend/fixtures/snippet.rb index 2e67a2ecfe3..5211d52f374 100644 --- a/spec/frontend/fixtures/snippet.rb +++ b/spec/frontend/fixtures/snippet.rb @@ -5,10 +5,10 @@ require 'spec_helper' RSpec.describe SnippetsController, '(JavaScript fixtures)', type: :controller do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') } - let(:snippet) { create(:personal_snippet, :public, title: 'snippet.md', content: '# snippet', file_name: 'snippet.md', author: admin) } + let(:user) { project.owner } + let(:snippet) { create(:personal_snippet, :public, title: 'snippet.md', content: '# snippet', file_name: 'snippet.md', author: user) } render_views @@ -17,7 +17,7 @@ RSpec.describe SnippetsController, '(JavaScript fixtures)', type: :controller do end before do - sign_in(admin) + sign_in(user) allow(Discussion).to receive(:build_discussion_id).and_return(['discussionid:ceterumcenseo']) end @@ -26,7 +26,7 @@ RSpec.describe SnippetsController, '(JavaScript fixtures)', type: :controller do end it 'snippets/show.html' do - create(:discussion_note_on_project_snippet, noteable: snippet, project: project, author: admin, note: '- [ ] Task List Item') + create(:discussion_note_on_project_snippet, noteable: snippet, project: project, author: user, note: '- [ ] Task List Item') get(:show, params: { id: snippet.to_param }) diff --git a/spec/frontend/fixtures/static/balsamiq_viewer.html b/spec/frontend/fixtures/static/balsamiq_viewer.html deleted file mode 100644 index cdd723d1a84..00000000000 --- a/spec/frontend/fixtures/static/balsamiq_viewer.html +++ /dev/null @@ -1 +0,0 @@ -<div class="file-content balsamiq-viewer" data-endpoint="/test" id="js-balsamiq-viewer"></div> diff --git a/spec/frontend/fixtures/static/create_item_dropdown.html b/spec/frontend/fixtures/static/create_item_dropdown.html index d2d38370092..aac7d3397ce 100644 --- a/spec/frontend/fixtures/static/create_item_dropdown.html +++ b/spec/frontend/fixtures/static/create_item_dropdown.html @@ -1,11 +1,42 @@ <div class="js-create-item-dropdown-fixture-root"> -<input name="variable[environment]" type="hidden"> -<div class="dropdown "><button class="dropdown-menu-toggle js-dropdown-menu-toggle" type="button" data-toggle="dropdown"><span class="dropdown-toggle-text ">some label</span><i aria-hidden="true" data-hidden="true" class="fa fa-chevron-down"></i></button><div class="dropdown-menu dropdown-select dropdown-menu-selectable"><div class="dropdown-input"><input type="search" id="" class="dropdown-input-field" autocomplete="off" /><i aria-hidden="true" data-hidden="true" class="fa fa-search dropdown-input-search"></i><i aria-hidden="true" data-hidden="true" role="button" class="fa fa-times dropdown-input-clear js-dropdown-input-clear"></i></div><div class="dropdown-content js-dropdown-content"></div><div class="dropdown-footer"><ul class="dropdown-footer-list"> -<li> -<button class="dropdown-create-new-item-button js-dropdown-create-new-item"> -Create wildcard -<code></code> -</button> -</li> -</ul> -</div><div class="dropdown-loading"><i aria-hidden="true" data-hidden="true" class="fa fa-spinner fa-spin"></i></div></div></div></div> + <input name="variable[environment]" type="hidden" /> + <div class="dropdown "> + <button + class="dropdown-menu-toggle js-dropdown-menu-toggle" + type="button" + data-toggle="dropdown" + > + <span class="dropdown-toggle-text ">some label</span + ><i aria-hidden="true" data-hidden="true" class="fa fa-chevron-down"></i> + </button> + <div class="dropdown-menu dropdown-select dropdown-menu-selectable"> + <div class="dropdown-input"> + <input type="search" id="" class="dropdown-input-field" autocomplete="off" /><i + aria-hidden="true" + data-hidden="true" + class="fa fa-search dropdown-input-search" + ></i + ><i + aria-hidden="true" + data-hidden="true" + role="button" + class="fa fa-times dropdown-input-clear js-dropdown-input-clear" + ></i> + </div> + <div class="dropdown-content js-dropdown-content"></div> + <div class="dropdown-footer"> + <ul class="dropdown-footer-list"> + <li> + <button class="dropdown-create-new-item-button js-dropdown-create-new-item"> + Create wildcard + <code></code> + </button> + </li> + </ul> + </div> + <div class="dropdown-loading"> + <span aria-hidden="true" data-hidden="true" class="gl-spinner"></span> + </div> + </div> + </div> +</div> diff --git a/spec/frontend/fixtures/static/deprecated_jquery_dropdown.html b/spec/frontend/fixtures/static/deprecated_jquery_dropdown.html index 3db9bafcb9f..41e7170b5c6 100644 --- a/spec/frontend/fixtures/static/deprecated_jquery_dropdown.html +++ b/spec/frontend/fixtures/static/deprecated_jquery_dropdown.html @@ -32,7 +32,7 @@ </div> <div class="dropdown-content"></div> <div class="dropdown-loading"> - <i class="fa fa-spinner fa-spin"></i> + <span class="gl-spinner"></span> </div> </div> </div> diff --git a/spec/frontend/fixtures/static/environments/table.html b/spec/frontend/fixtures/static/environments/table.html deleted file mode 100644 index 417af564ff1..00000000000 --- a/spec/frontend/fixtures/static/environments/table.html +++ /dev/null @@ -1,15 +0,0 @@ -<table> -<thead> -<tr> -<th>Environment</th> -<th>Last deployment</th> -<th>Job</th> -<th>Commit</th> -<th></th> -<th></th> -</tr> -</thead> -<tbody> -<tr id="environment-row"></tr> -</tbody> -</table> diff --git a/spec/frontend/fixtures/static/issuable_filter.html b/spec/frontend/fixtures/static/issuable_filter.html deleted file mode 100644 index 06b70fb43f1..00000000000 --- a/spec/frontend/fixtures/static/issuable_filter.html +++ /dev/null @@ -1,9 +0,0 @@ -<form action="/user/project/issues?scope=all&state=closed" class="js-filter-form"> -<input id="utf8" name="utf8" value="✓"> -<input id="check-all-issues" name="check-all-issues"> -<input id="search" name="search"> -<input id="author_id" name="author_id"> -<input id="assignee_id" name="assignee_id"> -<input id="milestone_title" name="milestone_title"> -<input id="label_name" name="label_name"> -</form> diff --git a/spec/frontend/fixtures/static/issue_with_mermaid_graph.html b/spec/frontend/fixtures/static/issue_with_mermaid_graph.html deleted file mode 100644 index e9fa75c8ba9..00000000000 --- a/spec/frontend/fixtures/static/issue_with_mermaid_graph.html +++ /dev/null @@ -1,82 +0,0 @@ -<div class="description" updated-at=""> - <div class="md issue-realtime-trigger-pulse"> - <svg - id="mermaid-1587752414912" - width="100%" - xmlns="http://www.w3.org/2000/svg" - style="max-width: 185.35000610351562px;" - viewBox="0 0 185.35000610351562 50.5" - class="mermaid" - > - <g transform="translate(0, 0)"> - <g class="output"> - <g class="clusters"></g> - <g class="edgePaths"></g> - <g class="edgeLabels"></g> - <g class="nodes"> - <g - class="node js-issuable-buttons btn-close clickable" - style="opacity: 1;" - id="A" - transform="translate(92.67500305175781,25.25)" - title="click to PUT" - > - <a - class="js-issuable-buttons btn-close clickable" - href="https://invalid" - rel="noopener" - > - <rect - rx="0" - ry="0" - x="-84.67500305175781" - y="-17.25" - width="169.35000610351562" - height="34.5" - class="label-container" - ></rect> - <g class="label" transform="translate(0,0)"> - <g transform="translate(-74.67500305175781,-7.25)"> - <text style=""> - <tspan xml:space="preserve" dy="1em" x="1">Click to send a PUT request</tspan> - </text> - </g> - </g> - </a> - </g> - </g> - </g> - </g> - <text class="source" display="none"> - Click to send a PUT request - </text> - </svg> - </div> - <textarea - data-update-url="/h5bp/html5-boilerplate/-/issues/35.json" - dir="auto" - class="hidden js-task-list-field" - ></textarea> - <div class="modal-open recaptcha-modal js-recaptcha-modal" style="display: none;"> - <div role="dialog" tabindex="-1" class="modal d-block"> - <div role="document" class="modal-dialog"> - <div class="modal-content"> - <div class="modal-header"> - <h4 class="modal-title float-left">Please solve the reCAPTCHA</h4> - <button type="button" data-dismiss="modal" aria-label="Close" class="close float-right"> - <span aria-hidden="true">×</span> - </button> - </div> - <div class="modal-body"> - <div> - <p>We want to be sure it is you, please confirm you are not a robot.</p> - <div></div> - </div> - </div> - <!----> - </div> - </div> - </div> - <div class="modal-backdrop fade show"></div> - </div> -</div> diff --git a/spec/frontend/fixtures/static/merge_requests_show.html b/spec/frontend/fixtures/static/merge_requests_show.html deleted file mode 100644 index 87e36c9f315..00000000000 --- a/spec/frontend/fixtures/static/merge_requests_show.html +++ /dev/null @@ -1,15 +0,0 @@ -<a class="btn-close"></a> -<div class="detail-page-description"> -<div class="description js-task-list-container"> -<div class="md"> -<ul class="task-list"> -<li class="task-list-item"> -<input class="task-list-item-checkbox" type="checkbox"> -Task List Item -</li> -</ul> -<textarea class="js-task-list-field">- [ ] Task List Item</textarea> -</div> -</div> -</div> -<form action="/foo" class="js-issuable-update"></form> diff --git a/spec/frontend/fixtures/static/mini_dropdown_graph.html b/spec/frontend/fixtures/static/mini_dropdown_graph.html index cb55698b709..cde811d4f52 100644 --- a/spec/frontend/fixtures/static/mini_dropdown_graph.html +++ b/spec/frontend/fixtures/static/mini_dropdown_graph.html @@ -7,7 +7,7 @@ <ul></ul> </li> <li class="js-builds-dropdown-loading hidden"> - <span class="fa fa-spinner"></span> + <span class="gl-spinner"></span> </li> </ul> </div> diff --git a/spec/frontend/fixtures/static/pipelines.html b/spec/frontend/fixtures/static/pipelines.html deleted file mode 100644 index 42333f94f2f..00000000000 --- a/spec/frontend/fixtures/static/pipelines.html +++ /dev/null @@ -1,3 +0,0 @@ -<div> -<div data-can-create-pipeline="true" data-ci-lint-path="foo" data-empty-state-svg-path="foo" data-endpoint="foo" data-error-state-svg-path="foo" data-has-ci="foo" data-help-auto-devops-path="foo" data-help-page-path="foo" data-new-pipeline-path="foo" data-reset-cache-path="foo" id="pipelines-list-vue"></div> -</div> diff --git a/spec/frontend/fixtures/static/project_select_combo_button.html b/spec/frontend/fixtures/static/project_select_combo_button.html index 50c826051c0..f13f9075706 100644 --- a/spec/frontend/fixtures/static/project_select_combo_button.html +++ b/spec/frontend/fixtures/static/project_select_combo_button.html @@ -1,9 +1,9 @@ <div class="project-item-select-holder"> -<input class="project-item-select" data-group-id="12345" data-relative-path="issues/new"> -<a class="new-project-item-link" data-label="New issue" data-type="issues" href=""> -<i class="fa fa-spinner spin"></i> -</a> -<a class="new-project-item-select-button"> -<i class="fa fa-caret-down"></i> -</a> + <input class="project-item-select" data-group-id="12345" data-relative-path="issues/new" /> + <a class="new-project-item-link" data-label="New issue" data-type="issues" href=""> + <span class="gl-spinner"></span> + </a> + <a class="new-project-item-select-button"> + <i class="fa fa-caret-down"></i> + </a> </div> diff --git a/spec/frontend/fixtures/static/whats_new_notification.html b/spec/frontend/fixtures/static/whats_new_notification.html new file mode 100644 index 00000000000..30d5eea91cc --- /dev/null +++ b/spec/frontend/fixtures/static/whats_new_notification.html @@ -0,0 +1,6 @@ +<div class='whats-new-notification-fixture-root'> + <div class='app' data-storage-key='storage-key'></div> + <div class='header-help'> + <div class='js-whats-new-notification-count'></div> + </div> +</div> diff --git a/spec/frontend/fixtures/tags.rb b/spec/frontend/fixtures/tags.rb index b2a5429fac8..9483f0a4492 100644 --- a/spec/frontend/fixtures/tags.rb +++ b/spec/frontend/fixtures/tags.rb @@ -5,8 +5,8 @@ require 'spec_helper' RSpec.describe 'Tags (JavaScript fixtures)' do include JavaScriptFixturesHelpers - let_it_be(:admin) { create(:admin) } let_it_be(:project) { create(:project, :repository, path: 'tags-project') } + let_it_be(:user) { project.owner } before(:all) do clean_frontend_fixtures('api/tags/') @@ -20,7 +20,7 @@ RSpec.describe 'Tags (JavaScript fixtures)' do include ApiHelpers it 'api/tags/tags.json' do - get api("/projects/#{project.id}/repository/tags", admin) + get api("/projects/#{project.id}/repository/tags", user) expect(response).to be_successful end diff --git a/spec/frontend/fixtures/todos.rb b/spec/frontend/fixtures/todos.rb index 399be272e9b..985afafe50e 100644 --- a/spec/frontend/fixtures/todos.rb +++ b/spec/frontend/fixtures/todos.rb @@ -5,13 +5,13 @@ require 'spec_helper' RSpec.describe 'Todos (JavaScript fixtures)' do include JavaScriptFixturesHelpers - let(:admin) { create(:admin) } let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project_empty_repo, namespace: namespace, path: 'todos-project') } + let(:user) { project.owner } let(:issue_1) { create(:issue, title: 'issue_1', project: project) } - let!(:todo_1) { create(:todo, user: admin, project: project, target: issue_1, created_at: 5.hours.ago) } + let!(:todo_1) { create(:todo, user: user, project: project, target: issue_1, created_at: 5.hours.ago) } let(:issue_2) { create(:issue, title: 'issue_2', project: project) } - let!(:todo_2) { create(:todo, :done, user: admin, project: project, target: issue_2, created_at: 50.hours.ago) } + let!(:todo_2) { create(:todo, :done, user: user, project: project, target: issue_2, created_at: 50.hours.ago) } before(:all) do clean_frontend_fixtures('todos/') @@ -25,7 +25,7 @@ RSpec.describe 'Todos (JavaScript fixtures)' do render_views before do - sign_in(admin) + sign_in(user) end it 'todos/todos.html' do @@ -39,7 +39,7 @@ RSpec.describe 'Todos (JavaScript fixtures)' do render_views before do - sign_in(admin) + sign_in(user) end it 'todos/todos.json' do |