-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathapple-store.cy.ts
47 lines (46 loc) · 1.91 KB
/
apple-store.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
37
38
39
40
41
42
43
44
45
46
47
import { StructuredDataResult } from "../plugins/structured-data-testing-tool";
describe("Apple Structured Data", () => {
it("apple homepage has WebPage, Organization and Website ", () => {
cy.visit("https://www.apple.com");
cy.task("structuredData", {
url: "https://www.apple.com",
schemas: ["WebPage", "Organization", "WebSite"],
}).then((result) => {
const resultSD = result as StructuredDataResult;
expect(resultSD.passed.length).to.equal(3);
expect(resultSD.passed[0].schema).to.equal("WebPage");
expect(resultSD.passed[1].schema).to.equal("Organization");
expect(resultSD.passed[2].schema).to.equal("WebSite");
});
});
it("apple iphone 12 shop page has BreadcrumbList, Product and FAQPage ", () => {
cy.task("structuredData", {
url: "https://www.apple.com/shop/buy-iphone/iphone-12",
schemas: ["BreadcrumbList", "Product", "FAQPage"],
}).then((result) => {
const resultSD = result as StructuredDataResult;
expect(resultSD.passed.length).to.equal(3);
expect(resultSD.passed[0].schema).to.equal("BreadcrumbList");
expect(resultSD.passed[1].schema).to.equal("Product");
expect(resultSD.passed[2].schema).to.equal("FAQPage");
});
});
it("apple latest newsroom article has NewsArticle and BreadcrumbList ", () => {
cy.visit("https://www.apple.com/newsroom/");
cy.get("#everydayfeed > .section-content > .section-tiles")
.find("li")
.first()
.click();
cy.location().then((location) => {
cy.task("structuredData", {
url: location.href,
schemas: ["NewsArticle", "BreadcrumbList"],
}).then((result) => {
const resultSD = result as StructuredDataResult;
expect(resultSD.passed.length).to.equal(2);
expect(resultSD.passed[0].schema).to.equal("NewsArticle");
expect(resultSD.passed[1].schema).to.equal("BreadcrumbList");
});
});
});
});