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

namespaces.rb « fixtures « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b11f661fe095cb51910c5fed1e3007596c857e90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Jobs (JavaScript fixtures)' do
  include ApiHelpers
  include JavaScriptFixturesHelpers
  include GraphqlHelpers

  describe GraphQL::Query, type: :request do
    let_it_be(:user) { create(:user) }
    let_it_be(:groups) { create_list(:group, 4) }

    before_all do
      groups.each { |group| group.add_owner(user) }
    end

    query_name = 'search_namespaces_where_user_can_transfer_projects'
    query_extension = '.query.graphql'

    full_input_path = "projects/settings/graphql/queries/#{query_name}#{query_extension}"
    base_output_path = "graphql/projects/settings/#{query_name}"

    it "#{base_output_path}_page_1#{query_extension}.json" do
      query = get_graphql_query_as_string(full_input_path)

      post_graphql(query, current_user: user, variables: { first: 2 })

      expect_graphql_errors_to_be_empty
    end

    it "#{base_output_path}_page_2#{query_extension}.json" do
      query = get_graphql_query_as_string(full_input_path)

      post_graphql(query, current_user: user, variables: { first: 2 })

      post_graphql(
        query,
        current_user: user,
        variables: { first: 2, after: graphql_data_at('currentUser', 'groups', 'pageInfo', 'endCursor') }
      )

      expect_graphql_errors_to_be_empty
    end
  end
end