X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fe2e%2Fsrc%2Fpo%2Fvideo-watch.po.ts;h=65bf218370a27ec4a80f9d7a9e078a65eb785dce;hb=4e56f0fff12ab9840574e7a27277fc78b195b3e2;hp=c07f4b25f9d19050037d955a51efac78d45b1582;hpb=12d6b873cd4c5eb8c4fd298885e0c7fa6deb3756;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts index c07f4b25f..65bf21837 100644 --- a/client/e2e/src/po/video-watch.po.ts +++ b/client/e2e/src/po/video-watch.po.ts @@ -1,37 +1,16 @@ -import { FIXTURE_URLS } from '../urls' -import { browserSleep, go } from '../utils' +import { browserSleep, FIXTURE_URLS, go } from '../utils' export class VideoWatchPage { - async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { - let url: string - - // We did not upload a file on a mobile device - if (isMobileDevice === true || isSafari === true) { - url = 'https://peertube2.cpy.re/videos/local' - } else { - url = '/videos/recently-added' - } - - await go(url) - - // Waiting the following element does not work on Safari... - if (isSafari) return browserSleep(3000) - - await $('.videos .video-miniature .video-miniature-name').waitForDisplayed() - } - async getVideosListName () { - const elems = await $$('.videos .video-miniature .video-miniature-name') - const texts = await Promise.all(elems.map(e => e.getText())) + constructor (private isMobileDevice: boolean, private isSafari: boolean) { - return texts.map(t => t.trim()) } - waitWatchVideoName (videoName: string, isMobileDevice: boolean, isSafari: boolean) { - if (isSafari) return browserSleep(5000) + waitWatchVideoName (videoName: string) { + if (this.isSafari) return browserSleep(5000) // On mobile we display the first node, on desktop the second - const index = isMobileDevice ? 0 : 1 + const index = this.isMobileDevice ? 0 : 1 return browser.waitUntil(async () => { return (await $$('.video-info .video-info-name')[index].getText()).includes(videoName) @@ -42,63 +21,52 @@ export class VideoWatchPage { return this.getVideoNameElement().then(e => e.getText()) } - async goOnAssociatedEmbed () { - let url = await browser.getUrl() - url = url.replace('/w/', '/videos/embed/') - url = url.replace(':3333', ':9001') - - return go(url) + getPrivacy () { + return $('.attribute-privacy .attribute-value').getText() } - goOnP2PMediaLoaderEmbed () { - return go(FIXTURE_URLS.HLS_EMBED) - } - - goOnP2PMediaLoaderPlaylistEmbed () { - return go(FIXTURE_URLS.HLS_PLAYLIST_EMBED) + getLicence () { + return $('.attribute-licence .attribute-value').getText() } - async clickOnVideo (videoName: string) { - const video = async () => { - const videos = await $$('.videos .video-miniature .video-miniature-name').filter(async e => { - const t = await e.getText() - - return t === videoName - }) + async isDownloadEnabled () { + await this.clickOnMoreDropdownIcon() - return videos[0] - } - - await browser.waitUntil(async () => { - const elem = await video() - - return elem?.isClickable() - }); + return $('.dropdown-item .icon-download').isExisting() + } - (await video()).click() + areCommentsEnabled () { + return $('my-video-comment-add').isExisting() + } - await browser.waitUntil(async () => (await browser.getUrl()).includes('/w/')) + isPrivacyWarningDisplayed () { + return $('my-privacy-concerns').isDisplayed() } - async clickOnFirstVideo () { - const video = () => $('.videos .video-miniature .video-thumbnail') - const videoName = () => $('.videos .video-miniature .video-miniature-name') + async goOnAssociatedEmbed () { + let url = await browser.getUrl() + url = url.replace('/w/', '/videos/embed/') + url = url.replace(':3333', ':9001') - await video().waitForClickable() + await go(url) + await $('.vjs-big-play-button').waitForDisplayed() + } - const textToReturn = await videoName().getText() - await video().click() + isEmbedWarningDisplayed () { + return $('.peertube-dock-description').isDisplayed() + } - await browser.waitUntil(async () => (await browser.getUrl()).includes('/w/')) + goOnP2PMediaLoaderEmbed () { + return go(FIXTURE_URLS.HLS_EMBED) + } - return textToReturn + goOnP2PMediaLoaderPlaylistEmbed () { + return go(FIXTURE_URLS.HLS_PLAYLIST_EMBED) } async clickOnUpdate () { - const dropdown = $('my-video-actions-dropdown .action-button') - await dropdown.click() + await this.clickOnMoreDropdownIcon() - await $('.dropdown-menu.show .dropdown-item').waitForDisplayed() const items = await $$('.dropdown-menu.show .dropdown-item') for (const item of items) { @@ -143,6 +111,13 @@ export class VideoWatchPage { }, { timeout: maxTime }) } + async clickOnMoreDropdownIcon () { + const dropdown = $('my-video-actions-dropdown .action-button') + await dropdown.click() + + await $('.dropdown-menu.show .dropdown-item').waitForDisplayed() + } + private async getVideoNameElement () { // We have 2 video info name block, pick the first that is not empty const elem = async () => {