]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/e2e/src/po/my-account.ts
Translated using Weblate (Italian)
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / my-account.ts
CommitLineData
5ab7fd9d 1import { by, element, browser } from 'protractor'
e69cb173
C
2
3export 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
5ab7fd9d
C
55 async goOnAssociatedPlaylistEmbed () {
56 let url = await browser.getCurrentUrl()
57 url = url.replace('/videos/watch/playlist/', '/video-playlists/embed/')
58 url = url.replace(':3333', ':9001')
59
60 return browser.get(url)
61 }
62
e69cb173
C
63 // My account Videos
64
bbe078ba
C
65 private getVideoElement (name: string) {
66 return element.all(by.css('.video'))
67 .filter(e => e.element(by.css('.video-miniature-name')).getText().then(t => t.includes(name)))
68 .first()
e69cb173
C
69 }
70
71 // My account playlists
72
bbe078ba
C
73 private getPlaylist (name: string) {
74 return element.all(by.css('my-video-playlist-miniature'))
75 .filter(e => e.element(by.css('.miniature-name')).getText().then(t => t.includes(name)))
76 .first()
e69cb173
C
77 }
78}