]>
Commit | Line | Data |
---|---|---|
3cf68b86 C |
1 | import { LoginPage } from '../po/login.po' |
2 | import { VideoUploadPage } from '../po/video-upload.po' | |
3 | import { VideoWatchPage } from '../po/video-watch.po' | |
a9bfa85d | 4 | import { go, isMobileDevice, isSafari, waitServerUp } from '../utils' |
3cf68b86 C |
5 | |
6 | describe('Custom server defaults', () => { | |
7 | let videoUploadPage: VideoUploadPage | |
8 | let loginPage: LoginPage | |
9 | let videoWatchPage: VideoWatchPage | |
10 | ||
11 | before(async () => { | |
12 | await waitServerUp() | |
3cf68b86 | 13 | |
3cf68b86 C |
14 | loginPage = new LoginPage() |
15 | videoUploadPage = new VideoUploadPage() | |
16 | videoWatchPage = new VideoWatchPage(isMobileDevice(), isSafari()) | |
17 | ||
18 | await browser.maximizeWindow() | |
19 | }) | |
20 | ||
a9bfa85d C |
21 | describe('Publish default values', function () { |
22 | before(async function () { | |
23 | await loginPage.loginAsRootUser() | |
24 | }) | |
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') | |
3cf68b86 | 30 | |
a9bfa85d | 31 | await videoWatchPage.waitWatchVideoName('video') |
3cf68b86 | 32 | |
a9bfa85d C |
33 | expect(await videoWatchPage.getPrivacy()).toBe('Internal') |
34 | expect(await videoWatchPage.getLicence()).toBe('Attribution - Non Commercial') | |
35 | expect(await videoWatchPage.isDownloadEnabled()).toBeFalsy() | |
36 | expect(await videoWatchPage.areCommentsEnabled()).toBeFalsy() | |
37 | }) | |
38 | ||
39 | after(async function () { | |
40 | await loginPage.logout() | |
41 | }) | |
3cf68b86 C |
42 | }) |
43 | ||
a9bfa85d C |
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 | }) | |
3cf68b86 | 86 | }) |