aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-17 08:11:25 +0200
committerChocobozzz <me@florianbigard.com>2019-06-17 08:16:09 +0200
commite69cb173ba63d0e556d4af6cbaf18b11f16af3a9 (patch)
treed75c666b2a66f667db1e9dce7f9f606a6b30cfcb /client/e2e/src/po
parent6b226c32782ea7779ced56c1e1090d8b51c5c504 (diff)
downloadPeerTube-e69cb173ba63d0e556d4af6cbaf18b11f16af3a9.tar.gz
PeerTube-e69cb173ba63d0e556d4af6cbaf18b11f16af3a9.tar.zst
PeerTube-e69cb173ba63d0e556d4af6cbaf18b11f16af3a9.zip
Add more e2e tests
Diffstat (limited to 'client/e2e/src/po')
-rw-r--r--client/e2e/src/po/my-account.ts72
-rw-r--r--client/e2e/src/po/video-update.po.ts20
-rw-r--r--client/e2e/src/po/video-watch.po.ts43
3 files changed, 134 insertions, 1 deletions
diff --git a/client/e2e/src/po/my-account.ts b/client/e2e/src/po/my-account.ts
new file mode 100644
index 000000000..e49372983
--- /dev/null
+++ b/client/e2e/src/po/my-account.ts
@@ -0,0 +1,72 @@
1import { by, element } from 'protractor'
2
3export class MyAccountPage {
4
5 navigateToMyVideos () {
6 return element(by.css('a[href="/my-account/videos"]')).click()
7 }
8
9 navigateToMyPlaylists () {
10 return element(by.css('a[href="/my-account/video-playlists"]')).click()
11 }
12
13 navigateToMyHistory () {
14 return element(by.css('a[href="/my-account/history/videos"]')).click()
15 }
16
17 // My account Videos
18
19 getLastVideoName () {
20 return this.getAllVideoNameElements().first().getText()
21 }
22
23 removeLastVideo () {
24 return this.getLastVideoElement().element(by.css('my-delete-button')).click()
25 }
26
27 validRemove () {
28 return element(by.css('.action-button-submit')).click()
29 }
30
31 countVideos () {
32 return this.getAllVideoNameElements().count()
33 }
34
35 // My account playlists
36
37 getLastUpdatedPlaylistName () {
38 return this.getLastUpdatedPlaylist().element(by.css('.miniature-name')).getText()
39 }
40
41 getLastUpdatedPlaylistVideosText () {
42 return this.getLastUpdatedPlaylist().element(by.css('.miniature-playlist-info-overlay')).getText()
43 }
44
45 clickOnLastUpdatedPlaylist () {
46 return this.getLastUpdatedPlaylist().element(by.css('.miniature-thumbnail')).click()
47 }
48
49 countTotalPlaylistElements () {
50 return element.all(by.css('my-video-playlist-element-miniature')).count()
51 }
52
53 playPlaylist () {
54 return element(by.css('.playlist-info .miniature-thumbnail')).click()
55 }
56
57 // My account Videos
58
59 private getLastVideoElement () {
60 return element.all(by.css('.video')).first()
61 }
62
63 private getAllVideoNameElements () {
64 return element.all(by.css('.video-miniature-name'))
65 }
66
67 // My account playlists
68
69 private getLastUpdatedPlaylist () {
70 return element.all(by.css('my-video-playlist-miniature')).first()
71 }
72}
diff --git a/client/e2e/src/po/video-update.po.ts b/client/e2e/src/po/video-update.po.ts
new file mode 100644
index 000000000..4de3b1b1d
--- /dev/null
+++ b/client/e2e/src/po/video-update.po.ts
@@ -0,0 +1,20 @@
1import { by, element } from 'protractor'
2
3export class VideoUpdatePage {
4
5 async updateName (videoName: string) {
6 const nameInput = element(by.css('input#name'))
7 await nameInput.clear()
8 await nameInput.sendKeys(videoName)
9 }
10
11 async validUpdate () {
12 const submitButton = await this.getSubmitButton()
13
14 return submitButton.click()
15 }
16
17 private getSubmitButton () {
18 return element(by.css('.submit-button:not(.disabled) input'))
19 }
20}
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 5f61d5668..9bb0a3919 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,4 +1,4 @@
1import { browser, by, element } from 'protractor' 1import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor'
2 2
3export class VideoWatchPage { 3export class VideoWatchPage {
4 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { 4 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
@@ -44,6 +44,10 @@ export class VideoWatchPage {
44 .then(seconds => parseInt(seconds, 10)) 44 .then(seconds => parseInt(seconds, 10))
45 } 45 }
46 46
47 getVideoName () {
48 return this.getVideoNameElement().getText()
49 }
50
47 async playAndPauseVideo (isAutoplay: boolean, isMobileDevice: boolean) { 51 async playAndPauseVideo (isAutoplay: boolean, isMobileDevice: boolean) {
48 if (isAutoplay === false) { 52 if (isAutoplay === false) {
49 const playButton = element(by.css('.vjs-big-play-button')) 53 const playButton = element(by.css('.vjs-big-play-button'))
@@ -101,4 +105,41 @@ export class VideoWatchPage {
101 async goOnP2PMediaLoaderEmbed () { 105 async goOnP2PMediaLoaderEmbed () {
102 return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50?mode=p2p-media-loader') 106 return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50?mode=p2p-media-loader')
103 } 107 }
108
109 async clickOnUpdate () {
110 const dropdown = element(by.css('my-video-actions-dropdown .action-button'))
111 await dropdown.click()
112
113 const items: ElementFinder[] = await element.all(by.css('my-video-actions-dropdown .dropdown-menu .dropdown-item'))
114
115 for (const item of items) {
116 const href = await item.getAttribute('href')
117
118 if (href && href.includes('/update/')) {
119 await item.click()
120 return
121 }
122 }
123 }
124
125 async clickOnSave () {
126 return element(by.css('.action-button-save')).click()
127 }
128
129 async saveToWatchLater () {
130 return element.all(by.css('my-video-add-to-playlist .playlist')).first().click()
131 }
132
133 waitUntilVideoName (name: string, maxTime: number) {
134 const elem = this.getVideoNameElement()
135
136 return browser.wait(ExpectedConditions.textToBePresentInElement(elem, name), maxTime)
137 }
138
139 private getVideoNameElement () {
140 // We have 2 video info name block, pick the first that is not empty
141 return element.all(by.css('.video-bottom .video-info-name'))
142 .filter(e => e.getText().then(t => !!t))
143 .first()
144 }
104} 145}