Skip to content

Commit

Permalink
test: HAR recorded in "attach" mode should have content in the entries
Browse files Browse the repository at this point in the history
  • Loading branch information
NoamGaash committed May 10, 2024
1 parent 0279a8e commit b7b0587
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/setup.ts
Expand Up @@ -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");
});
10 changes: 10 additions & 0 deletions tests/test.spec.ts
Expand Up @@ -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,
Expand Down

0 comments on commit b7b0587

Please sign in to comment.