mirror of
https://github.com/plausible/analytics.git
synced 2024-11-22 10:43:38 +03:00
2a7d02b6f0
* (cherry-pick) implement scroll depth tracking under pageleave variant * drop unnecessary vars * remove unused require * add scroll depth tests * improve error messages in test util * reevaluate currentDocumentHeight on page load * account for dynamically loaded content when initializing documnent height * remove all semicolons from tracker specs * allow window and document globals in tracker eslint * tweak global tracker dir eslint rules * update comment * reevaluate document height on scroll * add test * remove unneccessary timeout
23 lines
952 B
JavaScript
23 lines
952 B
JavaScript
const { mockRequest, expectCustomEvent } = require('./support/test-utils')
|
|
const { expect, test } = require('@playwright/test')
|
|
|
|
test.describe('with revenue script extension', () => {
|
|
test('sends revenue currency and amount in manual mode', async ({ page }) => {
|
|
const plausibleRequestMock = mockRequest(page, '/api/event')
|
|
await page.goto('/revenue.html')
|
|
await page.click('#manual-purchase')
|
|
|
|
const plausibleRequest = await plausibleRequestMock
|
|
expect(plausibleRequest.postDataJSON()["$"]).toEqual({amount: 15.99, currency: "USD"})
|
|
})
|
|
|
|
test('sends revenue currency and amount with tagged class name', async ({ page }) => {
|
|
const plausibleRequestMock = mockRequest(page, '/api/event')
|
|
await page.goto('/revenue.html')
|
|
await page.click('#tagged-purchase')
|
|
|
|
const plausibleRequest = await plausibleRequestMock
|
|
expect(plausibleRequest.postDataJSON()["$"]).toEqual({amount: "13.32", currency: "EUR"})
|
|
})
|
|
})
|