Commit 645c05d3 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Added fixture spec for new cycle analytics endpoint

Returns stage metadata and the the list of custom
stage events for the custom stage form
parent 1e2f9a8f
......@@ -55,199 +55,5 @@ export const testEvents = stageFixtures.test;
export const stagingEvents = stageFixtures.staging;
export const productionEvents = stageFixtures.production;
// NOTE: once the backend is complete, we can generate this as a JSON fixture
// https://gitlab.com/gitlab-org/gitlab/issues/32112
export const apiResponse = {
events: [
{
name: 'Issue created',
identifier: 'issue_created',
type: 'simple',
canBeStartEvent: true,
allowedEndEvents: ['issue_stage_end'],
},
{
name: 'Issue first mentioned in a commit',
identifier: 'issue_first_mentioned_in_commit',
type: 'simple',
canBeStartEvent: false,
allowedEndEvents: [],
},
{
name: 'Merge request created',
identifier: 'merge_request_created',
type: 'simple',
canBeStartEvent: true,
allowedEndEvents: ['merge_request_merged'],
},
{
name: 'Merge request first deployed to production',
identifier: 'merge_request_first_deployed_to_production',
type: 'simple',
canBeStartEvent: false,
allowedEndEvents: [],
},
{
name: 'Merge request last build finish time',
identifier: 'merge_request_last_build_finished',
type: 'simple',
canBeStartEvent: false,
allowedEndEvents: [],
},
{
name: 'Merge request last build start time',
identifier: 'merge_request_last_build_started',
type: 'simple',
canBeStartEvent: true,
allowedEndEvents: ['merge_request_last_build_finished'],
},
{
name: 'Merge request merged',
identifier: 'merge_request_merged',
type: 'simple',
canBeStartEvent: true,
allowedEndEvents: ['merge_request_first_deployed_to_production'],
},
{
name: 'Issue first mentioned in a commit',
identifier: 'code_stage_start',
type: 'simple',
canBeStartEvent: true,
allowedEndEvents: ['merge_request_created'],
},
{
name: 'Issue first associated with a milestone or issue first added to a board',
identifier: 'issue_stage_end',
type: 'simple',
canBeStartEvent: false,
allowedEndEvents: [],
},
{
name: 'Issue first associated with a milestone or issue first added to a board',
identifier: 'plan_stage_start',
type: 'simple',
canBeStartEvent: true,
allowedEndEvents: ['issue_first_mentioned_in_commit'],
},
{
identifier: 'issue_label_added',
name: 'Issue Label Added',
type: 'label',
canBeStartEvent: true,
allowedEndEvents: ['issue_closed', 'issue_label_removed'],
},
{
identifier: 'issue_label_removed',
name: 'Issue Label Removed',
type: 'label',
canBeStartEvent: false,
allowedEndEvents: [],
},
],
stages: [
{
name: 'issue',
legend: 'Related Issues',
description: 'Time before an issue gets scheduled',
id: 'issue',
position: 1,
hidden: false,
custom: false,
startEventIdentifier: 'issue_created',
endEventIdentifier: 'issue_stage_end',
},
{
name: 'plan',
legend: 'Related Issues',
description: 'Time before an issue starts implementation',
id: 'plan',
position: 2,
hidden: false,
custom: false,
startEventIdentifier: 'plan_stage_start',
endEventIdentifier: 'issue_first_mentioned_in_commit',
},
{
name: 'code',
legend: 'Related Merged Requests',
description: 'Time until first merge request',
id: 'code',
position: 3,
hidden: false,
custom: false,
startEventIdentifier: 'code_stage_start',
endEventIdentifier: 'merge_request_created',
},
{
name: 'test',
legend: 'Related Merged Requests',
description: 'Total test time for all commits/merges',
id: 'test',
position: 4,
hidden: false,
custom: false,
startEventIdentifier: 'merge_request_last_build_started',
endEventIdentifier: 'merge_request_last_build_finished',
},
{
name: 'review',
legend: 'Related Merged Requests',
description: 'Time between merge request creation and merge/close',
id: 'review',
position: 5,
hidden: false,
custom: false,
startEventIdentifier: 'merge_request_created',
endEventIdentifier: 'merge_request_merged',
},
{
name: 'staging',
legend: 'Related Merged Requests',
description: 'From merge request merge until deploy to production',
id: 'staging',
position: 6,
hidden: false,
custom: false,
startEventIdentifier: 'merge_request_merged',
endEventIdentifier: 'merge_request_first_deployed_to_production',
},
{
name: 'production',
legend: 'Related Merged Requests',
description: 'From issue creation until deploy to production',
id: 'production',
position: 7,
hidden: false,
custom: false,
startEventIdentifier: 'merge_request_merged',
endEventIdentifier: 'merge_request_first_deployed_to_production',
},
],
summary: [
{
value: 2,
title: 'New Issues',
},
{
value: 0,
title: 'Commits',
},
{
value: 0,
title: 'Deploys',
},
],
permissions: {
issue: true,
plan: true,
code: true,
test: true,
review: true,
staging: true,
production: true,
},
};
export default {
apiResponse,
};
const { events: rawCustomStageEvents } = getJSONFixture('analytics/cycle_analytics/stages.json');
export const customStageEvents = rawCustomStageEvents.map(deepCamelCase);
......@@ -45,7 +45,6 @@ describe 'Analytics (JavaScript fixtures)' do
end
describe Groups::CycleAnalytics::EventsController, type: :controller do
using RSpec::Parameterized::TableSyntax
render_views
before do
......@@ -87,4 +86,21 @@ describe 'Analytics (JavaScript fixtures)' do
expect(response).to be_successful
end
end
describe Analytics::CycleAnalytics::StagesController, type: :controller do
render_views
before do
stub_feature_flags(Gitlab::Analytics::CYCLE_ANALYTICS_FEATURE_FLAG => true)
stub_licensed_features(cycle_analytics_for_groups: true)
sign_in(user)
end
it 'analytics/cycle_analytics/stages.json' do
get(:index, params: { group_id: group.name }, format: :json)
expect(response).to be_successful
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment