Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix local E2E tests

Chocobozzz2fc3b90cb709
diff --git a/client/e2e/src/po/my-account.po.ts b/client/e2e/src/po/my-account.po.ts
index 743e3094f5..cc1555e9b9 100644
--- a/client/e2e/src/po/my-account.po.ts
+++ b/client/e2e/src/po/my-account.po.ts
@@ -56,7 +56,7 @@ export class MyAccountPage {
async removeVideo (name: string) {
const container = await this.getVideoElement(name)
- await container.$('.dropdown-toggle').click()
+ await container.$('my-action-dropdown .dropdown-toggle').click()
const deleteItem = () => {
return $$('.dropdown-menu .dropdown-item').find<WebdriverIO.Element>(async v => {
@@ -120,9 +120,7 @@ export class MyAccountPage {
async updatePlaylistPrivacy (playlistUUID: string, privacy: 'Public' | 'Private' | 'Unlisted') {
go('/my-library/video-playlists/update/' + playlistUUID)
- await browser.waitUntil(async () => {
- return (await $('form .video-playlist-title').getText() === 'PLAYLIST')
- })
+ await $('a[href*="/my-library/video-playlists/update/"]').waitForDisplayed()
await selectCustomSelect('videoChannelId', 'Main root channel')
await selectCustomSelect('privacy', privacy)
diff --git a/client/e2e/src/po/video-list.po.ts b/client/e2e/src/po/video-list.po.ts
index f62c79adcb..81afbd992a 100644
--- a/client/e2e/src/po/video-list.po.ts
+++ b/client/e2e/src/po/video-list.po.ts
@@ -67,7 +67,7 @@ export class VideoListPage {
async getVideosListName () {
const elems = await $$('.videos .video-miniature .video-miniature-name')
- const texts = await Promise.all(elems.map(e => e.getText()))
+ const texts = await elems.map(e => e.getText())
return texts.map(t => t.trim())
}
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 67081fe4a1..544930c6ce 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -13,8 +13,11 @@ export class VideoWatchPage {
const index = this.isMobileDevice ? 0 : 1
return browser.waitUntil(async () => {
- return await $('.video-info .video-info-name').isExisting() &&
- (await $$('.video-info .video-info-name')[index].getText()).includes(videoName)
+ if (!await $('.video-info .video-info-name').isExisting()) return false
+
+ const elem = await $$('.video-info .video-info-name')[index]
+
+ return (await elem.getText()).includes(videoName) && elem.isDisplayed()
})
}
@@ -31,9 +34,13 @@ export class VideoWatchPage {
}
async isDownloadEnabled () {
- await this.clickOnMoreDropdownIcon()
+ try {
+ await this.clickOnMoreDropdownIcon()
- return $('.dropdown-item .icon-download').isExisting()
+ return await $('.dropdown-item .icon-download').isExisting()
+ } catch {
+ return $('.action-button-download').isDisplayed()
+ }
}
areCommentsEnabled () {
diff --git a/client/e2e/src/suites-all/videos.e2e-spec.ts b/client/e2e/src/suites-all/videos.e2e-spec.ts
index 5d0f8c152b..dcc8eefbfc 100644
--- a/client/e2e/src/suites-all/videos.e2e-spec.ts
+++ b/client/e2e/src/suites-all/videos.e2e-spec.ts
@@ -176,7 +176,7 @@ describe('Videos all workflow', () => {
await videoWatchPage.waitUntilVideoName(video2Name, 40 * 1000)
})
- it('Should watch the WEB VIDEO playlist in the embed', async () => {
+ it('Should watch the Web Video playlist in the embed', async () => {
if (isUploadUnsupported()) return
const accessToken = await browser.execute(`return window.localStorage.getItem('access_token');`)
diff --git a/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts b/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts
index 4d5f440016..e839d132ec 100644
--- a/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts
+++ b/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts
@@ -30,14 +30,21 @@ describe('Custom server defaults', () => {
await videoWatchPage.waitWatchVideoName('video')
- expect(await videoWatchPage.getPrivacy()).toBe('Internal')
+ const videoUrl = await browser.getUrl()
+
+ expect(await videoWatchPage.getPrivacy()).toBe('Unlisted')
expect(await videoWatchPage.getLicence()).toBe('Attribution - Non Commercial')
- expect(await videoWatchPage.isDownloadEnabled()).toBeFalsy()
expect(await videoWatchPage.areCommentsEnabled()).toBeFalsy()
- })
- after(async function () {
+ // Owners can download their videos
+ expect(await videoWatchPage.isDownloadEnabled()).toBeTruthy()
+
+ // Logout to see if the download enabled is correct for anonymous users
await loginPage.logout()
+ await browser.url(videoUrl)
+ await videoWatchPage.waitWatchVideoName('video')
+
+ expect(await videoWatchPage.isDownloadEnabled()).toBeFalsy()
})
})
diff --git a/client/e2e/src/suites-local/video-password.e2e-spec.ts b/client/e2e/src/suites-local/video-password.e2e-spec.ts
index 3683b387a0..366dd7d19a 100644
--- a/client/e2e/src/suites-local/video-password.e2e-spec.ts
+++ b/client/e2e/src/suites-local/video-password.e2e-spec.ts
@@ -130,10 +130,12 @@ describe('Password protected videos', () => {
it('Should update the playlist to public', async () => {
const url = await browser.getUrl()
- const regex = /\/([a-f0-9-]+)$/i
+ const regex = /\/my-library\/video-playlists\/([^/]+)/i
const match = url.match(regex)
const uuid = match ? match[1] : null
+ expect(uuid).not.toBeNull()
+
await myAccountPage.updatePlaylistPrivacy(uuid, 'Public')
})
diff --git a/client/e2e/src/utils/hooks.ts b/client/e2e/src/utils/hooks.ts
index 05a32916ca..cdfa51a26e 100644
--- a/client/e2e/src/utils/hooks.ts
+++ b/client/e2e/src/utils/hooks.ts
@@ -66,7 +66,7 @@ function buildConfig (suiteFile: string = undefined) {
publish: {
download_enabled: false,
comments_enabled: false,
- privacy: 4,
+ privacy: 2,
licence: 4
},
p2p: {
diff --git a/client/src/app/+accounts/routes.ts b/client/src/app/+accounts/routes.ts
index f9b3266e82..0528c108bf 100644
--- a/client/src/app/+accounts/routes.ts
+++ b/client/src/app/+accounts/routes.ts
@@ -1,12 +1,14 @@
import { Routes } from '@angular/router'
-import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component'
-import { AccountVideosComponent } from './account-videos/account-videos.component'
-import { AccountsComponent } from './accounts.component'
+import { AbuseService } from '@app/shared/shared-moderation/abuse.service'
import { BlocklistService } from '@app/shared/shared-moderation/blocklist.service'
+import { BulkService } from '@app/shared/shared-moderation/bulk.service'
import { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'
import { UserSubscriptionService } from '@app/shared/shared-user-subscription/user-subscription.service'
+import { UserAdminService } from '@app/shared/shared-users/user-admin.service'
import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
-import { AbuseService } from '@app/shared/shared-moderation/abuse.service'
+import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component'
+import { AccountVideosComponent } from './account-videos/account-videos.component'
+import { AccountsComponent } from './accounts.component'
export default [
{
@@ -21,7 +23,9 @@ export default [
BlocklistService,
VideoPlaylistService,
VideoBlockService,
- AbuseService
+ AbuseService,
+ UserAdminService,
+ BulkService
],
children: [
{
diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html
index 0918a33423..5ee74e6b1c 100644
--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html
+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html
@@ -1,85 +1,84 @@
<div *ngIf="error" class="alert alert-danger">{{ error }}</div>
- <div class="pt-two-cols"> <!-- playlist grid -->
- <div class="title-col">
- <nav aria-label="breadcrumb">
- <ol class="pt-breadcrumb">
- <li class="breadcrumb-item">
- <a routerLink="/my-library/video-playlists" i18n>My Playlists</a>
+<div class="pt-two-cols"> <!-- playlist grid -->
+ <div class="title-col">
+ <nav aria-label="breadcrumb">
+ <ol class="pt-breadcrumb">
+ <li class="breadcrumb-item">
+ <a routerLink="/my-library/video-playlists" i18n>My Playlists</a>
+ </li>
+
+ @if (isCreation()) {
+ <li class="breadcrumb-item active" i18n>Create</li>
+ } @else {
+ <li class="breadcrumb-item active" i18n>Edit</li>
+
+ <li class="breadcrumb-item active" aria-current="page">
+ <a *ngIf="videoPlaylistToUpdate" [routerLink]="[ '/my-library/video-playlists/update', videoPlaylistToUpdate?.shortUUID]">
+ {{ videoPlaylistToUpdate?.displayName }}
+ </a>
</li>
+ }
+ </ol>
+ </nav>
+
+ @if (isCreation()) {
+ <h2 class="visually-hidden" i18n>NEW PLAYLIST</h2>
+ } @else {
+ <h2 class="visually-hidden" i18n>UPDATE PLAYLIST</h2>
+ }
+ </div>
- @if (isCreation()) {
- <li class="breadcrumb-item active" i18n>Create</li>
- } @else {
- <li class="breadcrumb-item active" i18n>Edit</li>
-
- <li class="breadcrumb-item active" aria-current="page">
- <a *ngIf="videoPlaylistToUpdate" [routerLink]="[ '/my-library/video-playlists/update', videoPlaylistToUpdate?.shortUUID]">
- {{ videoPlaylistToUpdate?.displayName }}
- </a>
- </li>
- }
- </ol>
- </nav>
-
- @if (isCreation()) {
- <h2 class="visually-hidden" i18n>NEW PLAYLIST</h2>
- } @else {
- <h2 class="visually-hidden" i18n>UPDATE PLAYLIST</h2>
- }
- </div>
-
- <div class="content-col">
- <form role="form" (ngSubmit)="formValidated()" [formGroup]="form">
-
- <div class="form-group">
- <label for="thumbnailfile" i18n>Playlist thumbnail</label>
-
- <my-preview-upload
- i18n-inputLabel inputLabel="Edit" inputName="thumbnailfile" formControlName="thumbnailfile"
- previewWidth="223px" previewHeight="122px"
- ></my-preview-upload>
- </div>
-
- <div class="form-group">
- <label i18n for="displayName">Display name</label>
- <input
- type="text" id="displayName" class="form-control"
- formControlName="displayName" [ngClass]="{ 'input-error': formErrors['displayName'] }"
- >
- <div *ngIf="formErrors['displayName']" class="form-error" role="alert">
- {{ formErrors['displayName'] }}
- </div>
+ <div class="content-col">
+ <form role="form" (ngSubmit)="formValidated()" [formGroup]="form">
+
+ <div class="form-group">
+ <label for="thumbnailfile" i18n>Playlist thumbnail</label>
+
+ <my-preview-upload
+ i18n-inputLabel inputLabel="Edit" inputName="thumbnailfile" formControlName="thumbnailfile"
+ previewWidth="223px" previewHeight="122px"
+ ></my-preview-upload>
+ </div>
+
+ <div class="form-group">
+ <label i18n for="displayName">Display name</label>
+ <input
+ type="text" id="displayName" class="form-control"
+ formControlName="displayName" [ngClass]="{ 'input-error': formErrors['displayName'] }"
+ >
+ <div *ngIf="formErrors['displayName']" class="form-error" role="alert">
+ {{ formErrors['displayName'] }}
</div>
-
- <div class="form-group">
- <label i18n for="description">Description</label><my-help helpType="markdownText"></my-help>
- <my-markdown-textarea id="description" formControlName="description" [formError]="formErrors['description']"></my-markdown-textarea>
+ </div>
+
+ <div class="form-group">
+ <label i18n for="description">Description</label><my-help helpType="markdownText"></my-help>
+ <my-markdown-textarea id="description" formControlName="description" [formError]="formErrors['description']"></my-markdown-textarea>
+ </div>
+
+ <div class="form-group">
+ <label i18n for="privacy">Privacy</label>
+ <div class="peertube-select-container">
+ <my-select-options
+ labelForId="privacy" [items]="videoPlaylistPrivacies" formControlName="privacy" [clearable]="false"
+ ></my-select-options>
</div>
- <div class="form-group">
- <label i18n for="privacy">Privacy</label>
- <div class="peertube-select-container">
- <my-select-options
- labelForId="privacy" [items]="videoPlaylistPrivacies" formControlName="privacy" [clearable]="false"
- ></my-select-options>
- </div>
-
- <div *ngIf="formErrors.privacy" class="form-error" role="alert">{{ formErrors.privacy }}</div>
- </div>
+ <div *ngIf="formErrors.privacy" class="form-error" role="alert">{{ formErrors.privacy }}</div>
+ </div>
- <div class="form-group">
- <label for="videoChannelIdl" i18n>Channel</label>
+ <div class="form-group">
+ <label for="videoChannelIdl" i18n>Channel</label>
- <my-select-channel
- labelForId="videoChannelId" [items]="userVideoChannels" formControlName="videoChannelId"
- ></my-select-channel>
+ <my-select-channel
+ labelForId="videoChannelId" [items]="userVideoChannels" formControlName="videoChannelId"
+ ></my-select-channel>
- <div *ngIf="formErrors['videoChannelId']" class="form-error" role="alert">{{ formErrors['videoChannelId'] }}</div>
- </div>
+ <div *ngIf="formErrors['videoChannelId']" class="form-error" role="alert">{{ formErrors['videoChannelId'] }}</div>
+ </div>
- <input type="submit" class="peertube-button orange-button" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid">
- </form>
- </div>
+ <input type="submit" class="peertube-button orange-button" value="{{ getFormButtonTitle() }}" [disabled]="!form.valid">
+ </form>
</div>
-
+</div>
diff --git a/client/src/app/+videos/+video-watch/routes.ts b/client/src/app/+videos/+video-watch/routes.ts
index 2a5dd763f5..b700986fc4 100644
--- a/client/src/app/+videos/+video-watch/routes.ts
+++ b/client/src/app/+videos/+video-watch/routes.ts
@@ -1,15 +1,17 @@
import { Routes } from '@angular/router'
-import { VideoWatchComponent } from './video-watch.component'
-import { OverviewService } from '../video-list'
-import { RecentVideosRecommendationService, RecommendedVideosStore } from './shared'
+import { AbuseService } from '@app/shared/shared-moderation/abuse.service'
import { BlocklistService } from '@app/shared/shared-moderation/blocklist.service'
import { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'
import { SearchService } from '@app/shared/shared-search/search.service'
import { UserSubscriptionService } from '@app/shared/shared-user-subscription/user-subscription.service'
+import { UserAdminService } from '@app/shared/shared-users/user-admin.service'
import { VideoCommentService } from '@app/shared/shared-video-comment/video-comment.service'
import { LiveVideoService } from '@app/shared/shared-video-live/live-video.service'
import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
-import { AbuseService } from '@app/shared/shared-moderation/abuse.service'
+import { OverviewService } from '../video-list'
+import { RecentVideosRecommendationService, RecommendedVideosStore } from './shared'
+import { VideoWatchComponent } from './video-watch.component'
+import { BulkService } from '@app/shared/shared-moderation/bulk.service'
export default [
{
@@ -25,7 +27,9 @@ export default [
RecentVideosRecommendationService,
RecommendedVideosStore,
SearchService,
- AbuseService
+ AbuseService,
+ UserAdminService,
+ BulkService
],
children: [
{
diff --git a/client/src/assets/player/shared/peertube/peertube-plugin.ts b/client/src/assets/player/shared/peertube/peertube-plugin.ts
index d9aeadb67e..4ee02429fc 100644
--- a/client/src/assets/player/shared/peertube/peertube-plugin.ts
+++ b/client/src/assets/player/shared/peertube/peertube-plugin.ts
@@ -398,6 +398,8 @@ class PeerTubePlugin extends Plugin {
private updatePlayerSizeClasses () {
requestAnimationFrame(() => {
+ if (!this.player) return
+
debugLogger('Updating player size classes')
const width = this.player.currentWidth()