Skip to content

Commit e238b8b

Browse files
committed
add ingestion integration tests
1 parent 93bf465 commit e238b8b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { test, expect } from '@playwright/test'
2+
import { waitForCondition } from '../../helpers/playwright-utils'
3+
import { IndexPage } from './index-page'
4+
5+
const indexPage = new IndexPage()
6+
7+
const basicEdgeFn = `const processSignal = (signal) => {}`
8+
9+
test('ingestion not enabled -> will not send the signal', async ({ page }) => {
10+
await indexPage.loadAndWait(page, basicEdgeFn, {
11+
enableSignalsIngestion: false,
12+
})
13+
14+
await indexPage.fillNameInput('John Doe')
15+
const promise = await indexPage.waitForSignalsApiFlush()
16+
17+
await expect(promise).rejects.toThrow()
18+
})
19+
20+
test('ingestion enabled -> will send the signal', async ({ page }) => {
21+
await indexPage.loadAndWait(page, basicEdgeFn, {
22+
enableSignalsIngestion: true,
23+
})
24+
25+
await Promise.all([
26+
indexPage.fillNameInput('John Doe'),
27+
indexPage.waitForSignalsApiFlush(),
28+
])
29+
30+
await waitForCondition(
31+
() => indexPage.signalsAPI.getEvents('interaction').length > 0,
32+
{ errorMessage: 'No interaction signals found' }
33+
)
34+
35+
const interactionSignals = indexPage.signalsAPI.getEvents('interaction')
36+
expect(interactionSignals.length > 0)
37+
})

0 commit comments

Comments
 (0)