diff --git a/test/e2e/basic.test.ts b/test/e2e/basic.test.ts index 0c933957..f90d8997 100644 --- a/test/e2e/basic.test.ts +++ b/test/e2e/basic.test.ts @@ -149,3 +149,34 @@ describe('basic', () => { expect(text).toMatchInlineSnapshot(`"/_scripts/6nd5bD9YCW.js"`) }) }) + +describe('third-party-capital', () => { + it('expect GA to collect data', { + timeout: 10000, + }, async () => { + const page = await createPage('/tpc/ga') + await page.waitForTimeout(500) + + // wait for the collect request or timeout + const request = page.waitForRequest(request => request.url().includes('google-analytics.com/g/collect'), { + timeout: 10000, + }) + await page.getByText('Trigger conversion').click() + + await request + }) + + it('expect GTM to work collect data', { + timeout: 10000, + }, async () => { + const page = await createPage('/tpc/gtm') + await page.waitForTimeout(500) + + // wait for the collect request + const request = page.waitForRequest(request => request.url().includes('analytics.google.com/g/collect?'), { + timeout: 10000, + }) + await page.getByText('trigger').click() + await request + }) +}) diff --git a/test/fixtures/basic/pages/tpc/ga.vue b/test/fixtures/basic/pages/tpc/ga.vue new file mode 100644 index 00000000..73686db4 --- /dev/null +++ b/test/fixtures/basic/pages/tpc/ga.vue @@ -0,0 +1,28 @@ + + + diff --git a/test/fixtures/basic/pages/tpc/gtm.vue b/test/fixtures/basic/pages/tpc/gtm.vue new file mode 100644 index 00000000..15c419ab --- /dev/null +++ b/test/fixtures/basic/pages/tpc/gtm.vue @@ -0,0 +1,28 @@ + + +