Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Route method not intercepting HTTP requests in chromium but working with firefox. #23282

Closed
Palash9088 opened this issue May 25, 2023 · 1 comment

Comments

@Palash9088
Copy link

System info

  • Playwright Version: [v1.34.2]
  • Operating System: [All]
  • Browser: [Chromium,Firefox,Webkit]
  • Other info:[Not working with Chromium & Webkit, Working with Firefox]

Source code

test.only("verify Klaviyo integration Modified", async ({ page }) => {
  let help:string = "";
    await page.route(
    "https://a.klaviyo.com/api/track",
    async (route, request) => {
      const networkRequests:string = request.postData()!;
      help = networkRequests; 
      await route.continue();
    });
    await page.goto(
    "https://rohitgupta.wingified.com/klaviyo1.html?id=" + accountId,{
      waitUntil:'networkidle'
    }
  );
  console.log(help); //network request details
  const klaviyoCookies = await page.context().cookies();
  expect(JSON.stringify(klaviyoCookies)).toContain("_vis_opt_exp_35_combi");
  expect(help.includes('"Exp_name":"KLAVIYO - DO NOT DELETE"')).toBeTruthy();
  expect(help.includes('"Var_name"')).toBeTruthy();
});

Config file

import baseConfig from "vwo-playwright-seed/lib/config/base.conf";

const config = baseConfig.config;
config["use"]["baseURL"] = process.env.BASE_URL || "https://app.vwo.com/";
config["projects"] = [
  {
    name: "Chrome",
    use: {
      browserName: "chromium",
    },
  },
  {
    name: "Firefox",
    use: {
      browserName: "firefox",
    },
  },
];
export default config;

Steps

  • [Run the test]
  • [npx playwright test specs/Integration.Spec.ts --project=Chrome]

Expected

-----------------------------18815464218261179702781698581
Content-Disposition: form-data; name="data"

{"event":"VWO","token":"TSR5n6","properties":{"Exp_name":"KLAVIYO - DO NOT DELETE","Var_name":"Variation-1","$use_ip":true,"$is_session_activity":true},"customer_properties":{"$exchange_id":"UKGnAHMG7opQKheXx_c9e6AApF9oEeD8PQQ_Yt1qyOJXWthcyBDClUET7ANQ3krL.TSR5n6","$referrer":{"ts":1685039184,"value":"","first_page":"https://rohitgupta.wingified.com/klaviyo1.html?id=541364"},"$last_referrer":{"ts":1685039184,"value":"","first_page":"https://rohitgupta.wingified.com/klaviyo1.html?id=541364"}}}
-----------------------------18815464218261179702781698581--

-----------------------------18815464218261179702781698581                                                                     
Content-Disposition: form-data; name="data"

{"event":"VWO","token":"TSR5n6","properties":{"Exp_name":"KLAVIYO - DO NOT DELETE","Var_name":"Variation-1","$use_ip":true,"$is_session_activity":true},"customer_properties":{"$exchange_id":"UKGnAHMG7opQKheXx_c9e6AApF9oEeD8PQQ_Yt1qyOJXWthcyBDClUET7ANQ3krL.TSR5n6","$referrer":{"ts":1685039184,"value":"","first_page":"https://rohitgupta.wingified.com/klaviyo1.html?id=541364"},"$last_referrer":{"ts":1685039184,"value":"","first_page":"https://rohitgupta.wingified.com/klaviyo1.html?id=541364"}}}
-----------------------------18815464218261179702781698581--

[Describe expected behavior]
This should be expected behaviour & all assertion should get passed
image

image
This expected result is with firefox browser.

Actual
Even request is not getting intercept in chrome browser same issue with the webkit.
[Describe actual behavior]
Assertions are getting failed as they are not intercepted with the route method with chromium.
image
image

@Palash9088 Palash9088 changed the title [BUG] [BUG] Route method not intercepting HTTP requests in chromium but working with firefox. May 25, 2023
@mxschmitt
Copy link
Member

mxschmitt commented May 30, 2023

PostData is empty to it looks like a duplicate of #6479 which is an upstream Chromium bug. Please upvote it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants