diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-15 15:58:10 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-16 10:08:55 +0100 |
commit | a9bfa85d2cdf13670aaced740da5b493fbeddfce (patch) | |
tree | 3781c9218d4cc7786b6589365c0efbed2151703d /client/e2e/src/po/my-account.ts | |
parent | c77fdc605b3ccc1ab6890f889d8200fbe9372949 (diff) | |
download | PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.gz PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.zst PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.zip |
Add ability for admins to set default p2p policy
Diffstat (limited to 'client/e2e/src/po/my-account.ts')
-rw-r--r-- | client/e2e/src/po/my-account.ts | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/client/e2e/src/po/my-account.ts b/client/e2e/src/po/my-account.ts deleted file mode 100644 index b51614fd9..000000000 --- a/client/e2e/src/po/my-account.ts +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | import { go } from '../utils' | ||
2 | |||
3 | export class MyAccountPage { | ||
4 | |||
5 | navigateToMyVideos () { | ||
6 | return $('a[href="/my-library/videos"]').click() | ||
7 | } | ||
8 | |||
9 | navigateToMyPlaylists () { | ||
10 | return $('a[href="/my-library/video-playlists"]').click() | ||
11 | } | ||
12 | |||
13 | navigateToMyHistory () { | ||
14 | return $('a[href="/my-library/history/videos"]').click() | ||
15 | } | ||
16 | |||
17 | // Settings | ||
18 | |||
19 | navigateToMySettings () { | ||
20 | return $('a[href="/my-account"]').click() | ||
21 | } | ||
22 | |||
23 | async updateNSFW (newValue: 'do_not_list' | 'blur' | 'display') { | ||
24 | const nsfw = $('#nsfwPolicy') | ||
25 | |||
26 | await nsfw.waitForDisplayed() | ||
27 | await nsfw.scrollIntoView(false) // Avoid issues with fixed header on firefox | ||
28 | await nsfw.selectByAttribute('value', newValue) | ||
29 | |||
30 | const submit = $('my-user-video-settings input[type=submit]') | ||
31 | await submit.scrollIntoView(false) | ||
32 | await submit.click() | ||
33 | } | ||
34 | |||
35 | // My account Videos | ||
36 | |||
37 | async removeVideo (name: string) { | ||
38 | const container = await this.getVideoElement(name) | ||
39 | |||
40 | await container.$('.dropdown-toggle').click() | ||
41 | |||
42 | const dropdownMenu = () => container.$$('.dropdown-menu .dropdown-item')[1] | ||
43 | |||
44 | await dropdownMenu().waitForDisplayed() | ||
45 | return dropdownMenu().click() | ||
46 | } | ||
47 | |||
48 | validRemove () { | ||
49 | return $('input[type=submit]').click() | ||
50 | } | ||
51 | |||
52 | async countVideos (names: string[]) { | ||
53 | const elements = await $$('.video').filter(async e => { | ||
54 | const t = await e.$('.video-miniature-name').getText() | ||
55 | |||
56 | return names.some(n => t.includes(n)) | ||
57 | }) | ||
58 | |||
59 | return elements.length | ||
60 | } | ||
61 | |||
62 | // My account playlists | ||
63 | |||
64 | async getPlaylistVideosText (name: string) { | ||
65 | const elem = await this.getPlaylist(name) | ||
66 | |||
67 | return elem.$('.miniature-playlist-info-overlay').getText() | ||
68 | } | ||
69 | |||
70 | async clickOnPlaylist (name: string) { | ||
71 | const elem = await this.getPlaylist(name) | ||
72 | |||
73 | return elem.$('.miniature-thumbnail').click() | ||
74 | } | ||
75 | |||
76 | async countTotalPlaylistElements () { | ||
77 | await $('<my-video-playlist-element-miniature>').waitForDisplayed() | ||
78 | |||
79 | return $$('<my-video-playlist-element-miniature>').length | ||
80 | } | ||
81 | |||
82 | playPlaylist () { | ||
83 | return $('.playlist-info .miniature-thumbnail').click() | ||
84 | } | ||
85 | |||
86 | async goOnAssociatedPlaylistEmbed () { | ||
87 | let url = await browser.getUrl() | ||
88 | url = url.replace('/w/p/', '/video-playlists/embed/') | ||
89 | url = url.replace(':3333', ':9001') | ||
90 | |||
91 | return go(url) | ||
92 | } | ||
93 | |||
94 | // My account Videos | ||
95 | |||
96 | private async getVideoElement (name: string) { | ||
97 | const video = async () => { | ||
98 | const videos = await $$('.video').filter(async e => { | ||
99 | const t = await e.$('.video-miniature-name').getText() | ||
100 | |||
101 | return t.includes(name) | ||
102 | }) | ||
103 | |||
104 | return videos[0] | ||
105 | } | ||
106 | |||
107 | await browser.waitUntil(async () => { | ||
108 | return (await video()).isDisplayed() | ||
109 | }) | ||
110 | |||
111 | return video() | ||
112 | } | ||
113 | |||
114 | // My account playlists | ||
115 | |||
116 | private async getPlaylist (name: string) { | ||
117 | const playlist = () => { | ||
118 | return $$('my-video-playlist-miniature') | ||
119 | .filter(async e => { | ||
120 | const t = await e.$('.miniature-name').getText() | ||
121 | |||
122 | return t.includes(name) | ||
123 | }) | ||
124 | .then(elems => elems[0]) | ||
125 | } | ||
126 | |||
127 | await browser.waitUntil(async () => { | ||
128 | const el = await playlist() | ||
129 | |||
130 | return el?.isDisplayed() | ||
131 | }) | ||
132 | |||
133 | return playlist() | ||
134 | } | ||
135 | } | ||