You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! Thank you for this adapter - it works great for recording GET requests but I am having trouble with POST requests - namely getting the request body to be passed along through polly.
I am configuring the adapter with playwright by overriding the playwright page fixture like so:
import { test as base } from "@playwright/test";
import { Polly } from "@pollyjs/core";
import FSPersister from "@pollyjs/persister-fs";
import { PlaywrightAdapter } from "polly-adapter-playwright";
const test = base.extend<{ polly: Polly }>({
page: async ({ page }, use, testInfo) => {
Polly.register(PlaywrightAdapter);
Polly.register(FSPersister);
const polly = new Polly(testInfo.titlePath[0], {
adapters: ["playwright"],
adapterOptions: {
playwright: {
context: page,
},
},
recordFailedRequests: true,
persister: "fs",
persisterOptions: {
fs: {
recordingsDir: "./tests/recordings",
},
},
recordIfMissing: true,
matchRequestsBy: {
headers: false,
body: false,
},
});
await use(page);
await polly.stop();
},
});
export default test;
but when I inspect this request.postData() I am finding it always to be null, even though the original request has the body as expected which I can see in the DevTools network tab (request and payload covered up):
Do you think this is a potential issue with the playwright type not returning the correct post body data or should we be trying to grab this from elsewhere in the adapter?
thank you!
The text was updated successfully, but these errors were encountered:
thanks for opening this issue and i think you're indeed correct. it's highly likely that request.postData() being null is the consequence of a chromium bug unfortunately, see microsoft/playwright#6479 and microsoft/playwright#9648 for more details.
ah i see - thank you for the prompt response and links to the sources - looks like it is finally being worked on but I suppose I'll just switch to firefox or webkit for now.
Hello! Thank you for this adapter - it works great for recording
GET
requests but I am having trouble withPOST
requests - namely getting the request body to be passed along through polly.I am configuring the adapter with playwright by overriding the playwright page fixture like so:
I see that this is where we pass the body from the original request:
https://github.com/redabacha/polly-adapter-playwright/blob/main/src/PlaywrightAdapter.ts#L103
but when I inspect this
request.postData()
I am finding it always to benull
, even though the original request has the body as expected which I can see in the DevTools network tab (request and payload covered up):Do you think this is a potential issue with the playwright type not returning the correct post body data or should we be trying to grab this from elsewhere in the adapter?
thank you!
The text was updated successfully, but these errors were encountered: