-
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.
- Loading branch information
Showing
73 changed files
with
1,495 additions
and
408 deletions.
There are no files selected for viewing
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,4 @@ | ||
--- | ||
'@segment/analytics-signals-runtime': major | ||
--- | ||
Release analytics-signals-runtime |
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,4 @@ | ||
--- | ||
'@segment/analytics-signals': minor | ||
--- | ||
Refactor runtime to use `@segment/analytics-signals-runtime` |
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
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
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
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
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
6 changes: 2 additions & 4 deletions
6
.../signals/signals-integration-tests/src/tests/signals-vanilla/button-click-complex.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
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
4 changes: 1 addition & 3 deletions
4
...ls/signals-integration-tests/src/tests/signals-vanilla/network-signals-allow-list.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
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
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
44 changes: 44 additions & 0 deletions
44
...ges/signals/signals-integration-tests/src/tests/signals-vanilla/runtime-constants.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,44 @@ | ||
import { test, expect } from '@playwright/test' | ||
import { IndexPage } from './index-page' | ||
|
||
const basicEdgeFn = ` | ||
const processSignal = (signal) => { | ||
// test that constants are properly injected | ||
if (typeof EventType !== 'object') { | ||
throw new Error('EventType is missing?') | ||
} | ||
if (typeof SignalType !== 'object') { | ||
throw new Error('SignalType is missing?') | ||
} | ||
if (typeof NavigationAction !== 'object') { | ||
throw new Error('NavigationAction is missing?') | ||
} | ||
if (signal.type === SignalType.Interaction) { | ||
const eventName = signal.data.eventType + ' ' + '[' + signal.type + ']' | ||
analytics.track(eventName, signal.data) | ||
} | ||
}` | ||
|
||
let indexPage: IndexPage | ||
|
||
test.beforeEach(async ({ page }) => { | ||
indexPage = await new IndexPage().loadAndWait(page, basicEdgeFn) | ||
}) | ||
|
||
test('constants should be accessible in the runtime', async () => { | ||
/** | ||
* Make a button click, see ifdom.window.NavigationAction.URLChange it: | ||
* - creates an interaction signal that sends to the signals endpoint | ||
* - creates an analytics event that sends to the tracking endpoint | ||
*/ | ||
await Promise.all([ | ||
indexPage.clickButton(), | ||
indexPage.waitForTrackingApiFlush(), | ||
]) | ||
|
||
const analyticsReqJSON = indexPage.trackingAPI.lastEvent() | ||
expect(analyticsReqJSON).toMatchObject({ | ||
event: 'click [interaction]', | ||
}) | ||
}) |
Oops, something went wrong.