|
| 1 | +let localUrls = []; |
| 2 | +let liveUrls = []; |
| 3 | +before(() => { |
| 4 | + cy.request({ |
| 5 | + url: "https://docs.appseed.us/sitemap.xml", |
| 6 | + headers: { |
| 7 | + "Content-Type": "text/xml; charset=utf-8", |
| 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", |
| 9 | + }, |
| 10 | + }) |
| 11 | + .as("sitemap") |
| 12 | + .then((response) => { |
| 13 | + liveUrls = Cypress.$(response.body) |
| 14 | + .find("loc") |
| 15 | + .toArray() |
| 16 | + .map((el) => el.innerText); |
| 17 | + }); |
| 18 | + cy.request({ |
| 19 | + url: "http://localhost/appSeed2/sitemap.xml", |
| 20 | + headers: { |
| 21 | + "Content-Type": "text/xml; charset=utf-8", |
| 22 | + "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", |
| 23 | + }, |
| 24 | + }) |
| 25 | + .as("sitemap") |
| 26 | + .then((response) => { |
| 27 | + localUrls = Cypress.$(response.body) |
| 28 | + .find("loc") |
| 29 | + .toArray() |
| 30 | + .map((el) => el.innerText); |
| 31 | + }); |
| 32 | +}); |
| 33 | + |
| 34 | +it("Each Live Url should be included in Local sitemap", () => { |
| 35 | + liveUrls.forEach((url) => { |
| 36 | + expect(localUrls).to.include(url); |
| 37 | + }); |
| 38 | +}); |
| 39 | + |
| 40 | +it("should succesfully return status 200 from each url in the sitemap", () => { |
| 41 | + liveUrls.forEach((url) => { |
| 42 | + let url1 = url.split("https://docs.appseed.us"); |
| 43 | + cy.request({ |
| 44 | + url: "http://localhost/appSeed2" + url1[1], |
| 45 | + headers: { |
| 46 | + "Content-Type": "text/html", |
| 47 | + accept: "*/*", |
| 48 | + "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", |
| 49 | + }, |
| 50 | + }).then((resp) => { |
| 51 | + expect(resp.status).to.eq(200); |
| 52 | + }); |
| 53 | + }); |
| 54 | +}); |
| 55 | + |
| 56 | +it("should succesfully load each url in the sitemap", () => { |
| 57 | + liveUrls.forEach((url) => { |
| 58 | + let url1 = url.split("https://docs.appseed.us"); |
| 59 | + |
| 60 | + cy.visit("http://localhost/appSeed2" + url1[1]); |
| 61 | + }); |
| 62 | +}); |
0 commit comments