Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-06-20 13:43:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-06-20 13:43:29 +0300
commit3b1af5cc7ed2666ff18b718ce5d30fa5a2756674 (patch)
tree3bc4a40e0ee51ec27eabf917c537033c0c5b14d4 /spec/frontend/fixtures
parent9bba14be3f2c211bf79e15769cd9b77bc73a13bc (diff)
Add latest changes from gitlab-org/gitlab@16-1-stable-eev16.1.0-rc42
Diffstat (limited to 'spec/frontend/fixtures')
-rw-r--r--spec/frontend/fixtures/merge_requests.rb4
-rw-r--r--spec/frontend/fixtures/pipeline_details.rb38
-rw-r--r--spec/frontend/fixtures/pipeline_header.rb118
-rw-r--r--spec/frontend/fixtures/project.rb51
-rw-r--r--spec/frontend/fixtures/runner.rb19
-rw-r--r--spec/frontend/fixtures/startup_css.rb3
-rw-r--r--spec/frontend/fixtures/static/whats_new_notification.html1
-rw-r--r--spec/frontend/fixtures/users.rb42
8 files changed, 267 insertions, 9 deletions
diff --git a/spec/frontend/fixtures/merge_requests.rb b/spec/frontend/fixtures/merge_requests.rb
index b6f6d149756..a1896a6470b 100644
--- a/spec/frontend/fixtures/merge_requests.rb
+++ b/spec/frontend/fixtures/merge_requests.rb
@@ -114,6 +114,10 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type:
let(:group) { create(:group) }
let(:description) { "@#{group.full_path} @all @#{user.username}" }
+ before do
+ stub_feature_flags(disable_all_mention: false)
+ end
+
it 'merge_requests/merge_request_with_mentions.html' do
render_merge_request(merge_request)
end
diff --git a/spec/frontend/fixtures/pipeline_details.rb b/spec/frontend/fixtures/pipeline_details.rb
new file mode 100644
index 00000000000..af9b11b0841
--- /dev/null
+++ b/spec/frontend/fixtures/pipeline_details.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe "GraphQL Pipeline details", '(JavaScript fixtures)', type: :request, feature_category: :pipeline_composition do
+ include ApiHelpers
+ include GraphqlHelpers
+ include JavaScriptFixturesHelpers
+
+ let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures') }
+ let_it_be(:project) { create(:project, :public, :repository) }
+ let_it_be(:admin) { project.first_owner }
+ let_it_be(:commit) { create(:commit, project: project) }
+ let_it_be(:pipeline) do
+ create(:ci_pipeline, project: project, sha: commit.id, ref: 'master', user: admin, status: :success)
+ end
+
+ let_it_be(:build_success) do
+ create(:ci_build, :dependent, name: 'build_my_app', pipeline: pipeline, stage: 'build', status: :success)
+ end
+
+ let_it_be(:build_test) { create(:ci_build, :dependent, name: 'test_my_app', pipeline: pipeline, stage: 'test') }
+ let_it_be(:build_deploy_failed) do
+ create(:ci_build, :dependent, name: 'deploy_my_app', status: :failed, pipeline: pipeline, stage: 'deploy')
+ end
+
+ let_it_be(:bridge) { create(:ci_bridge, pipeline: pipeline) }
+
+ let(:pipeline_details_query_path) { 'app/graphql/queries/pipelines/get_pipeline_details.query.graphql' }
+
+ it "pipelines/pipeline_details.json" do
+ query = get_graphql_query_as_string(pipeline_details_query_path, with_base_path: false)
+
+ post_graphql(query, current_user: admin, variables: { projectPath: project.full_path, iid: pipeline.iid })
+
+ expect_graphql_errors_to_be_empty
+ end
+end
diff --git a/spec/frontend/fixtures/pipeline_header.rb b/spec/frontend/fixtures/pipeline_header.rb
new file mode 100644
index 00000000000..3fdc45b1194
--- /dev/null
+++ b/spec/frontend/fixtures/pipeline_header.rb
@@ -0,0 +1,118 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe "GraphQL Pipeline Header", '(JavaScript fixtures)', type: :request, feature_category: :pipeline_composition do
+ include ApiHelpers
+ include GraphqlHelpers
+ include JavaScriptFixturesHelpers
+
+ let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures') }
+ let_it_be(:project) { create(:project, :public, :repository) }
+ let_it_be(:user) { project.first_owner }
+ let_it_be(:commit) { create(:commit, project: project) }
+
+ let(:query_path) { 'pipelines/graphql/queries/get_pipeline_header_data.query.graphql' }
+
+ context 'with successful pipeline' do
+ let_it_be(:pipeline) do
+ create(
+ :ci_pipeline,
+ project: project,
+ sha: commit.id,
+ ref: 'master',
+ user: user,
+ status: :success,
+ duration: 7210,
+ created_at: 2.hours.ago,
+ started_at: 1.hour.ago,
+ finished_at: Time.current
+ )
+ end
+
+ it "graphql/pipelines/pipeline_header_success.json" do
+ query = get_graphql_query_as_string(query_path)
+
+ post_graphql(query, current_user: user, variables: { fullPath: project.full_path, iid: pipeline.iid })
+
+ expect_graphql_errors_to_be_empty
+ end
+ end
+
+ context 'with running pipeline' do
+ let_it_be(:pipeline) do
+ create(
+ :ci_pipeline,
+ project: project,
+ sha: commit.id,
+ ref: 'master',
+ user: user,
+ status: :running,
+ created_at: 2.hours.ago,
+ started_at: 1.hour.ago
+ )
+ end
+
+ let_it_be(:build) { create(:ci_build, :running, pipeline: pipeline, ref: 'master') }
+
+ it "graphql/pipelines/pipeline_header_running.json" do
+ query = get_graphql_query_as_string(query_path)
+
+ post_graphql(query, current_user: user, variables: { fullPath: project.full_path, iid: pipeline.iid })
+
+ expect_graphql_errors_to_be_empty
+ end
+ end
+
+ context 'with running pipeline and duration' do
+ let_it_be(:pipeline) do
+ create(
+ :ci_pipeline,
+ project: project,
+ sha: commit.id,
+ ref: 'master',
+ user: user,
+ status: :running,
+ duration: 7210,
+ created_at: 2.hours.ago,
+ started_at: 1.hour.ago
+ )
+ end
+
+ let_it_be(:build) { create(:ci_build, :running, pipeline: pipeline, ref: 'master') }
+
+ it "graphql/pipelines/pipeline_header_running_with_duration.json" do
+ query = get_graphql_query_as_string(query_path)
+
+ post_graphql(query, current_user: user, variables: { fullPath: project.full_path, iid: pipeline.iid })
+
+ expect_graphql_errors_to_be_empty
+ end
+ end
+
+ context 'with failed pipeline' do
+ let_it_be(:pipeline) do
+ create(
+ :ci_pipeline,
+ project: project,
+ sha: commit.id,
+ ref: 'master',
+ user: user,
+ status: :failed,
+ duration: 7210,
+ started_at: 1.hour.ago,
+ finished_at: Time.current
+ )
+ end
+
+ let_it_be(:build) { create(:ci_build, :canceled, pipeline: pipeline, ref: 'master') }
+
+ it "graphql/pipelines/pipeline_header_failed.json" do
+ query = get_graphql_query_as_string(query_path)
+
+ post_graphql(query, current_user: user, variables: { fullPath: project.full_path, iid: pipeline.iid })
+
+ expect_graphql_errors_to_be_empty
+ end
+ end
+end
diff --git a/spec/frontend/fixtures/project.rb b/spec/frontend/fixtures/project.rb
new file mode 100644
index 00000000000..6100248d0a5
--- /dev/null
+++ b/spec/frontend/fixtures/project.rb
@@ -0,0 +1,51 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Project (GraphQL fixtures)', feature_category: :groups_and_projects do
+ describe GraphQL::Query, type: :request do
+ include ApiHelpers
+ include GraphqlHelpers
+ include JavaScriptFixturesHelpers
+ include ProjectForksHelper
+
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:current_user) { create(:user) }
+
+ describe 'writable forks' do
+ writeable_forks_query_path = 'vue_shared/components/web_ide/get_writable_forks.query.graphql'
+
+ let(:query) { get_graphql_query_as_string(writeable_forks_query_path) }
+
+ subject { post_graphql(query, current_user: current_user, variables: { projectPath: project.full_path }) }
+
+ before do
+ project.add_developer(current_user)
+ end
+
+ context 'with none' do
+ it "graphql/#{writeable_forks_query_path}_none.json" do
+ subject
+
+ expect_graphql_errors_to_be_empty
+ end
+ end
+
+ context 'with some' do
+ let_it_be(:fork1) { fork_project(project, nil, repository: true) }
+ let_it_be(:fork2) { fork_project(project, nil, repository: true) }
+
+ before_all do
+ fork1.add_developer(current_user)
+ fork2.add_developer(current_user)
+ end
+
+ it "graphql/#{writeable_forks_query_path}_some.json" do
+ subject
+
+ expect_graphql_errors_to_be_empty
+ end
+ end
+ end
+ end
+end
diff --git a/spec/frontend/fixtures/runner.rb b/spec/frontend/fixtures/runner.rb
index 099df607487..a73a0dcbdd1 100644
--- a/spec/frontend/fixtures/runner.rb
+++ b/spec/frontend/fixtures/runner.rb
@@ -14,6 +14,9 @@ RSpec.describe 'Runner (JavaScript fixtures)', feature_category: :runner_fleet d
let_it_be(:project_2) { create(:project, :repository, :public) }
let_it_be(:runner) { create(:ci_runner, :instance, description: 'My Runner', creator: admin, version: '1.0.0') }
+ let_it_be(:runner_manager_1) { create(:ci_runner_machine, runner: runner, contacted_at: Time.current) }
+ let_it_be(:runner_manager_2) { create(:ci_runner_machine, runner: runner, contacted_at: Time.current) }
+
let_it_be(:group_runner) { create(:ci_runner, :group, groups: [group], version: '2.0.0') }
let_it_be(:group_runner_2) { create(:ci_runner, :group, groups: [group], version: '2.0.0') }
let_it_be(:project_runner) { create(:ci_runner, :project, projects: [project, project_2], version: '2.0.0') }
@@ -137,6 +140,22 @@ RSpec.describe 'Runner (JavaScript fixtures)', feature_category: :runner_fleet d
end
end
+ describe 'runner_managers.query.graphql', type: :request do
+ runner_managers_query = 'show/runner_managers.query.graphql'
+
+ let_it_be(:query) do
+ get_graphql_query_as_string("#{query_path}#{runner_managers_query}")
+ end
+
+ it "#{fixtures_path}#{runner_managers_query}.json" do
+ post_graphql(query, current_user: admin, variables: {
+ runner_id: runner.to_global_id.to_s
+ })
+
+ expect_graphql_errors_to_be_empty
+ end
+ end
+
describe 'runner_form.query.graphql', type: :request do
runner_jobs_query = 'edit/runner_form.query.graphql'
diff --git a/spec/frontend/fixtures/startup_css.rb b/spec/frontend/fixtures/startup_css.rb
index 5b09e1c9495..83e02470321 100644
--- a/spec/frontend/fixtures/startup_css.rb
+++ b/spec/frontend/fixtures/startup_css.rb
@@ -40,11 +40,8 @@ RSpec.describe 'Startup CSS fixtures', type: :controller do
expect(response).to be_successful
end
- # This Feature Flag is off by default
# This ensures that the correct css is generated for super sidebar
- # When the feature flag is off, the general startup will capture it
it "startup_css/project-#{type}-super-sidebar.html" do
- stub_feature_flags(super_sidebar_nav: true)
user.update!(use_new_navigation: true)
get :show, params: {
diff --git a/spec/frontend/fixtures/static/whats_new_notification.html b/spec/frontend/fixtures/static/whats_new_notification.html
index 3b4dbdf7d36..bc8a27c779f 100644
--- a/spec/frontend/fixtures/static/whats_new_notification.html
+++ b/spec/frontend/fixtures/static/whats_new_notification.html
@@ -1,5 +1,6 @@
<div class='whats-new-notification-fixture-root'>
<div class='app' data-version-digest='version-digest'></div>
+ <div data-testid='without-digest'></div>
<div class='header-help'>
<div class='js-whats-new-notification-count'></div>
</div>
diff --git a/spec/frontend/fixtures/users.rb b/spec/frontend/fixtures/users.rb
index 0e9d7475bf9..89bffea7e4c 100644
--- a/spec/frontend/fixtures/users.rb
+++ b/spec/frontend/fixtures/users.rb
@@ -2,18 +2,47 @@
require 'spec_helper'
-RSpec.describe 'Users (GraphQL fixtures)', feature_category: :user_profile do
+RSpec.describe 'Users (JavaScript fixtures)', feature_category: :user_profile do
+ include JavaScriptFixturesHelpers
+ include ApiHelpers
+
+ let_it_be(:followers) { create_list(:user, 5) }
+ let_it_be(:user) { create(:user, followers: followers) }
+
+ describe API::Users, '(JavaScript fixtures)', type: :request do
+ it 'api/users/followers/get.json' do
+ get api("/users/#{user.id}/followers", user)
+
+ expect(response).to be_successful
+ end
+ end
+
+ describe UsersController, '(JavaScript fixtures)', type: :controller do
+ let_it_be(:group) { create(:group) }
+ let_it_be(:project) { create(:project_empty_repo, group: group) }
+
+ include_context 'with user contribution events'
+
+ before do
+ group.add_owner(user)
+ project.add_maintainer(user)
+ sign_in(user)
+ end
+
+ it 'controller/users/activity.json' do
+ get :activity, params: { username: user.username, limit: 50 }, format: :json
+
+ expect(response).to be_successful
+ end
+ end
+
describe GraphQL::Query, type: :request do
- include ApiHelpers
include GraphqlHelpers
- include JavaScriptFixturesHelpers
-
- let_it_be(:user) { create(:user) }
context 'for user achievements' do
let_it_be(:group) { create(:group, :public) }
let_it_be(:private_group) { create(:group, :private) }
- let_it_be(:achievement1) { create(:achievement, namespace: group) }
+ let_it_be(:achievement1) { create(:achievement, namespace: group, name: 'Multiple') }
let_it_be(:achievement2) { create(:achievement, namespace: group) }
let_it_be(:achievement3) { create(:achievement, namespace: group) }
let_it_be(:achievement_from_private_group) { create(:achievement, namespace: private_group) }
@@ -65,6 +94,7 @@ RSpec.describe 'Users (GraphQL fixtures)', feature_category: :user_profile do
[achievement1, achievement2, achievement3, achievement_with_avatar_and_description].each do |achievement|
create(:user_achievement, user: user, achievement: achievement)
end
+ create(:user_achievement, user: user, achievement: achievement1)
post_graphql(query, current_user: user, variables: { id: user.to_global_id })