Skip to content

Commit 35349f4

Browse files
committed
wip
1 parent 6405f93 commit 35349f4

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { test, expect } from '@playwright/test'
2+
import { waitForCondition } from '../../helpers/playwright-utils'
3+
import { IndexPage } from './index-page'
4+
5+
const basicEdgeFn = `const processSignal = (signal) => {}`
6+
7+
test('Collecting signals whenever a user enters text input and focuses out', async ({
8+
page,
9+
}) => {
10+
const indexPage = await new IndexPage().loadAndWait(page, basicEdgeFn, {
11+
disableSignalsRedaction: true,
12+
enableSignalsIngestion: true,
13+
})
14+
const fillAndConfirm = async (selector: string, text: string) => {
15+
await page.fill(selector, text)
16+
await page.keyboard.press('Enter')
17+
}
18+
await Promise.all([
19+
fillAndConfirm('[data-testid="aria-text-field"]', 'John Doe'),
20+
waitForCondition(
21+
() => indexPage.signalsAPI.getEvents('interaction').length > 0,
22+
{ errorMessage: 'No interaction signals found' }
23+
),
24+
])
25+
const interactionSignals = indexPage.signalsAPI.getEvents('interaction')
26+
27+
const data = expect.objectContaining({
28+
eventType: 'change',
29+
listener: 'mutation',
30+
change: {
31+
value: 'John Doe',
32+
},
33+
target: expect.objectContaining({
34+
attributes: expect.objectContaining({
35+
type: 'text',
36+
value: 'John Doe',
37+
}),
38+
tagName: 'INPUT',
39+
value: 'John Doe',
40+
}),
41+
})
42+
expect(interactionSignals[0].properties!.data).toMatchObject(data)
43+
})

packages/signals/signals-integration-tests/webpack.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const files = globby.sync('src/tests/*/index.bundle.{ts,tsx}', {
77
cwd: __dirname,
88
})
99

10+
// e.g if file is src/tests/signals-vanilla/index.bundle.ts, then entry is { signals-vanilla: src/tests/signals-vanilla/index.bundle.ts }
1011
const entries = files.reduce((acc, file) => {
1112
const [dirName] = file.split('/').slice(-2)
1213
const base = path.basename(dirName)

0 commit comments

Comments
 (0)