Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c50790c1
Commit
c50790c1
authored
Nov 16, 2020
by
Olena Horal-Koretska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `view_alert_integrations_list` Snowplow event
parent
13a73325
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue
...s/alerts_settings/components/alerts_integrations_list.vue
+11
-1
changelogs/unreleased/276185_alerts_integrations_list_tracking.yml
...s/unreleased/276185_alerts_integrations_list_tracking.yml
+5
-0
spec/frontend/alerts_settings/alerts_integrations_list_spec.js
...frontend/alerts_settings/alerts_integrations_list_spec.js
+15
-2
spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js
.../frontend/alerts_settings/alerts_settings_wrapper_spec.js
+2
-0
No files found.
app/assets/javascripts/alerts_settings/components/alerts_integrations_list.vue
View file @
c50790c1
...
...
@@ -92,7 +92,17 @@ export default {
};
},
mounted
()
{
this
.
trackPageViews
();
const
callback
=
entries
=>
{
const
isVisible
=
entries
.
some
(
entry
=>
entry
.
isIntersecting
);
if
(
isVisible
)
{
this
.
trackPageViews
();
this
.
observer
.
disconnect
();
}
};
this
.
observer
=
new
IntersectionObserver
(
callback
);
this
.
observer
.
observe
(
this
.
$el
);
},
methods
:
{
tbodyTrClass
(
item
)
{
...
...
changelogs/unreleased/276185_alerts_integrations_list_tracking.yml
0 → 100644
View file @
c50790c1
---
title
:
Fix alerts integration list Snowplow tracking event
merge_request
:
47413
author
:
type
:
fixed
spec/frontend/alerts_settings/alerts_integrations_list_spec.js
View file @
c50790c1
import
{
GlTable
,
GlIcon
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
useMockIntersectionObserver
}
from
'
helpers/mock_dom_observer
'
;
import
Tracking
from
'
~/tracking
'
;
import
AlertIntegrationsList
,
{
i18n
,
...
...
@@ -23,6 +24,7 @@ const mockIntegrations = [
describe
(
'
AlertIntegrationsList
'
,
()
=>
{
let
wrapper
;
const
{
trigger
:
triggerIntersection
}
=
useMockIntersectionObserver
();
function
mountComponent
({
data
=
{},
props
=
{}
}
=
{})
{
wrapper
=
mount
(
AlertIntegrationsList
,
{
...
...
@@ -100,12 +102,23 @@ describe('AlertIntegrationsList', () => {
describe
(
'
Snowplow tracking
'
,
()
=>
{
beforeEach
(()
=>
{
jest
.
spyOn
(
Tracking
,
'
event
'
);
mountComponent
();
jest
.
spyOn
(
Tracking
,
'
event
'
);
});
it
(
'
should NOT track alert list page views when list is collapsed
'
,
()
=>
{
triggerIntersection
(
wrapper
.
vm
.
$el
,
{
entry
:
{
isIntersecting
:
false
}
});
expect
(
Tracking
.
event
).
not
.
toHaveBeenCalled
();
});
it
(
'
should track alert list page views
'
,
()
=>
{
it
(
'
should track alert list page views only once when list is expanded
'
,
()
=>
{
triggerIntersection
(
wrapper
.
vm
.
$el
,
{
entry
:
{
isIntersecting
:
true
}
});
triggerIntersection
(
wrapper
.
vm
.
$el
,
{
entry
:
{
isIntersecting
:
true
}
});
triggerIntersection
(
wrapper
.
vm
.
$el
,
{
entry
:
{
isIntersecting
:
true
}
});
const
{
category
,
action
}
=
trackAlertIntegrationsViewsOptions
;
expect
(
Tracking
.
event
).
toHaveBeenCalledTimes
(
1
);
expect
(
Tracking
.
event
).
toHaveBeenCalledWith
(
category
,
action
);
});
});
...
...
spec/frontend/alerts_settings/alerts_settings_wrapper_spec.js
View file @
c50790c1
...
...
@@ -3,6 +3,7 @@ import { mount, createLocalVue } from '@vue/test-utils';
import
createMockApollo
from
'
jest/helpers/mock_apollo_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
GlLoadingIcon
,
GlAlert
}
from
'
@gitlab/ui
'
;
import
{
useMockIntersectionObserver
}
from
'
helpers/mock_dom_observer
'
;
import
AlertsSettingsWrapper
from
'
~/alerts_settings/components/alerts_settings_wrapper.vue
'
;
import
AlertsSettingsFormOld
from
'
~/alerts_settings/components/alerts_settings_form_old.vue
'
;
import
AlertsSettingsFormNew
from
'
~/alerts_settings/components/alerts_settings_form_new.vue
'
;
...
...
@@ -47,6 +48,7 @@ describe('AlertsSettingsWrapper', () => {
let
wrapper
;
let
fakeApollo
;
let
destroyIntegrationHandler
;
useMockIntersectionObserver
();
const
findLoader
=
()
=>
wrapper
.
find
(
IntegrationsList
).
find
(
GlLoadingIcon
);
const
findIntegrations
=
()
=>
wrapper
.
find
(
IntegrationsList
).
findAll
(
'
table tbody tr
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment