aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-15 15:58:10 +0100
committerChocobozzz <me@florianbigard.com>2021-12-16 10:08:55 +0100
commita9bfa85d2cdf13670aaced740da5b493fbeddfce (patch)
tree3781c9218d4cc7786b6589365c0efbed2151703d /client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts
parentc77fdc605b3ccc1ab6890f889d8200fbe9372949 (diff)
downloadPeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.gz
PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.zst
PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.zip
Add ability for admins to set default p2p policy
Diffstat (limited to 'client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts')
-rw-r--r--client/e2e/src/suites-local/custom-server-defaults.e2e-spec.ts75
1 files changed, 62 insertions, 13 deletions
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 @@
1import { LoginPage } from '../po/login.po' 1import { LoginPage } from '../po/login.po'
2import { VideoUploadPage } from '../po/video-upload.po' 2import { VideoUploadPage } from '../po/video-upload.po'
3import { VideoWatchPage } from '../po/video-watch.po' 3import { VideoWatchPage } from '../po/video-watch.po'
4import { isMobileDevice, isSafari, waitServerUp } from '../utils' 4import { go, isMobileDevice, isSafari, waitServerUp } from '../utils'
5 5
6describe('Custom server defaults', () => { 6describe('Custom server defaults', () => {
7 let videoUploadPage: VideoUploadPage 7 let videoUploadPage: VideoUploadPage
@@ -10,9 +10,7 @@ describe('Custom server defaults', () => {
10 10
11 before(async () => { 11 before(async () => {
12 await waitServerUp() 12 await waitServerUp()
13 })
14 13
15 beforeEach(async () => {
16 loginPage = new LoginPage() 14 loginPage = new LoginPage()
17 videoUploadPage = new VideoUploadPage() 15 videoUploadPage = new VideoUploadPage()
18 videoWatchPage = new VideoWatchPage(isMobileDevice(), isSafari()) 16 videoWatchPage = new VideoWatchPage(isMobileDevice(), isSafari())
@@ -20,18 +18,69 @@ describe('Custom server defaults', () => {
20 await browser.maximizeWindow() 18 await browser.maximizeWindow()
21 }) 19 })
22 20
23 it('Should upload a video with custom default values', async function () { 21 describe('Publish default values', function () {
24 await loginPage.loginAsRootUser() 22 before(async function () {
25 await videoUploadPage.navigateTo() 23 await loginPage.loginAsRootUser()
26 await videoUploadPage.uploadVideo() 24 })
27 await videoUploadPage.validSecondUploadStep('video') 25
26 it('Should upload a video with custom default values', async function () {
27 await videoUploadPage.navigateTo()
28 await videoUploadPage.uploadVideo()
29 await videoUploadPage.validSecondUploadStep('video')
28 30
29 await videoWatchPage.waitWatchVideoName('video') 31 await videoWatchPage.waitWatchVideoName('video')
30 32
31 expect(await videoWatchPage.getPrivacy()).toBe('Internal') 33 expect(await videoWatchPage.getPrivacy()).toBe('Internal')
32 expect(await videoWatchPage.getLicence()).toBe('Attribution - Non Commercial') 34 expect(await videoWatchPage.getLicence()).toBe('Attribution - Non Commercial')
33 expect(await videoWatchPage.isDownloadEnabled()).toBeFalsy() 35 expect(await videoWatchPage.isDownloadEnabled()).toBeFalsy()
34 expect(await videoWatchPage.areCommentsEnabled()).toBeFalsy() 36 expect(await videoWatchPage.areCommentsEnabled()).toBeFalsy()
37 })
38
39 after(async function () {
40 await loginPage.logout()
41 })
35 }) 42 })
36 43
44 describe('P2P', function () {
45 let videoUrl: string
46
47 async function goOnVideoWatchPage () {
48 await go(videoUrl)
49 await videoWatchPage.waitWatchVideoName('video')
50 }
51
52 async function checkP2P (enabled: boolean) {
53 await goOnVideoWatchPage()
54 expect(await videoWatchPage.isPrivacyWarningDisplayed()).toEqual(enabled)
55
56 await videoWatchPage.goOnAssociatedEmbed()
57 expect(await videoWatchPage.isEmbedWarningDisplayed()).toEqual(enabled)
58 }
59
60 before(async () => {
61 await loginPage.loginAsRootUser()
62 await videoUploadPage.navigateTo()
63 await videoUploadPage.uploadVideo()
64 await videoUploadPage.setAsPublic()
65 await videoUploadPage.validSecondUploadStep('video')
66
67 await videoWatchPage.waitWatchVideoName('video')
68
69 videoUrl = await browser.getUrl()
70 })
71
72 beforeEach(async function () {
73 await goOnVideoWatchPage()
74 })
75
76 it('Should have P2P disabled for a logged in user', async function () {
77 await checkP2P(false)
78 })
79
80 it('Should have P2P disabled for anonymous users', async function () {
81 await loginPage.logout()
82
83 await checkP2P(false)
84 })
85 })
37}) 86})