Skip to content

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

Ensure save button can be clicked with a new video

Chocobozzzd0e2ecd82c4b
diff --git a/client/e2e/src/po/video-publish.po.ts b/client/e2e/src/po/video-publish.po.ts
index 7f453e183e..11864d4592 100644
--- a/client/e2e/src/po/video-publish.po.ts
+++ b/client/e2e/src/po/video-publish.po.ts
@@ -1,5 +1,6 @@
import { join } from 'path'
import { VideoManage } from './video-manage'
+import { FIXTURE_URLS } from '../utils'
export class VideoPublishPage extends VideoManage {
async navigateTo (tab?: 'Go live') {
@@ -37,6 +38,23 @@ export class VideoPublishPage extends VideoManage {
await this.getSaveButton().waitForClickable()
}
+ async importVideo () {
+ const tab = $('.nav-link*=Import with URL')
+ await tab.waitForClickable()
+ await tab.click()
+
+ const input = $('#targetUrl')
+ await input.waitForDisplayed()
+ await input.setValue(FIXTURE_URLS.IMPORT_URL)
+
+ const submit = $('.first-step-block .primary-button:not([disabled])')
+ await submit.waitForClickable()
+ await submit.click()
+
+ // Wait for the import to finish
+ await this.getSaveButton().waitForClickable()
+ }
+
async publishLive () {
await $('#permanentLiveTrue').parentElement().click()
diff --git a/client/e2e/src/suites-local/publish.e2e-spec.ts b/client/e2e/src/suites-local/publish.e2e-spec.ts
index 1bc70cd0f2..bf2aa18ca9 100644
--- a/client/e2e/src/suites-local/publish.e2e-spec.ts
+++ b/client/e2e/src/suites-local/publish.e2e-spec.ts
@@ -13,13 +13,11 @@ describe('Publish video', () => {
videoPublishPage = new VideoPublishPage()
await browser.maximizeWindow()
+
+ await loginPage.loginAsRootUser()
})
describe('Common', function () {
- before(async function () {
- await loginPage.loginAsRootUser()
- })
-
it('Should upload a video and on refresh being redirected to the manage page', async function () {
await videoPublishPage.navigateTo()
await videoPublishPage.uploadVideo('video.mp4')
@@ -50,6 +48,16 @@ describe('Publish video', () => {
})
})
+ describe('Import', function () {
+ it('Should import a video and on refresh being redirected to the manage page', async function () {
+ await videoPublishPage.navigateTo()
+ await videoPublishPage.importVideo()
+ await videoPublishPage.validSecondStep('second video')
+
+ await videoPublishPage.refresh('second video')
+ })
+ })
+
after(async () => {
await browser.saveScreenshot(getScreenshotPath('after-test.png'))
})
diff --git a/client/e2e/src/utils/urls.ts b/client/e2e/src/utils/urls.ts
index eafe0aa5df..a743ed46c0 100644
--- a/client/e2e/src/utils/urls.ts
+++ b/client/e2e/src/utils/urls.ts
@@ -13,7 +13,9 @@ const FIXTURE_URLS = {
HLS_EMBED: 'https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50',
HLS_PLAYLIST_EMBED: 'https://peertube2.cpy.re/video-playlists/embed/73804a40-da9a-40c2-b1eb-2c6d9eec8f0a',
- LIVE_VIDEO: 'https://peertube2.cpy.re/w/oBw6LwsMWWRkmXYfuYRpJd'
+ LIVE_VIDEO: 'https://peertube2.cpy.re/w/oBw6LwsMWWRkmXYfuYRpJd',
+
+ IMPORT_URL: 'https://download.cpy.re/peertube/good_video.mp4'
}
export {
diff --git a/client/src/app/+videos-publish-manage/shared-manage/common/video-edit.model.ts b/client/src/app/+videos-publish-manage/shared-manage/common/video-edit.model.ts
index 68098808a1..1c12a0577c 100644
--- a/client/src/app/+videos-publish-manage/shared-manage/common/video-edit.model.ts
+++ b/client/src/app/+videos-publish-manage/shared-manage/common/video-edit.model.ts
@@ -118,6 +118,7 @@ type CommonUpdate = Omit<VideoUpdate, 'thumbnailfile' | 'originallyPublishedAt'
export class VideoEdit {
static readonly SPECIAL_SCHEDULED_PRIVACY = -1
+ private isNewVideo = false
private common: CommonUpdate = {}
private captions: VideoCaptionWithPathEdit[] = []
private chapters: VideoChaptersEdit = new VideoChaptersEdit()
@@ -172,14 +173,15 @@ export class VideoEdit {
private serverConfig: HTMLServerConfig
- private constructor (serverConfig: HTMLServerConfig) {
+ private constructor (serverConfig: HTMLServerConfig, isNewVideo = false) {
this.serverConfig = serverConfig
+ this.isNewVideo = isNewVideo
}
// ---------------------------------------------------------------------------
static createFromUpload (serverConfig: HTMLServerConfig, options: CreateFromUploadOptions) {
- const videoEdit = new VideoEdit(serverConfig)
+ const videoEdit = new VideoEdit(serverConfig, true)
videoEdit.loadFromPublish(options, false)
return videoEdit
@@ -188,7 +190,7 @@ export class VideoEdit {
// ---------------------------------------------------------------------------
static createFromImport (serverConfig: HTMLServerConfig, options: CreateFromImportOptions) {
- const videoEdit = new VideoEdit(serverConfig)
+ const videoEdit = new VideoEdit(serverConfig, true)
videoEdit.loadFromImport(options)
return videoEdit
@@ -209,7 +211,7 @@ export class VideoEdit {
// ---------------------------------------------------------------------------
static createFromLive (serverConfig: HTMLServerConfig, options: CreateFromLiveOptions) {
- const videoEdit = new VideoEdit(serverConfig)
+ const videoEdit = new VideoEdit(serverConfig, true)
videoEdit.loadFromLive(options)
return videoEdit
@@ -767,6 +769,7 @@ export class VideoEdit {
// ---------------------------------------------------------------------------
hasCommonChanges () {
+ if (this.isNewVideo) return true
if (!this.saveStore.common) return true
let changes = !this.areSameObjects(omit(this.common, [ 'previewfile' ]), omit(this.saveStore.common, [ 'previewfile' ]))
@@ -895,4 +898,10 @@ export class VideoEdit {
return true
}
+
+ // ---------------------------------------------------------------------------
+
+ onSave () {
+ this.isNewVideo = false
+ }
}
diff --git a/client/src/app/+videos-publish-manage/shared-manage/video-manage-controller.service.ts b/client/src/app/+videos-publish-manage/shared-manage/video-manage-controller.service.ts
index 240bd0b151..83cd466dc1 100644
--- a/client/src/app/+videos-publish-manage/shared-manage/video-manage-controller.service.ts
+++ b/client/src/app/+videos-publish-manage/shared-manage/video-manage-controller.service.ts
@@ -299,6 +299,7 @@ export class VideoManageController implements OnDestroy {
finalize(() => {
debugLogger('Update complete')
+ this.videoEdit.onSave()
this.loadingBar.useRef().complete()
this.isUpdatingVideo = false
this.updatedSubject.next()