Skip to content

Commit a42a4df

Browse files
authored
chore: add more smoke tests for w3c trace format (#681)
1 parent 206d04b commit a42a4df

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

src/__smoke-test-npm__/ingestion-integ.spec.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,38 @@ test('when xray event is sent with w3c format enabled then the event is ingested
409409
);
410410
expect(isIngestionCompleted).toEqual(true);
411411
});
412+
413+
test('when http events are sent with w3c format enabled then the events are ingested', async ({
414+
page
415+
}) => {
416+
const timestamp = Date.now() - 30000;
417+
418+
// Open page
419+
await page.goto(W3C_TEST_URL);
420+
const fetch500 = page.locator('[id=httpStatFetch500]');
421+
const xhr500 = page.locator('[id=httpStatXhr500]');
422+
await fetch500.click();
423+
await xhr500.click();
424+
425+
// Test will timeout if no successful dataplane request is found
426+
const response = await page.waitForResponse(async (response) =>
427+
isDataPlaneRequest(response, TARGET_URL)
428+
);
429+
430+
// Parse payload to verify event count
431+
const requestBody = JSON.parse(response.request().postData());
432+
433+
const httpEvents = getEventsByType(requestBody, HTTP_EVENT_TYPE);
434+
const eventIds = getEventIds(httpEvents);
435+
436+
// Expect two http events
437+
expect(eventIds.length).toEqual(2);
438+
const isIngestionCompleted = await verifyIngestionWithRetry(
439+
rumClient,
440+
eventIds,
441+
timestamp,
442+
MONITOR_NAME,
443+
5
444+
);
445+
expect(isIngestionCompleted).toEqual(true);
446+
});

src/__smoke-test__/ingestion-integ.spec.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,3 +530,38 @@ test('when INP event is sent then event is ingested', async ({ page }) => {
530530
);
531531
expect(isIngestionCompleted).toEqual(true);
532532
});
533+
534+
test('when http events are sent with w3c format enabled then the events are ingested', async ({
535+
page
536+
}) => {
537+
const timestamp = Date.now() - 30000;
538+
539+
// Open page
540+
await page.goto(W3C_TEST_URL);
541+
const fetch500 = page.locator('[id=httpStatFetch500]');
542+
const xhr500 = page.locator('[id=httpStatXhr500]');
543+
await fetch500.click();
544+
await xhr500.click();
545+
546+
// Test will timeout if no successful dataplane request is found
547+
const response = await page.waitForResponse(async (response) =>
548+
isDataPlaneRequest(response, TARGET_URL)
549+
);
550+
551+
// Parse payload to verify event count
552+
const requestBody = JSON.parse(response.request().postData());
553+
554+
const httpEvents = getEventsByType(requestBody, HTTP_EVENT_TYPE);
555+
const eventIds = getEventIds(httpEvents);
556+
557+
// Expect two http events
558+
expect(eventIds.length).toEqual(2);
559+
const isIngestionCompleted = await verifyIngestionWithRetry(
560+
rumClient,
561+
eventIds,
562+
timestamp,
563+
MONITOR_NAME,
564+
5
565+
);
566+
expect(isIngestionCompleted).toEqual(true);
567+
});

0 commit comments

Comments
 (0)