]>
Commit | Line | Data |
---|---|---|
e69cb173 C |
1 | import { by, element } from 'protractor' |
2 | ||
3 | export class MyAccountPage { | |
4 | ||
5 | navigateToMyVideos () { | |
6 | return element(by.css('a[href="/my-account/videos"]')).click() | |
7 | } | |
8 | ||
9 | navigateToMyPlaylists () { | |
10 | return element(by.css('a[href="/my-account/video-playlists"]')).click() | |
11 | } | |
12 | ||
13 | navigateToMyHistory () { | |
14 | return element(by.css('a[href="/my-account/history/videos"]')).click() | |
15 | } | |
16 | ||
17 | // My account Videos | |
18 | ||
bbe078ba C |
19 | removeVideo (name: string) { |
20 | return this.getVideoElement(name).element(by.css('my-delete-button')).click() | |
e69cb173 C |
21 | } |
22 | ||
23 | validRemove () { | |
24 | return element(by.css('.action-button-submit')).click() | |
25 | } | |
26 | ||
bbe078ba C |
27 | countVideos (names: string[]) { |
28 | return element.all(by.css('.video')) | |
29 | .filter(e => { | |
30 | return e.element(by.css('.video-miniature-name')) | |
31 | .getText() | |
32 | .then(t => names.some(n => t.includes(n))) | |
33 | }) | |
34 | .count() | |
e69cb173 C |
35 | } |
36 | ||
37 | // My account playlists | |
38 | ||
bbe078ba C |
39 | getPlaylistVideosText (name: string) { |
40 | return this.getPlaylist(name).element(by.css('.miniature-playlist-info-overlay')).getText() | |
e69cb173 C |
41 | } |
42 | ||
bbe078ba C |
43 | clickOnPlaylist (name: string) { |
44 | return this.getPlaylist(name).element(by.css('.miniature-thumbnail')).click() | |
e69cb173 C |
45 | } |
46 | ||
47 | countTotalPlaylistElements () { | |
48 | return element.all(by.css('my-video-playlist-element-miniature')).count() | |
49 | } | |
50 | ||
51 | playPlaylist () { | |
52 | return element(by.css('.playlist-info .miniature-thumbnail')).click() | |
53 | } | |
54 | ||
55 | // My account Videos | |
56 | ||
bbe078ba C |
57 | private getVideoElement (name: string) { |
58 | return element.all(by.css('.video')) | |
59 | .filter(e => e.element(by.css('.video-miniature-name')).getText().then(t => t.includes(name))) | |
60 | .first() | |
e69cb173 C |
61 | } |
62 | ||
63 | // My account playlists | |
64 | ||
bbe078ba C |
65 | private getPlaylist (name: string) { |
66 | return element.all(by.css('my-video-playlist-miniature')) | |
67 | .filter(e => e.element(by.css('.miniature-name')).getText().then(t => t.includes(name))) | |
68 | .first() | |
e69cb173 C |
69 | } |
70 | } |