aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/video-watch.po.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e/src/po/video-watch.po.ts')
-rw-r--r--client/e2e/src/po/video-watch.po.ts67
1 files changed, 5 insertions, 62 deletions
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index c07f4b25f..41425f4d7 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,37 +1,16 @@
1import { FIXTURE_URLS } from '../urls' 1import { browserSleep, FIXTURE_URLS, go } from '../utils'
2import { browserSleep, go } from '../utils'
3 2
4export class VideoWatchPage { 3export class VideoWatchPage {
5 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
6 let url: string
7
8 // We did not upload a file on a mobile device
9 if (isMobileDevice === true || isSafari === true) {
10 url = 'https://peertube2.cpy.re/videos/local'
11 } else {
12 url = '/videos/recently-added'
13 }
14
15 await go(url)
16
17 // Waiting the following element does not work on Safari...
18 if (isSafari) return browserSleep(3000)
19 4
20 await $('.videos .video-miniature .video-miniature-name').waitForDisplayed() 5 constructor (private isMobileDevice: boolean, private isSafari: boolean) {
21 }
22
23 async getVideosListName () {
24 const elems = await $$('.videos .video-miniature .video-miniature-name')
25 const texts = await Promise.all(elems.map(e => e.getText()))
26 6
27 return texts.map(t => t.trim())
28 } 7 }
29 8
30 waitWatchVideoName (videoName: string, isMobileDevice: boolean, isSafari: boolean) { 9 waitWatchVideoName (videoName: string) {
31 if (isSafari) return browserSleep(5000) 10 if (this.isSafari) return browserSleep(5000)
32 11
33 // On mobile we display the first node, on desktop the second 12 // On mobile we display the first node, on desktop the second
34 const index = isMobileDevice ? 0 : 1 13 const index = this.isMobileDevice ? 0 : 1
35 14
36 return browser.waitUntil(async () => { 15 return browser.waitUntil(async () => {
37 return (await $$('.video-info .video-info-name')[index].getText()).includes(videoName) 16 return (await $$('.video-info .video-info-name')[index].getText()).includes(videoName)
@@ -58,42 +37,6 @@ export class VideoWatchPage {
58 return go(FIXTURE_URLS.HLS_PLAYLIST_EMBED) 37 return go(FIXTURE_URLS.HLS_PLAYLIST_EMBED)
59 } 38 }
60 39
61 async clickOnVideo (videoName: string) {
62 const video = async () => {
63 const videos = await $$('.videos .video-miniature .video-miniature-name').filter(async e => {
64 const t = await e.getText()
65
66 return t === videoName
67 })
68
69 return videos[0]
70 }
71
72 await browser.waitUntil(async () => {
73 const elem = await video()
74
75 return elem?.isClickable()
76 });
77
78 (await video()).click()
79
80 await browser.waitUntil(async () => (await browser.getUrl()).includes('/w/'))
81 }
82
83 async clickOnFirstVideo () {
84 const video = () => $('.videos .video-miniature .video-thumbnail')
85 const videoName = () => $('.videos .video-miniature .video-miniature-name')
86
87 await video().waitForClickable()
88
89 const textToReturn = await videoName().getText()
90 await video().click()
91
92 await browser.waitUntil(async () => (await browser.getUrl()).includes('/w/'))
93
94 return textToReturn
95 }
96
97 async clickOnUpdate () { 40 async clickOnUpdate () {
98 const dropdown = $('my-video-actions-dropdown .action-button') 41 const dropdown = $('my-video-actions-dropdown .action-button')
99 await dropdown.click() 42 await dropdown.click()