-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathsitemap-slow.cy.ts
36 lines (34 loc) · 1.08 KB
/
sitemap-slow.cy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Cypress.on("uncaught:exception", (err, runnable) => {
return false;
});
describe("Sitemap Slow Check", () => {
// this is needed cause sitemap urls have redirects to other domains
it("should succesfully load each url in the sitemap", () => {
cy.request({
url: "https://www.vercel.com/sitemap.xml",
headers: {
"Content-Type": "text/xml; charset=utf-8",
"user-agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
},
})
.as("sitemap")
.then((response) => {
const urls = Cypress.$(response.body)
.find("loc")
.toArray()
.map((el) => el.innerText);
urls.forEach((url) => {
cy.window().then((win) => {
return win.open(url, "_self");
});
});
});
});
// this would work if the sitemap doesnt have any redirects to other domains
// it("should succesfully load each url in the sitemap", () => {
// urls.forEach((url) => {
// cy.visit(url);
// });
// });
});