diff --git a/tests/setup.ts b/tests/setup.ts index ccbd4a9..467b359 100644 --- a/tests/setup.ts +++ b/tests/setup.ts @@ -33,3 +33,11 @@ test("record test with a joke and postprocess", async ({ page, advancedRouteFrom await page.waitForSelector("text=This is a joke"); await page.close(); }); + + +test("record not embedded", async ({ page, advancedRouteFromHAR }) => { + await advancedRouteFromHAR("tests/har/temp/not-embedded.har", { + update: true, + }); + await page.goto("https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,sexist,explicit"); +}); diff --git a/tests/test.spec.ts b/tests/test.spec.ts index ad8b0e1..51f5df4 100644 --- a/tests/test.spec.ts +++ b/tests/test.spec.ts @@ -171,6 +171,16 @@ async function waitForFile(path: string) { throw "can't read file"; } +test("attached content", async ({ page, advancedRouteFromHAR }) => { + await advancedRouteFromHAR("tests/har/temp/not-embedded.har", { + matcher: (request, entry) => { + expect(entry.response.content.text).toBeTruthy(); + return defaultMatcher(request, entry); + } + }); + await page.goto("https://v2.jokeapi.dev/joke/Any?blacklistFlags=nsfw,religious,political,racist,sexist,explicit"); +}); + test("test a joke recording with postprocess", async ({ page, advancedRouteFromHAR }) => { await advancedRouteFromHAR("tests/har/temp/joke-postprocess.har", { update: true,