aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/suites-local/user-settings.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/user-settings.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/user-settings.e2e-spec.ts')
-rw-r--r--client/e2e/src/suites-local/user-settings.e2e-spec.ts82
1 files changed, 82 insertions, 0 deletions
diff --git a/client/e2e/src/suites-local/user-settings.e2e-spec.ts b/client/e2e/src/suites-local/user-settings.e2e-spec.ts
new file mode 100644
index 000000000..b87501cd1
--- /dev/null
+++ b/client/e2e/src/suites-local/user-settings.e2e-spec.ts
@@ -0,0 +1,82 @@
1import { AnonymousSettingsPage } from '../po/anonymous-settings.po'
2import { LoginPage } from '../po/login.po'
3import { MyAccountPage } from '../po/my-account.po'
4import { VideoUploadPage } from '../po/video-upload.po'
5import { VideoWatchPage } from '../po/video-watch.po'
6import { go, isMobileDevice, isSafari, waitServerUp } from '../utils'
7
8describe('User settings', () => {
9 let videoUploadPage: VideoUploadPage
10 let loginPage: LoginPage
11 let videoWatchPage: VideoWatchPage
12 let myAccountPage: MyAccountPage
13 let anonymousSettingsPage: AnonymousSettingsPage
14
15 before(async () => {
16 await waitServerUp()
17
18 loginPage = new LoginPage()
19 videoUploadPage = new VideoUploadPage()
20 videoWatchPage = new VideoWatchPage(isMobileDevice(), isSafari())
21 myAccountPage = new MyAccountPage()
22 anonymousSettingsPage = new AnonymousSettingsPage()
23
24 await browser.maximizeWindow()
25 })
26
27 describe('P2P', function () {
28 let videoUrl: string
29
30 async function goOnVideoWatchPage () {
31 await go(videoUrl)
32 await videoWatchPage.waitWatchVideoName('video')
33 }
34
35 async function checkP2P (enabled: boolean) {
36 await goOnVideoWatchPage()
37 expect(await videoWatchPage.isPrivacyWarningDisplayed()).toEqual(enabled)
38
39 await videoWatchPage.goOnAssociatedEmbed()
40 expect(await videoWatchPage.isEmbedWarningDisplayed()).toEqual(enabled)
41 }
42
43 before(async () => {
44 await loginPage.loginAsRootUser()
45 await videoUploadPage.navigateTo()
46 await videoUploadPage.uploadVideo()
47 await videoUploadPage.validSecondUploadStep('video')
48
49 await videoWatchPage.waitWatchVideoName('video')
50
51 videoUrl = await browser.getUrl()
52 })
53
54 beforeEach(async function () {
55 await goOnVideoWatchPage()
56 })
57
58 it('Should have P2P enabled for a logged in user', async function () {
59 await checkP2P(true)
60 })
61
62 it('Should disable P2P for a logged in user', async function () {
63 await myAccountPage.navigateToMySettings()
64 await myAccountPage.clickOnP2PCheckbox()
65
66 await checkP2P(false)
67 })
68
69 it('Should have P2P enabled for anonymous users', async function () {
70 await loginPage.logout()
71
72 await checkP2P(true)
73 })
74
75 it('Should disable P2P for an anonymous user', async function () {
76 await anonymousSettingsPage.openSettings()
77 await anonymousSettingsPage.clickOnP2PCheckbox()
78
79 await checkP2P(false)
80 })
81 })
82})