Skip to content
Snippets Groups Projects
Commit 7c077d96 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent da35510c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -74,7 +74,7 @@ describe 'Clusters', :js do
visit project_clusters_path(project)
 
click_link 'Add Kubernetes cluster'
click_link 'Create new Cluster on GKE'
click_link 'Create new Cluster'
end
 
it 'user sees a link to create a GKE cluster' do
Loading
Loading
Loading
Loading
@@ -123,6 +123,7 @@ describe('EksClusterConfigurationForm', () => {
store,
propsData: {
gitlabManagedClusterHelpPath: '',
kubernetesIntegrationHelpPath: '',
},
});
});
Loading
Loading
import * as errorTrackingUtils from '~/error_tracking/utils';
const externalUrl = 'https://sentry.io/organizations/test-sentry-nk/issues/1/?project=1';
describe('Error Tracking Events', () => {
describe('trackViewInSentryOptions', () => {
it('should return correct event options', () => {
expect(errorTrackingUtils.trackViewInSentryOptions(externalUrl)).toEqual({
category: 'Error Tracking',
action: 'click_view_in_sentry',
label: 'External Url',
property: externalUrl,
});
});
});
describe('trackClickErrorLinkToSentryOptions', () => {
it('should return correct event options', () => {
expect(errorTrackingUtils.trackClickErrorLinkToSentryOptions(externalUrl)).toEqual({
category: 'Error Tracking',
action: 'click_error_link_to_sentry',
label: 'Error Link',
property: externalUrl,
});
});
});
});
import * as monitoringUtils from '~/monitoring/utils';
describe('Snowplow Events', () => {
const generatedLink = 'http://chart.link.com';
const chartTitle = 'Some metric chart';
describe('trackGenerateLinkToChartEventOptions', () => {
it('should return Cluster Monitoring options if located on Cluster Health Dashboard', () => {
document.body.dataset.page = 'groups:clusters:show';
expect(monitoringUtils.generateLinkToChartOptions(generatedLink)).toEqual({
category: 'Cluster Monitoring',
action: 'generate_link_to_cluster_metric_chart',
label: 'Chart link',
property: generatedLink,
});
});
it('should return Incident Management event options if located on Metrics Dashboard', () => {
document.body.dataset.page = 'metrics:show';
expect(monitoringUtils.generateLinkToChartOptions(generatedLink)).toEqual({
category: 'Incident Management::Embedded metrics',
action: 'generate_link_to_metrics_chart',
label: 'Chart link',
property: generatedLink,
});
});
});
describe('trackDownloadCSVEvent', () => {
it('should return Cluster Monitoring options if located on Cluster Health Dashboard', () => {
document.body.dataset.page = 'groups:clusters:show';
expect(monitoringUtils.downloadCSVOptions(chartTitle)).toEqual({
category: 'Cluster Monitoring',
action: 'download_csv_of_cluster_metric_chart',
label: 'Chart title',
property: chartTitle,
});
});
it('should return Incident Management event options if located on Metrics Dashboard', () => {
document.body.dataset.page = 'metriss:show';
expect(monitoringUtils.downloadCSVOptions(chartTitle)).toEqual({
category: 'Incident Management::Embedded metrics',
action: 'download_csv_of_metrics_dashboard_chart',
label: 'Chart title',
property: chartTitle,
});
});
});
});
import Vue from 'vue';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import Tracking from '~/tracking';
import TrackEvent from '~/vue_shared/directives/track_event';
jest.mock('~/tracking');
const Component = Vue.component('dummy-element', {
directives: {
TrackEvent,
},
data() {
return {
trackingOptions: null,
};
},
template: '<button id="trackable" v-track-event="trackingOptions"></button>',
});
const localVue = createLocalVue();
let wrapper;
let button;
describe('Error Tracking directive', () => {
beforeEach(() => {
wrapper = shallowMount(localVue.extend(Component), {
localVue,
});
button = wrapper.find('#trackable');
});
it('should not track the event if required arguments are not provided', () => {
button.trigger('click');
expect(Tracking.event).not.toHaveBeenCalled();
});
it('should track event on click if tracking info provided', () => {
const trackingOptions = {
category: 'Tracking',
action: 'click_trackable_btn',
label: 'Trackable Info',
};
wrapper.setData({ trackingOptions });
const { category, action, label, property, value } = trackingOptions;
button.trigger('click');
expect(Tracking.event).toHaveBeenCalledWith(category, action, { label, property, value });
});
});
Loading
Loading
@@ -32,7 +32,7 @@ describe Gitlab::GitalyClient::ConflictFilesStitcher do
double(files: [double(header: nil, content: content_2[11..-1])])
]
 
