-
-
Notifications
You must be signed in to change notification settings - Fork 391
/
discover.page.ts
80 lines (61 loc) · 1.77 KB
/
discover.page.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { BasePage } from "../base.page";
class DiscoverCard {
private id: string;
private movie: boolean;
constructor(id: string, movie: boolean) {
this.id = id;
this.movie = movie;
}
get topLevelCard(): Cypress.Chainable<any> {
return cy.get(`#result${this.id}`);
}
get requestType(): Cypress.Chainable<any> {
return cy.get(`#type${this.id}`);
}
get statusClass(): Cypress.Chainable<any> {
return cy.get(`#status${this.id}`);
}
get availabilityText(): Cypress.Chainable<any> {
return cy.get(`#availabilityStatus${this.id}`);
}
get title(): Cypress.Chainable<any> {
return cy.get(`#title${this.id}`);
}
get overview(): Cypress.Chainable<any> {
return cy.get(`#overview${this.id}`);
}
get requestButton(): Cypress.Chainable<any> {
return cy.get(`#requestButton${this.id}${this.movie ? '1' : '0'}`);
}
verifyTitle(expected: string): Cypress.Chainable<any> {
return this.title.should('have.text',expected);
}
}
class CarouselComponent {
private type: string;
get combinedButton(): Cypress.Chainable<any> {
return cy.get(`#${this.type}Combined-button`);
}
get movieButton(): Cypress.Chainable<any> {
return cy.get(`#${this.type}Movie-button`);
}
get tvButton(): Cypress.Chainable<any> {
return cy.get(`#${this.type}Tv-button`);
}
getCard(id: string, movie: boolean): DiscoverCard {
return new DiscoverCard(id, movie);
}
constructor(id: string) {
this.type = id;
}
}
class DiscoverPage extends BasePage {
popularCarousel = new CarouselComponent("popular");
constructor() {
super();
}
visit(options?: Cypress.VisitOptions): Cypress.Chainable<Cypress.AUTWindow> {
return cy.visit(`/discover`, options);
}
}
export const discoverPage = new DiscoverPage();