Skip to content

Commit

Permalink
chore: add intetgration test for attribution
Browse files Browse the repository at this point in the history
  • Loading branch information
williazz committed Sep 11, 2023
1 parent 133521c commit 26a50f4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/plugins/event-plugins/__integ__/WebVitalsPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import {
RESPONSE_STATUS
} from '../../../test-utils/integ-test-utils';
import { Selector } from 'testcafe';
import { CLS_EVENT_TYPE, LCP_EVENT_TYPE } from '../../utils/constant';
import {
CLS_EVENT_TYPE,
FID_EVENT_TYPE,
LCP_EVENT_TYPE
} from '../../utils/constant';

const testButton: Selector = Selector(`#testButton`);
const makePageHidden: Selector = Selector(`#makePageHidden`);
Expand All @@ -17,7 +21,7 @@ fixture('WebVitalEvent Plugin').page(
// "FID is not reported if the user never interacts with the page."
// It doesn't seem like TestCafe actions are registered as user interactions, so cannot test FID

test('WebVitalEvent records lcp and cls events', async (t: TestController) => {
test('WebVitalEvent records lcp and cls events on chrome', async (t: TestController) => {
// If we click too soon, the client/event collector plugin will not be loaded and will not record the click.
// This could be a symptom of an issue with RUM web client load speed, or prioritization of script execution.
const browser = t.browser.name;
Expand Down Expand Up @@ -51,5 +55,9 @@ test('WebVitalEvent records lcp and cls events', async (t: TestController) => {
.expect(lcpEventDetails.value)
.typeOf('number')
.expect(clsEventDetails.value)
.typeOf('number');
.typeOf('number')
.expect(lcpEventDetails.attribution)
.typeOf('object')
.expect(clsEventDetails.attribution)
.typeOf('object');
});

0 comments on commit 26a50f4

Please sign in to comment.