aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/suites-all/private-videos.e2e-spec.ts
blob: db35546596f646934aa43191b7aed85810b2248d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { LoginPage } from '../po/login.po'
import { PlayerPage } from '../po/player.po'
import { VideoWatchPage } from '../po/video-watch.po'
import { FIXTURE_URLS, go, isMobileDevice, isSafari } from '../utils'

async function checkCorrectlyPlay (playerPage: PlayerPage) {
  await playerPage.playAndPauseVideo(false, 2)

  expect(await playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
}

describe('Private videos all workflow', () => {
  let videoWatchPage: VideoWatchPage
  let loginPage: LoginPage
  let playerPage: PlayerPage

  const internalVideoName = 'Internal E2E test'

  beforeEach(async () => {
    videoWatchPage = new VideoWatchPage(isMobileDevice(), isSafari())
    loginPage = new LoginPage(isMobileDevice())
    playerPage = new PlayerPage()

    if (!isMobileDevice()) {
      await browser.maximizeWindow()
    }
  })

  it('Should log in', async () => {
    return loginPage.loginOnPeerTube2()
  })

  it('Should play an internal webtorrent video', async () => {
    await go(FIXTURE_URLS.INTERNAL_WEBTORRENT_VIDEO)

    await videoWatchPage.waitWatchVideoName(internalVideoName)
    await checkCorrectlyPlay(playerPage)
  })

  it('Should play an internal HLS video', async () => {
    await go(FIXTURE_URLS.INTERNAL_HLS_VIDEO)

    await videoWatchPage.waitWatchVideoName(internalVideoName)
    await checkCorrectlyPlay(playerPage)
  })

  it('Should play an internal WebTorrent video in embed', async () => {
    await go(FIXTURE_URLS.INTERNAL_EMBED_WEBTORRENT_VIDEO)

    await videoWatchPage.waitEmbedForDisplayed()
    await checkCorrectlyPlay(playerPage)
  })

  it('Should play an internal HLS video in embed', async () => {
    await go(FIXTURE_URLS.INTERNAL_EMBED_HLS_VIDEO)

    await videoWatchPage.waitEmbedForDisplayed()
    await checkCorrectlyPlay(playerPage)
  })
})