aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/my-account.ts
blob: e49372983c482a4bda9a89fb4ad6fdda7ab2f1dd (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
61
62
63
64
65
66
67
68
69
70
71
72
import { by, element } from 'protractor'

export class MyAccountPage {

  navigateToMyVideos () {
    return element(by.css('a[href="/my-account/videos"]')).click()
  }

  navigateToMyPlaylists () {
    return element(by.css('a[href="/my-account/video-playlists"]')).click()
  }

  navigateToMyHistory () {
    return element(by.css('a[href="/my-account/history/videos"]')).click()
  }

  // My account Videos

  getLastVideoName () {
    return this.getAllVideoNameElements().first().getText()
  }

  removeLastVideo () {
    return this.getLastVideoElement().element(by.css('my-delete-button')).click()
  }

  validRemove () {
    return element(by.css('.action-button-submit')).click()
  }

  countVideos () {
    return this.getAllVideoNameElements().count()
  }

  // My account playlists

  getLastUpdatedPlaylistName () {
    return this.getLastUpdatedPlaylist().element(by.css('.miniature-name')).getText()
  }

  getLastUpdatedPlaylistVideosText () {
    return this.getLastUpdatedPlaylist().element(by.css('.miniature-playlist-info-overlay')).getText()
  }

  clickOnLastUpdatedPlaylist () {
    return this.getLastUpdatedPlaylist().element(by.css('.miniature-thumbnail')).click()
  }

  countTotalPlaylistElements () {
    return element.all(by.css('my-video-playlist-element-miniature')).count()
  }

  playPlaylist () {
    return element(by.css('.playlist-info .miniature-thumbnail')).click()
  }

  // My account Videos

  private getLastVideoElement () {
    return element.all(by.css('.video')).first()
  }

  private getAllVideoNameElements () {
    return element.all(by.css('.video-miniature-name'))
  }

  // My account playlists

  private getLastUpdatedPlaylist () {
    return element.all(by.css('my-video-playlist-miniature')).first()
  }
}