]>
Commit | Line | Data |
---|---|---|
5ab7fd9d | 1 | import { by, element, browser } from 'protractor' |
e69cb173 C |
2 | |
3 | export class MyAccountPage { | |
4 | ||
5 | navigateToMyVideos () { | |
17119e4a | 6 | return element(by.css('a[href="/my-library/videos"]')).click() |
e69cb173 C |
7 | } |
8 | ||
9 | navigateToMyPlaylists () { | |
17119e4a | 10 | return element(by.css('a[href="/my-library/video-playlists"]')).click() |
e69cb173 C |
11 | } |
12 | ||
13 | navigateToMyHistory () { | |
17119e4a | 14 | return element(by.css('a[href="/my-library/history/videos"]')).click() |
e69cb173 C |
15 | } |
16 | ||
17 | // My account Videos | |
18 | ||
6b88559b C |
19 | async removeVideo (name: string) { |
20 | const container = this.getVideoElement(name) | |
21 | ||
22 | await container.element(by.css('.dropdown-toggle')).click() | |
23 | ||
24 | const dropdownMenu = container.element(by.css('.dropdown-menu .dropdown-item:nth-child(2)')) | |
25 | await browser.wait(browser.ExpectedConditions.presenceOf(dropdownMenu)) | |
26 | ||
27 | return dropdownMenu.click() | |
e69cb173 C |
28 | } |
29 | ||
30 | validRemove () { | |
31 | return element(by.css('.action-button-submit')).click() | |
32 | } | |
33 | ||
bbe078ba C |
34 | countVideos (names: string[]) { |
35 | return element.all(by.css('.video')) | |
36 | .filter(e => { | |
37 | return e.element(by.css('.video-miniature-name')) | |
38 | .getText() | |
39 | .then(t => names.some(n => t.includes(n))) | |
40 | }) | |
41 | .count() | |
e69cb173 C |
42 | } |
43 | ||
44 | // My account playlists | |
45 | ||
bbe078ba C |
46 | getPlaylistVideosText (name: string) { |
47 | return this.getPlaylist(name).element(by.css('.miniature-playlist-info-overlay')).getText() | |
e69cb173 C |
48 | } |
49 | ||
bbe078ba C |
50 | clickOnPlaylist (name: string) { |
51 | return this.getPlaylist(name).element(by.css('.miniature-thumbnail')).click() | |
e69cb173 C |
52 | } |
53 | ||
54 | countTotalPlaylistElements () { | |
55 | return element.all(by.css('my-video-playlist-element-miniature')).count() | |
56 | } | |
57 | ||
58 | playPlaylist () { | |
59 | return element(by.css('.playlist-info .miniature-thumbnail')).click() | |
60 | } | |
61 | ||
5ab7fd9d C |
62 | async goOnAssociatedPlaylistEmbed () { |
63 | let url = await browser.getCurrentUrl() | |
64 | url = url.replace('/videos/watch/playlist/', '/video-playlists/embed/') | |
65 | url = url.replace(':3333', ':9001') | |
66 | ||
67 | return browser.get(url) | |
68 | } | |
69 | ||
e69cb173 C |
70 | // My account Videos |
71 | ||
bbe078ba C |
72 | private getVideoElement (name: string) { |
73 | return element.all(by.css('.video')) | |
74 | .filter(e => e.element(by.css('.video-miniature-name')).getText().then(t => t.includes(name))) | |
75 | .first() | |
e69cb173 C |
76 | } |
77 | ||
78 | // My account playlists | |
79 | ||
bbe078ba C |
80 | private getPlaylist (name: string) { |
81 | return element.all(by.css('my-video-playlist-miniature')) | |
82 | .filter(e => e.element(by.css('.miniature-name')).getText().then(t => t.includes(name))) | |
83 | .first() | |
e69cb173 C |
84 | } |
85 | } |