microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
65.89k stars 3.59k forks source link

[BUG] Snowplow route not returning postData #27122

Closed corr155 closed 1 year ago

corr155 commented 1 year ago

System info

Source code

Test.spec.ts

test("Send a snowplow event when company.com loads", async ({ page }) => {
  await page.route(
    "https://snowplow-dev.company.com/com.snowplowanalytics.snowplow/tp2**",
    async (route, request) => {
      const postData = JSON.parse(request.postData() ?? "{}");

      expect(postData[0]).toBeDefined()

      route.fulfill({
        body: "ok",
      });
    }
  );
 await page.getByLabel("widget").click();
});

Here is the network call with data in the body

Request URL:
https://snowplow.company.com/com.snowplowanalytics.snowplow/tp2
Request Method:
POST
Status Code:
200
Remote Address:
54.243.140.170:443
Referrer Policy:
strict-origin-when-cross-origin
Access-Control-Allow-Credentials:
true
Access-Control-Allow-Origin:
https://www.company.com
Content-Length:
2
Content-Type:
text/plain; charset=UTF-8
Date:
Fri, 15 Sep 2023 14:39:23 GMT
P3p:
policyref="/w3c/p3p.xml", CP="NOI DSP COR NID PSA OUR IND COM NAV STA"
Server:
akka-http/10.1.12
Set-Cookie:
collector_cookie=f6538c85-b66c-4859-8f4e-a1017c92755f; Expires=Sat, 14 Sep 2024 14:39:23 GMT; Path=/
:authority:
snowplow.company.com
:method:
POST
:path:
/com.snowplowanalytics.snowplow/tp2
:scheme:
https
Accept:
*/*
Accept-Encoding:
gzip, deflate, br
Accept-Language:
en-US,en;q=0.9
Content-Length:
1235
Content-Type:
application/json
Origin:
https://www.company.com
Referer:
https://www.company.com/
Sec-Ch-Ua:
"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"
Sec-Ch-Ua-Mobile:
?0
Sec-Ch-Ua-Platform:
"macOS"
Sec-Fetch-Dest:
empty
Sec-Fetch-Mode:
cors
Sec-Fetch-Site:
cross-site
User-Agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Here is the payload

{"schema":"iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4","data":[{"se_ca":"pageActions","se_ac":"render","se_pr":"{\"appVersion\":\"1.0.0\",\"betaName\":\"1.0.0\",\"gid\":\"0\",\"contentSelector\":\".single .entry-content\"}","aid":"aid","cd":"24","cookie":"1","cs":"UTF-8","dtm":"1694788762769","ds":"1905x9284","duid":"duid","e":"se","eid":"id","lang":"en-US","p":"web","refr":"https://www.google.com/","res":"1920x1080","sid":"sid","tna":"prod","tv":"0.1.0","tz":"America/New_York","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36","url":"https://www.company.com/","vid":"1","vp":"1920x663","stm":"1694788762769"}]}

Steps

Expected

Actual

dgozman commented 1 year ago

@corr155 Could you please provide a repro that we can run locally? https://snowplow.company.com does not load for me.

Most likely, this is a duplicate of #6479, so unless there is a repro, I am going to merge it in.

aslushnikov commented 1 year ago

Looks like the discussion has stalled here, so I'll close this. If you still think we can be helpful, then please feel free to file a new issue!