2020-08-07 08:47:10 +02:00
|
|
|
import { by, element, browser } from 'protractor'
|
2019-06-17 08:11:25 +02:00
|
|
|
|
|
|
|
export class MyAccountPage {
|
|
|
|
|
|
|
|
navigateToMyVideos () {
|
2020-11-12 15:28:54 +01:00
|
|
|
return element(by.css('a[href="/my-library/videos"]')).click()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
navigateToMyPlaylists () {
|
2020-11-12 15:28:54 +01:00
|
|
|
return element(by.css('a[href="/my-library/video-playlists"]')).click()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
navigateToMyHistory () {
|
2020-11-12 15:28:54 +01:00
|
|
|
return element(by.css('a[href="/my-library/history/videos"]')).click()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// My account Videos
|
|
|
|
|
2019-06-18 10:20:55 +02:00
|
|
|
removeVideo (name: string) {
|
|
|
|
return this.getVideoElement(name).element(by.css('my-delete-button')).click()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
validRemove () {
|
|
|
|
return element(by.css('.action-button-submit')).click()
|
|
|
|
}
|
|
|
|
|
2019-06-18 10:20:55 +02:00
|
|
|
countVideos (names: string[]) {
|
|
|
|
return element.all(by.css('.video'))
|
|
|
|
.filter(e => {
|
|
|
|
return e.element(by.css('.video-miniature-name'))
|
|
|
|
.getText()
|
|
|
|
.then(t => names.some(n => t.includes(n)))
|
|
|
|
})
|
|
|
|
.count()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// My account playlists
|
|
|
|
|
2019-06-18 10:20:55 +02:00
|
|
|
getPlaylistVideosText (name: string) {
|
|
|
|
return this.getPlaylist(name).element(by.css('.miniature-playlist-info-overlay')).getText()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
|
2019-06-18 10:20:55 +02:00
|
|
|
clickOnPlaylist (name: string) {
|
|
|
|
return this.getPlaylist(name).element(by.css('.miniature-thumbnail')).click()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
countTotalPlaylistElements () {
|
|
|
|
return element.all(by.css('my-video-playlist-element-miniature')).count()
|
|
|
|
}
|
|
|
|
|
|
|
|
playPlaylist () {
|
|
|
|
return element(by.css('.playlist-info .miniature-thumbnail')).click()
|
|
|
|
}
|
|
|
|
|
2020-08-07 08:47:10 +02:00
|
|
|
async goOnAssociatedPlaylistEmbed () {
|
|
|
|
let url = await browser.getCurrentUrl()
|
|
|
|
url = url.replace('/videos/watch/playlist/', '/video-playlists/embed/')
|
|
|
|
url = url.replace(':3333', ':9001')
|
|
|
|
|
|
|
|
return browser.get(url)
|
|
|
|
}
|
|
|
|
|
2019-06-17 08:11:25 +02:00
|
|
|
// My account Videos
|
|
|
|
|
2019-06-18 10:20:55 +02:00
|
|
|
private getVideoElement (name: string) {
|
|
|
|
return element.all(by.css('.video'))
|
|
|
|
.filter(e => e.element(by.css('.video-miniature-name')).getText().then(t => t.includes(name)))
|
|
|
|
.first()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// My account playlists
|
|
|
|
|
2019-06-18 10:20:55 +02:00
|
|
|
private getPlaylist (name: string) {
|
|
|
|
return element.all(by.css('my-video-playlist-miniature'))
|
|
|
|
.filter(e => e.element(by.css('.miniature-name')).getText().then(t => t.includes(name)))
|
|
|
|
.first()
|
2019-06-17 08:11:25 +02:00
|
|
|
}
|
|
|
|
}
|