-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
43 changes: 43 additions & 0 deletions
43
...ages/signals/signals-integration-tests/src/tests/custom-elements/custom-textfield.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,43 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { waitForCondition } from '../../helpers/playwright-utils' | ||
import { IndexPage } from './index-page' | ||
|
||
const basicEdgeFn = `const processSignal = (signal) => {}` | ||
|
||
test('Collecting signals whenever a user enters text input and focuses out', async ({ | ||
page, | ||
}) => { | ||
const indexPage = await new IndexPage().loadAndWait(page, basicEdgeFn, { | ||
disableSignalsRedaction: true, | ||
enableSignalsIngestion: true, | ||
}) | ||
const fillAndConfirm = async (selector: string, text: string) => { | ||
await page.fill(selector, text) | ||
await page.keyboard.press('Enter') | ||
} | ||
await Promise.all([ | ||
fillAndConfirm('[data-testid="aria-text-field"]', 'John Doe'), | ||
waitForCondition( | ||
() => indexPage.signalsAPI.getEvents('interaction').length > 0, | ||
{ errorMessage: 'No interaction signals found' } | ||
), | ||
]) | ||
const interactionSignals = indexPage.signalsAPI.getEvents('interaction') | ||
|
||
const data = expect.objectContaining({ | ||
eventType: 'change', | ||
listener: 'mutation', | ||
change: { | ||
value: 'John Doe', | ||
}, | ||
target: expect.objectContaining({ | ||
attributes: expect.objectContaining({ | ||
type: 'text', | ||
value: 'John Doe', | ||
}), | ||
tagName: 'INPUT', | ||
value: 'John Doe', | ||
}), | ||
}) | ||
expect(interactionSignals[0].properties!.data).toMatchObject(data) | ||
}) |
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