conflict_files = described_class.new(messages).to_a
conflict_files = described_class.new(messages, target_repository.gitaly_repository).to_a
 
expect(conflict_files.size).to be(2)
 
Loading
Loading
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Tracking::IncidentManagement do
describe '.track_from_params' do
shared_examples 'a tracked event' do |label, value = nil|
it 'creates the tracking event with the correct details' do
expect(::Gitlab::Tracking)
.to receive(:event)
.with(
'IncidentManagement::Settings',
label,
value || kind_of(Hash)
)
end
end
after do
described_class.track_from_params(params)
end
context 'known params' do
known_params = described_class.tracking_keys
known_params.each do |key, values|
context "param #{key}" do
let(:params) { { key => '1' } }
it_behaves_like 'a tracked event', "enabled_#{known_params[key][:name]}"
end
end
context 'different input values' do
shared_examples 'the correct prefixed event name' do |input, enabled|
let(:params) { { issue_template_key: input } }
it 'matches' do
expect(::Gitlab::Tracking)
.to receive(:event)
.with(
anything,
"#{enabled}_issue_template_on_alerts",
anything
)
end
end
it_behaves_like 'the correct prefixed event name', 1, 'enabled'
it_behaves_like 'the correct prefixed event name', '1', 'enabled'
it_behaves_like 'the correct prefixed event name', 'template', 'enabled'
it_behaves_like 'the correct prefixed event name', '', 'disabled'
it_behaves_like 'the correct prefixed event name', nil, 'disabled'
end
context 'param with label' do
let(:params) { { issue_template_key: '1' } }
it_behaves_like 'a tracked event', "enabled_issue_template_on_alerts", { label: 'Template name', property: '1' }
end
context 'param without label' do
let(:params) { { create_issue: '1' } }
it_behaves_like 'a tracked event', "enabled_issue_auto_creation_on_alerts", {}
end
end
context 'unknown params' do
let(:params) { { 'unknown' => '1' } }
it 'does not create the tracking event' do
expect(::Gitlab::Tracking)
.not_to receive(:event)
end
end
end
end
Loading
Loading
@@ -51,6 +51,12 @@ describe Issues::ZoomLinkService do
expect(result.payload[:description])
.to eq("#{issue.description}\n\n#{zoom_link}")
end
it 'tracks the add event' do
expect(Gitlab::Tracking).to receive(:event)
.with('IncidentManagement::ZoomIntegration', 'add_zoom_meeting', label: 'Issue ID', value: issue.id)
result
end
end
 
shared_examples 'cannot add link' do
Loading
Loading
@@ -135,6 +141,13 @@ describe Issues::ZoomLinkService do
.to eq(issue.description.delete_suffix("\n\n#{zoom_link}"))
end
 
it 'tracks the remove event' do
expect(Gitlab::Tracking).to receive(:event)
.with('IncidentManagement::ZoomIntegration', 'remove_zoom_meeting', label: 'Issue ID', value: issue.id)
result
end
context 'with insufficient permissions' do
include_context 'insufficient permissions'
include_examples 'cannot remove link'
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment