X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fe2e%2Fsrc%2Fsuites-local%2Fcustom-server-defaults.e2e-spec.ts;h=e060d382fa520ce6c5e39458cc681285dceaace9;hb=a9bfa85d2cdf13670aaced740da5b493fbeddfce;hp=c2c8edcc91ffe5df2c85af885e8242b1fbef58a2;hpb=3cf68b869decf07ff7435fe1436d4f3134df1bf4;p=github%2FChocobozzz%2FPeerTube.git 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 c2c8edcc9..e060d382f 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 @@ -1,7 +1,7 @@ import { LoginPage } from '../po/login.po' import { VideoUploadPage } from '../po/video-upload.po' import { VideoWatchPage } from '../po/video-watch.po' -import { isMobileDevice, isSafari, waitServerUp } from '../utils' +import { go, isMobileDevice, isSafari, waitServerUp } from '../utils' describe('Custom server defaults', () => { let videoUploadPage: VideoUploadPage @@ -10,9 +10,7 @@ describe('Custom server defaults', () => { before(async () => { await waitServerUp() - }) - beforeEach(async () => { loginPage = new LoginPage() videoUploadPage = new VideoUploadPage() videoWatchPage = new VideoWatchPage(isMobileDevice(), isSafari()) @@ -20,18 +18,69 @@ describe('Custom server defaults', () => { await browser.maximizeWindow() }) - it('Should upload a video with custom default values', async function () { - await loginPage.loginAsRootUser() - await videoUploadPage.navigateTo() - await videoUploadPage.uploadVideo() - await videoUploadPage.validSecondUploadStep('video') + describe('Publish default values', function () { + before(async function () { + await loginPage.loginAsRootUser() + }) + + it('Should upload a video with custom default values', async function () { + await videoUploadPage.navigateTo() + await videoUploadPage.uploadVideo() + await videoUploadPage.validSecondUploadStep('video') - await videoWatchPage.waitWatchVideoName('video') + await videoWatchPage.waitWatchVideoName('video') - expect(await videoWatchPage.getPrivacy()).toBe('Internal') - expect(await videoWatchPage.getLicence()).toBe('Attribution - Non Commercial') - expect(await videoWatchPage.isDownloadEnabled()).toBeFalsy() - expect(await videoWatchPage.areCommentsEnabled()).toBeFalsy() + expect(await videoWatchPage.getPrivacy()).toBe('Internal') + expect(await videoWatchPage.getLicence()).toBe('Attribution - Non Commercial') + expect(await videoWatchPage.isDownloadEnabled()).toBeFalsy() + expect(await videoWatchPage.areCommentsEnabled()).toBeFalsy() + }) + + after(async function () { + await loginPage.logout() + }) }) + describe('P2P', function () { + let videoUrl: string + + async function goOnVideoWatchPage () { + await go(videoUrl) + await videoWatchPage.waitWatchVideoName('video') + } + + async function checkP2P (enabled: boolean) { + await goOnVideoWatchPage() + expect(await videoWatchPage.isPrivacyWarningDisplayed()).toEqual(enabled) + + await videoWatchPage.goOnAssociatedEmbed() + expect(await videoWatchPage.isEmbedWarningDisplayed()).toEqual(enabled) + } + + before(async () => { + await loginPage.loginAsRootUser() + await videoUploadPage.navigateTo() + await videoUploadPage.uploadVideo() + await videoUploadPage.setAsPublic() + await videoUploadPage.validSecondUploadStep('video') + + await videoWatchPage.waitWatchVideoName('video') + + videoUrl = await browser.getUrl() + }) + + beforeEach(async function () { + await goOnVideoWatchPage() + }) + + it('Should have P2P disabled for a logged in user', async function () { + await checkP2P(false) + }) + + it('Should have P2P disabled for anonymous users', async function () { + await loginPage.logout() + + await checkP2P(false) + }) + }) })