-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93bf465
commit e238b8b
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...ges/signals/signals-integration-tests/src/tests/signals-vanilla/signals-ingestion.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { waitForCondition } from '../../helpers/playwright-utils' | ||
import { IndexPage } from './index-page' | ||
|
||
const indexPage = new IndexPage() | ||
|
||
const basicEdgeFn = `const processSignal = (signal) => {}` | ||
|
||
test('ingestion not enabled -> will not send the signal', async ({ page }) => { | ||
await indexPage.loadAndWait(page, basicEdgeFn, { | ||
enableSignalsIngestion: false, | ||
}) | ||
|
||
await indexPage.fillNameInput('John Doe') | ||
const promise = await indexPage.waitForSignalsApiFlush() | ||
|
||
await expect(promise).rejects.toThrow() | ||
}) | ||
|
||
test('ingestion enabled -> will send the signal', async ({ page }) => { | ||
await indexPage.loadAndWait(page, basicEdgeFn, { | ||
enableSignalsIngestion: true, | ||
}) | ||
|
||
await Promise.all([ | ||
indexPage.fillNameInput('John Doe'), | ||
indexPage.waitForSignalsApiFlush(), | ||
]) | ||
|
||
await waitForCondition( | ||
() => indexPage.signalsAPI.getEvents('interaction').length > 0, | ||
{ errorMessage: 'No interaction signals found' } | ||
) | ||
|
||
const interactionSignals = indexPage.signalsAPI.getEvents('interaction') | ||
expect(interactionSignals.length > 0) | ||
}) |