1 import { AnonymousSettingsPage } from '../po/anonymous-settings.po'
2 import { LoginPage } from '../po/login.po'
3 import { MyAccountPage } from '../po/my-account.po'
4 import { VideoUploadPage } from '../po/video-upload.po'
5 import { VideoWatchPage } from '../po/video-watch.po'
6 import { go, isMobileDevice, isSafari, waitServerUp } from '../utils'
8 describe('User settings', () => {
9 let videoUploadPage: VideoUploadPage
10 let loginPage: LoginPage
11 let videoWatchPage: VideoWatchPage
12 let myAccountPage: MyAccountPage
13 let anonymousSettingsPage: AnonymousSettingsPage
18 loginPage = new LoginPage()
19 videoUploadPage = new VideoUploadPage()
20 videoWatchPage = new VideoWatchPage(isMobileDevice(), isSafari())
21 myAccountPage = new MyAccountPage()
22 anonymousSettingsPage = new AnonymousSettingsPage()
24 await browser.maximizeWindow()
27 describe('P2P', function () {
30 async function goOnVideoWatchPage () {
32 await videoWatchPage.waitWatchVideoName('video')
35 async function checkP2P (enabled: boolean) {
36 await goOnVideoWatchPage()
37 expect(await videoWatchPage.isPrivacyWarningDisplayed()).toEqual(enabled)
39 await videoWatchPage.goOnAssociatedEmbed()
40 expect(await videoWatchPage.isEmbedWarningDisplayed()).toEqual(enabled)
44 await loginPage.loginAsRootUser()
45 await videoUploadPage.navigateTo()
46 await videoUploadPage.uploadVideo()
47 await videoUploadPage.validSecondUploadStep('video')
49 await videoWatchPage.waitWatchVideoName('video')
51 videoUrl = await browser.getUrl()
54 beforeEach(async function () {
55 await goOnVideoWatchPage()
58 it('Should have P2P enabled for a logged in user', async function () {
62 it('Should disable P2P for a logged in user', async function () {
63 await myAccountPage.navigateToMySettings()
64 await myAccountPage.clickOnP2PCheckbox()
69 it('Should have P2P enabled for anonymous users', async function () {
70 await loginPage.logout()
75 it('Should disable P2P for an anonymous user', async function () {
76 await anonymousSettingsPage.openSettings()
77 await anonymousSettingsPage.clickOnP2PCheckbox()