-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy path2_initial_layout_spec.js
More file actions
61 lines (60 loc) · 1.8 KB
/
2_initial_layout_spec.js
File metadata and controls
61 lines (60 loc) · 1.8 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
describe("Initial Layout", () => {
it("has a header reading Rick & Morty", () => {
cy.get("h1:first-of-type").should("have.text", "Rick & Morty");
});
it("has a header containing two children", () => {
cy.get("header")
.should("exist")
.get("header")
.children()
.should("have.length", 2);
});
it("has a header containing the Rick And Morty image", () => {
cy.get("img").should("exist");
cy.get("img")
.should("have.attr", "src")
.should("include", "/assets/rickAndMorty.png");
});
it("has a ul for all-characters", () => {
cy.get("#all-characters").should("exist");
});
it("has a ul containing li's for each character on the first page", () => {
cy.get("#all-characters").children().should("have.length", 20);
cy.get("#all-characters")
.children()
.then((options) => {
const actual = [...options]
.map((o) => o.innerText)
.filter((el) => el !== "");
const expected = [
"Rick Sanchez",
"Morty Smith",
"Summer Smith",
"Beth Smith",
"Jerry Smith",
"Abadango Cluster Princess",
"Abradolf Lincler",
"Adjudicator Rick",
"Agency Director",
"Alan Rails",
"Albert Einstein",
"Alexander",
"Alien Googah",
"Alien Morty",
"Alien Rick",
"Amish Cyborg",
"Annie",
"Antenna Morty",
"Antenna Rick",
"Ants in my Eyes Johnson",
];
expect(actual.sort()).to.deep.eq(expected.sort());
});
});
it("has a no starting main area", () => {
cy.get("main").should("not.visible");
});
it("has a starting title that reads Szechuan Sauce", () => {
cy.get("title").contains("Szechuan Sauce");
});
});