aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/video-watch.po.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-17 08:11:25 +0200
committerChocobozzz <me@florianbigard.com>2019-06-17 08:16:09 +0200
commite69cb173ba63d0e556d4af6cbaf18b11f16af3a9 (patch)
treed75c666b2a66f667db1e9dce7f9f606a6b30cfcb /client/e2e/src/po/video-watch.po.ts
parent6b226c32782ea7779ced56c1e1090d8b51c5c504 (diff)
downloadPeerTube-e69cb173ba63d0e556d4af6cbaf18b11f16af3a9.tar.gz
PeerTube-e69cb173ba63d0e556d4af6cbaf18b11f16af3a9.tar.zst
PeerTube-e69cb173ba63d0e556d4af6cbaf18b11f16af3a9.zip
Add more e2e tests
Diffstat (limited to 'client/e2e/src/po/video-watch.po.ts')
-rw-r--r--client/e2e/src/po/video-watch.po.ts43
1 files changed, 42 insertions, 1 deletions
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 5f61d5668..9bb0a3919 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,4 +1,4 @@
1import { browser, by, element } from 'protractor' 1import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor'
2 2
3export class VideoWatchPage { 3export class VideoWatchPage {
4 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { 4 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
@@ -44,6 +44,10 @@ export class VideoWatchPage {
44 .then(seconds => parseInt(seconds, 10)) 44 .then(seconds => parseInt(seconds, 10))
45 } 45 }
46 46
47 getVideoName () {
48 return this.getVideoNameElement().getText()
49 }
50
47 async playAndPauseVideo (isAutoplay: boolean, isMobileDevice: boolean) { 51 async playAndPauseVideo (isAutoplay: boolean, isMobileDevice: boolean) {
48 if (isAutoplay === false) { 52 if (isAutoplay === false) {
49 const playButton = element(by.css('.vjs-big-play-button')) 53 const playButton = element(by.css('.vjs-big-play-button'))
@@ -101,4 +105,41 @@ export class VideoWatchPage {
101 async goOnP2PMediaLoaderEmbed () { 105 async goOnP2PMediaLoaderEmbed () {
102 return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50?mode=p2p-media-loader') 106 return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50?mode=p2p-media-loader')
103 } 107 }
108
109 async clickOnUpdate () {
110 const dropdown = element(by.css('my-video-actions-dropdown .action-button'))
111 await dropdown.click()
112
113 const items: ElementFinder[] = await element.all(by.css('my-video-actions-dropdown .dropdown-menu .dropdown-item'))
114
115 for (const item of items) {
116 const href = await item.getAttribute('href')
117
118 if (href && href.includes('/update/')) {
119 await item.click()
120 return
121 }
122 }
123 }
124
125 async clickOnSave () {
126 return element(by.css('.action-button-save')).click()
127 }
128
129 async saveToWatchLater () {
130 return element.all(by.css('my-video-add-to-playlist .playlist')).first().click()
131 }
132
133 waitUntilVideoName (name: string, maxTime: number) {
134 const elem = this.getVideoNameElement()
135
136 return browser.wait(ExpectedConditions.textToBePresentInElement(elem, name), maxTime)
137 }
138
139 private getVideoNameElement () {
140 // We have 2 video info name block, pick the first that is not empty
141 return element.all(by.css('.video-bottom .video-info-name'))
142 .filter(e => e.getText().then(t => !!t))
143 .first()
144 }
104} 145}