Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Sep 27, 2024
1 parent 5eea4de commit d02df1a
Showing 1 changed file with 44 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,55 @@ const indexPage = new IndexPage()

const basicEdgeFn = `const processSignal = (signal) => {}`

const data = expect.objectContaining({
eventType: 'change',
target: expect.objectContaining({
attributes: expect.objectContaining({
id: 'name',
test('we will redact the value of text input if redaction is disabled', async ({
page,
}) => {
const data = expect.objectContaining({
eventType: 'change',
target: expect.objectContaining({
name: 'name',
type: 'text',
value: 'XXX', // redacted
}),
classList: [],
id: 'name',
labels: [
{
textContent: 'Name:',
},
],
name: 'name',
title: '',
type: 'text',
value: 'John Doe',
textContent: '',
innerText: '',
}),
})

await indexPage.loadAndWait(page, basicEdgeFn, {
disableSignalsRedaction: false,
})
/**
* Click a button with nested text, ensure that that correct text shows up
*/
await Promise.all([
indexPage.fillNameInput(),
indexPage.waitForSignalsApiFlush(),
])

await waitForCondition(
() => indexPage.signalsAPI.getEvents('interaction').length > 0,
{ errorMessage: 'No interaction signals found' }
)
const interactionSignals = indexPage.signalsAPI.getEvents('interaction')

expect(interactionSignals[0]).toMatchObject({
event: 'Segment Signal Generated',
type: 'track',
properties: {
type: 'interaction',
data,
},
})
})

test('we will redact text input', async ({ page }) => {
test('we will NOT redact the value of text input if redaction is enabled', async ({
page,
}) => {
const data = expect.objectContaining({
eventType: 'change',
target: expect.objectContaining({
value: 'John Doe', // noe redacted
}),
})

await indexPage.loadAndWait(page, basicEdgeFn, {
disableSignalsRedaction: true,
})
Expand Down

0 comments on commit d02df1a

Please sign in to comment.