diff options
Diffstat (limited to 'spec/frontend/fixtures')
-rw-r--r-- | spec/frontend/fixtures/jobs.rb | 1 | ||||
-rw-r--r-- | spec/frontend/fixtures/listbox.rb | 5 | ||||
-rw-r--r-- | spec/frontend/fixtures/merge_requests.rb | 47 | ||||
-rw-r--r-- | spec/frontend/fixtures/pipelines.rb | 11 | ||||
-rw-r--r-- | spec/frontend/fixtures/runner.rb | 2 | ||||
-rw-r--r-- | spec/frontend/fixtures/saved_replies.rb | 46 | ||||
-rw-r--r-- | spec/frontend/fixtures/static/project_select_combo_button.html | 13 |
7 files changed, 110 insertions, 15 deletions
diff --git a/spec/frontend/fixtures/jobs.rb b/spec/frontend/fixtures/jobs.rb index ac58b99875b..6d452bf1bff 100644 --- a/spec/frontend/fixtures/jobs.rb +++ b/spec/frontend/fixtures/jobs.rb @@ -39,6 +39,7 @@ RSpec.describe 'Jobs (JavaScript fixtures)' do let!(:build) { create(:ci_build, :success, name: 'build', pipeline: pipeline) } let!(:cancelable) { create(:ci_build, :cancelable, name: 'cancelable', pipeline: pipeline) } + let!(:failed) { create(:ci_build, :failed, name: 'failed', pipeline: pipeline) } let!(:created_by_tag) { create(:ci_build, :success, name: 'created_by_tag', tag: true, pipeline: pipeline) } let!(:pending) { create(:ci_build, :pending, name: 'pending', pipeline: pipeline) } let!(:playable) { create(:ci_build, :playable, name: 'playable', pipeline: pipeline) } diff --git a/spec/frontend/fixtures/listbox.rb b/spec/frontend/fixtures/listbox.rb index 8f8489a2827..8f746f1707a 100644 --- a/spec/frontend/fixtures/listbox.rb +++ b/spec/frontend/fixtures/listbox.rb @@ -26,6 +26,9 @@ RSpec.describe 'initRedirectListboxBehavior', '(JavaScript fixtures)', type: :he arbitrary_key: 'qux xyz' }] - @tag = helper.gl_redirect_listbox_tag(items, 'bar', class: %w[test-class-1 test-class-2], data: { right: true }) + @tag = helper.gl_redirect_listbox_tag(items, 'bar', + class: %w[test-class-1 test-class-2], + data: { placement: 'right' } + ) end end diff --git a/spec/frontend/fixtures/merge_requests.rb b/spec/frontend/fixtures/merge_requests.rb index 18f89fbc5e5..7ee89ca3694 100644 --- a/spec/frontend/fixtures/merge_requests.rb +++ b/spec/frontend/fixtures/merge_requests.rb @@ -148,6 +148,53 @@ RSpec.describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: end end + context 'merge request with no approvals' do + base_input_path = 'vue_merge_request_widget/components/approvals/queries/' + base_output_path = 'graphql/merge_requests/approvals/' + query_name = 'approved_by.query.graphql' + + it "#{base_output_path}#{query_name}_no_approvals.json" do + query = get_graphql_query_as_string("#{base_input_path}#{query_name}", ee: Gitlab.ee?) + + post_graphql(query, current_user: user, variables: { projectPath: project.full_path, iid: merge_request.iid.to_s }) + + expect_graphql_errors_to_be_empty + end + end + + context 'merge request approved by current user' do + base_input_path = 'vue_merge_request_widget/components/approvals/queries/' + base_output_path = 'graphql/merge_requests/approvals/' + query_name = 'approved_by.query.graphql' + + it "#{base_output_path}#{query_name}.json" do + merge_request.approved_by_users << user + + query = get_graphql_query_as_string("#{base_input_path}#{query_name}", ee: Gitlab.ee?) + + post_graphql(query, current_user: user, variables: { projectPath: project.full_path, iid: merge_request.iid.to_s }) + + expect_graphql_errors_to_be_empty + end + end + + context 'merge request approved by multiple users' do + base_input_path = 'vue_merge_request_widget/components/approvals/queries/' + base_output_path = 'graphql/merge_requests/approvals/' + query_name = 'approved_by.query.graphql' + + it "#{base_output_path}#{query_name}_multiple_users.json" do + merge_request.approved_by_users << user + merge_request.approved_by_users << create(:user) + + query = get_graphql_query_as_string("#{base_input_path}#{query_name}", ee: Gitlab.ee?) + + post_graphql(query, current_user: user, variables: { projectPath: project.full_path, iid: merge_request.iid.to_s }) + + expect_graphql_errors_to_be_empty + end + end + context 'merge request in state getState query' do base_input_path = 'vue_merge_request_widget/queries/' base_output_path = 'graphql/merge_requests/' diff --git a/spec/frontend/fixtures/pipelines.rb b/spec/frontend/fixtures/pipelines.rb index 44b471a70d8..768934d6278 100644 --- a/spec/frontend/fixtures/pipelines.rb +++ b/spec/frontend/fixtures/pipelines.rb @@ -23,8 +23,19 @@ RSpec.describe Projects::PipelinesController, '(JavaScript fixtures)', type: :co let!(:build_test) { create(:ci_build, pipeline: pipeline, stage: 'test') } let!(:build_deploy_failed) { create(:ci_build, status: :failed, pipeline: pipeline, stage: 'deploy') } + let(:bridge) { create(:ci_bridge, pipeline: pipeline) } + let(:retried_bridge) { create(:ci_bridge, :retried, pipeline: pipeline) } + + let(:downstream_pipeline) { create(:ci_pipeline, :with_job) } + let(:retried_downstream_pipeline) { create(:ci_pipeline, :with_job) } + let!(:ci_sources_pipeline) { create(:ci_sources_pipeline, pipeline: downstream_pipeline, source_job: bridge) } + let!(:retried_ci_sources_pipeline) do + create(:ci_sources_pipeline, pipeline: retried_downstream_pipeline, source_job: retried_bridge) + end + before do sign_in(user) + project.add_developer(user) end it 'pipelines/pipelines.json' do diff --git a/spec/frontend/fixtures/runner.rb b/spec/frontend/fixtures/runner.rb index de87114766e..f60e4991292 100644 --- a/spec/frontend/fixtures/runner.rb +++ b/spec/frontend/fixtures/runner.rb @@ -30,7 +30,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do before do allow_next_instance_of(::Gitlab::Ci::RunnerUpgradeCheck) do |instance| allow(instance).to receive(:check_runner_upgrade_suggestion) - .and_return([nil, :not_available]) + .and_return([nil, :unavailable]) end end diff --git a/spec/frontend/fixtures/saved_replies.rb b/spec/frontend/fixtures/saved_replies.rb new file mode 100644 index 00000000000..c80ba06bca1 --- /dev/null +++ b/spec/frontend/fixtures/saved_replies.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe GraphQL::Query, type: :request, feature_category: :user_profile do + include JavaScriptFixturesHelpers + include ApiHelpers + include GraphqlHelpers + + let_it_be(:current_user) { create(:user) } + + before do + sign_in(current_user) + end + + context 'when user has no saved replies' do + base_input_path = 'saved_replies/queries/' + base_output_path = 'graphql/saved_replies/' + query_name = 'saved_replies.query.graphql' + + it "#{base_output_path}saved_replies_empty.query.graphql.json" do + query = get_graphql_query_as_string("#{base_input_path}#{query_name}") + + post_graphql(query, current_user: current_user) + + expect_graphql_errors_to_be_empty + end + end + + context 'when user has saved replies' do + base_input_path = 'saved_replies/queries/' + base_output_path = 'graphql/saved_replies/' + query_name = 'saved_replies.query.graphql' + + it "#{base_output_path}saved_replies.query.graphql.json" do + create(:saved_reply, user: current_user) + create(:saved_reply, user: current_user) + + query = get_graphql_query_as_string("#{base_input_path}#{query_name}") + + post_graphql(query, current_user: current_user) + + expect_graphql_errors_to_be_empty + end + end +end diff --git a/spec/frontend/fixtures/static/project_select_combo_button.html b/spec/frontend/fixtures/static/project_select_combo_button.html deleted file mode 100644 index 3776610ed4c..00000000000 --- a/spec/frontend/fixtures/static/project_select_combo_button.html +++ /dev/null @@ -1,13 +0,0 @@ -<div class="project-item-select-holder"> - <input class="project-item-select" data-group-id="12345" data-relative-path="issues/new" /> - <a class="js-new-project-item-link" data-label="issue" data-type="issues" href=""> - <span class="gl-spinner"></span> - </a> - <a class="new-project-item-select-button"> - <svg data-testid="chevron-down-icon" class="gl-icon s16"> - <use - href="/assets/icons-795a2ef2fd636a0538bbef3b8d2787dd90927b42d7617fdda8620930016b333d.svg#chevron-down" - ></use> - </svg> - </a> -</div> |