Skip to content

Commit ce4ba61

Browse files
committed
#3414 webpage: use correct accept header in sitemap test
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent 3dae0c6 commit ce4ba61

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

webpage/tests/sitemap.spec.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
// @ts-check
22
import { test, expect } from "./fixtures.js";
33

4-
test("sitemap", async ({ page, config }) => {
5-
const response = await page.goto(config.baseURL + "/sitemap.xml");
4+
test("sitemap", async ({ request, config }) => {
5+
// Use request API with XML Accept header to get raw XML instead of HTML
6+
const response = await request.get(config.baseURL + "/sitemap.xml", {
7+
headers: {
8+
Accept: "application/xml, text/xml",
9+
},
10+
});
611
expect(response.status()).toBe(200);
712
expect(response.headers()["content-type"]).toContain("xml");
8-
const content = await page.content();
13+
const content = await response.text();
914
expect(content).toContain("<urlset");
1015
expect(content).toContain("<url>");
1116
expect(content).toContain("<loc>");

0 commit comments

Comments
 (0)