mirror of
https://github.com/plausible/analytics.git
synced 2024-12-27 03:21:37 +03:00
43bf7dd09f
* Use user-agent instead of screen_width to get device type Co-authored-by: eriknakata <erik.nakata5@gmail.com> * Fix credo * Log on unhandled UAInspector device type * Make 'browser' the default tab in devices report * Remove device tooltip * Remove screen_width from ingestion completely * Remove browserstack harness, run playwright directly * Select meta key based on OS platform * Run CI tests in parallel * Improve device match readability * Add changelog --------- Co-authored-by: eriknakata <erik.nakata5@gmail.com>
40 lines
1.8 KiB
JavaScript
40 lines
1.8 KiB
JavaScript
const { mockRequest, mockManyRequests, expectCustomEvent } = require('./support/test-utils');
|
|
const { expect, test } = require('@playwright/test');
|
|
const { LOCAL_SERVER_ADDR } = require('./support/server');
|
|
|
|
|
|
test.describe('script.file-downloads.outbound-links.tagged-events.js', () => {
|
|
test('sends only outbound link event when clicked link is both download and outbound', async ({ page }) => {
|
|
await page.goto('/custom-event-edge-case.html')
|
|
const downloadURL = await page.locator('#outbound-download-link').getAttribute('href')
|
|
|
|
const plausibleRequestMockList = mockManyRequests(page, '/api/event', 2)
|
|
await page.click('#outbound-download-link')
|
|
|
|
const requests = await plausibleRequestMockList
|
|
expect(requests.length).toBe(1)
|
|
expectCustomEvent(requests[0], 'Outbound Link: Click', {url: downloadURL})
|
|
});
|
|
|
|
test('sends file download event when local download link clicked', async ({ page }) => {
|
|
await page.goto('/custom-event-edge-case.html')
|
|
const downloadURL = LOCAL_SERVER_ADDR + '/' + await page.locator('#local-download').getAttribute('href')
|
|
|
|
const plausibleRequestMock = mockRequest(page, '/api/event')
|
|
await page.click('#local-download')
|
|
|
|
expectCustomEvent(await plausibleRequestMock, 'File Download', {url: downloadURL})
|
|
});
|
|
|
|
test('sends only tagged event when clicked link is tagged + outbound + download', async ({ page }) => {
|
|
await page.goto('/custom-event-edge-case.html')
|
|
|
|
const plausibleRequestMockList = mockManyRequests(page, '/api/event', 3)
|
|
await page.click('#tagged-outbound-download-link')
|
|
|
|
const requests = await plausibleRequestMockList
|
|
expect(requests.length).toBe(1)
|
|
expectCustomEvent(requests[0], 'Foo', {})
|
|
});
|
|
});
|