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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# 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,
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
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
end
|