From 51f2840498c18cc68b20fe75cf3bfbe0b1216bb3 Mon Sep 17 00:00:00 2001 From: Ben Vinegar <2153+benvinegar@users.noreply.github.com> Date: Thu, 19 Dec 2024 23:04:09 -0500 Subject: [PATCH] Test asserts query string is good --- .../tracker/integration/tracker.spec.ts | 9 ++++++ workspaces/tracker/playwright.config.ts | 29 ++++--------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/workspaces/tracker/integration/tracker.spec.ts b/workspaces/tracker/integration/tracker.spec.ts index c42ef42..2d50b01 100644 --- a/workspaces/tracker/integration/tracker.spec.ts +++ b/workspaces/tracker/integration/tracker.spec.ts @@ -11,4 +11,13 @@ test("tracks outbound requests", async ({ page }) => { // Wait for the request to /collect const request = await collectRequestPromise; expect(request).toBeTruthy(); + + const url = request.url(); + expect(request.method()).toBe("GET"); + + const params = new URLSearchParams(url.split("?")[1]); + expect(params.get("sid")).toBe("your-unique-site-id"); + expect(params.get("h")).toBe("http://localhost"); // drops port + expect(params.get("p")).toBe("/"); + expect(params.get("r")).toBe(""); }); diff --git a/workspaces/tracker/playwright.config.ts b/workspaces/tracker/playwright.config.ts index bc383b2..6d24685 100644 --- a/workspaces/tracker/playwright.config.ts +++ b/workspaces/tracker/playwright.config.ts @@ -30,6 +30,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", + headless: true, }, /* Configure projects for major browsers */ @@ -39,35 +40,15 @@ export default defineConfig({ use: { ...devices["Desktop Chrome"] }, }, - // { - // name: "firefox", - // use: { ...devices["Desktop Firefox"] }, - // }, + { + name: "firefox", + use: { ...devices["Desktop Firefox"] }, + }, { name: "webkit", use: { ...devices["Desktop Safari"] }, }, - - /* Test against mobile viewports. */ - // { - // name: 'Mobile Chrome', - // use: { ...devices['Pixel 5'] }, - // }, - // { - // name: 'Mobile Safari', - // use: { ...devices['iPhone 12'] }, - // }, - - /* Test against branded browsers. */ - // { - // name: 'Microsoft Edge', - // use: { ...devices['Desktop Edge'], channel: 'msedge' }, - // }, - // { - // name: 'Google Chrome', - // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, - // }, ], /* Run your local dev server before starting the tests */