diff --git a/tests/integrations/gtm/gtm.spec.ts b/tests/integrations/gtm/gtm.spec.ts new file mode 100644 index 00000000..29ebaa5f --- /dev/null +++ b/tests/integrations/gtm/gtm.spec.ts @@ -0,0 +1,13 @@ +import { test, expect } from '@playwright/test'; + +test('gtm', async ({ page }) => { + await page.goto('/integrations/gtm/'); + + await page.waitForSelector('.completed'); + + const buttonDataLayerPush = page.locator('#buttonDataLayerPush'); + await buttonDataLayerPush.click(); + + const testDataLayer = page.locator('#testDataLayer'); + await expect(testDataLayer).toHaveText('pushed'); +}); diff --git a/tests/integrations/gtm/index.html b/tests/integrations/gtm/index.html index 1f68a940..59fc951b 100644 --- a/tests/integrations/gtm/index.html +++ b/tests/integrations/gtm/index.html @@ -42,6 +42,9 @@ // gtmScript.src = './gtm.js?id=' + i + dataLayer; firstScript.parentNode.insertBefore(gtmScript, firstScript); + + document.body.classList.add('completed'); + })(window, document, 'GTM-W275NLW'); @@ -93,14 +96,21 @@
+ dataLayer.push + +
+ diff --git a/tests/platform/anchor/index.html b/tests/platform/anchor/index.html index 5691b769..e02bda2d 100644 --- a/tests/platform/anchor/index.html +++ b/tests/platform/anchor/index.html @@ -54,6 +54,7 @@