aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-06-18 10:20:55 +0200
committerChocobozzz <me@florianbigard.com>2019-06-19 15:05:35 +0200
commitbbe078ba55be635b5fc92f8f6286c45792b9e7e5 (patch)
tree6d64d40dec7d445a9855856d4cd42587d360bab5 /client/e2e/src
parente379f813d45c4a83442aa13268d351e2605a7a01 (diff)
downloadPeerTube-bbe078ba55be635b5fc92f8f6286c45792b9e7e5.tar.gz
PeerTube-bbe078ba55be635b5fc92f8f6286c45792b9e7e5.tar.zst
PeerTube-bbe078ba55be635b5fc92f8f6286c45792b9e7e5.zip
Fix e2e tests in parallel
Diffstat (limited to 'client/e2e/src')
-rw-r--r--client/e2e/src/po/my-account.ts46
-rw-r--r--client/e2e/src/po/video-watch.po.ts14
-rw-r--r--client/e2e/src/videos.e2e-spec.ts47
3 files changed, 54 insertions, 53 deletions
diff --git a/client/e2e/src/po/my-account.ts b/client/e2e/src/po/my-account.ts
index e49372983..49db789fb 100644
--- a/client/e2e/src/po/my-account.ts
+++ b/client/e2e/src/po/my-account.ts
@@ -16,34 +16,32 @@ export class MyAccountPage {
16 16
17 // My account Videos 17 // My account Videos
18 18
19 getLastVideoName () { 19 removeVideo (name: string) {
20 return this.getAllVideoNameElements().first().getText() 20 return this.getVideoElement(name).element(by.css('my-delete-button')).click()
21 }
22
23 removeLastVideo () {
24 return this.getLastVideoElement().element(by.css('my-delete-button')).click()
25 } 21 }
26 22
27 validRemove () { 23 validRemove () {
28 return element(by.css('.action-button-submit')).click() 24 return element(by.css('.action-button-submit')).click()
29 } 25 }
30 26
31 countVideos () { 27 countVideos (names: string[]) {
32 return this.getAllVideoNameElements().count() 28 return element.all(by.css('.video'))
29 .filter(e => {
30 return e.element(by.css('.video-miniature-name'))
31 .getText()
32 .then(t => names.some(n => t.includes(n)))
33 })
34 .count()
33 } 35 }
34 36
35 // My account playlists 37 // My account playlists
36 38
37 getLastUpdatedPlaylistName () { 39 getPlaylistVideosText (name: string) {
38 return this.getLastUpdatedPlaylist().element(by.css('.miniature-name')).getText() 40 return this.getPlaylist(name).element(by.css('.miniature-playlist-info-overlay')).getText()
39 }
40
41 getLastUpdatedPlaylistVideosText () {
42 return this.getLastUpdatedPlaylist().element(by.css('.miniature-playlist-info-overlay')).getText()
43 } 41 }
44 42
45 clickOnLastUpdatedPlaylist () { 43 clickOnPlaylist (name: string) {
46 return this.getLastUpdatedPlaylist().element(by.css('.miniature-thumbnail')).click() 44 return this.getPlaylist(name).element(by.css('.miniature-thumbnail')).click()
47 } 45 }
48 46
49 countTotalPlaylistElements () { 47 countTotalPlaylistElements () {
@@ -56,17 +54,17 @@ export class MyAccountPage {
56 54
57 // My account Videos 55 // My account Videos
58 56
59 private getLastVideoElement () { 57 private getVideoElement (name: string) {
60 return element.all(by.css('.video')).first() 58 return element.all(by.css('.video'))
61 } 59 .filter(e => e.element(by.css('.video-miniature-name')).getText().then(t => t.includes(name)))
62 60 .first()
63 private getAllVideoNameElements () {
64 return element.all(by.css('.video-miniature-name'))
65 } 61 }
66 62
67 // My account playlists 63 // My account playlists
68 64
69 private getLastUpdatedPlaylist () { 65 private getPlaylist (name: string) {
70 return element.all(by.css('my-video-playlist-miniature')).first() 66 return element.all(by.css('my-video-playlist-miniature'))
67 .filter(e => e.element(by.css('.miniature-name')).getText().then(t => t.includes(name)))
68 .first()
71 } 69 }
72} 70}
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 9bb0a3919..c06b131b6 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -126,8 +126,18 @@ export class VideoWatchPage {
126 return element(by.css('.action-button-save')).click() 126 return element(by.css('.action-button-save')).click()
127 } 127 }
128 128
129 async saveToWatchLater () { 129 async createPlaylist (name: string) {
130 return element.all(by.css('my-video-add-to-playlist .playlist')).first().click() 130 await element(by.css('.new-playlist-button')).click()
131
132 await element(by.css('#displayName')).sendKeys(name)
133
134 return element(by.css('.new-playlist-block input[type=submit]')).click()
135 }
136
137 async saveToPlaylist (name: string) {
138 return element.all(by.css('my-video-add-to-playlist .playlist'))
139 .filter(p => p.getText().then(t => t === name))
140 .click()
131 } 141 }
132 142
133 waitUntilVideoName (name: string, maxTime: number) { 143 waitUntilVideoName (name: string, maxTime: number) {
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts
index c19ab3092..27706a506 100644
--- a/client/e2e/src/videos.e2e-spec.ts
+++ b/client/e2e/src/videos.e2e-spec.ts
@@ -31,7 +31,9 @@ describe('Videos workflow', () => {
31 let myAccountPage: MyAccountPage 31 let myAccountPage: MyAccountPage
32 let loginPage: LoginPage 32 let loginPage: LoginPage
33 33
34 const videoName = new Date().getTime() + ' video' 34 let videoName = new Date().getTime() + ' video'
35 const video2Name = new Date().getTime() + ' second video'
36 const playlistName = new Date().getTime() + ' playlist'
35 let videoWatchUrl: string 37 let videoWatchUrl: string
36 38
37 beforeEach(async () => { 39 beforeEach(async () => {
@@ -122,41 +124,42 @@ describe('Videos workflow', () => {
122 124
123 await videoWatchPage.clickOnUpdate() 125 await videoWatchPage.clickOnUpdate()
124 126
125 await videoUpdatePage.updateName('my new name') 127 videoName += ' updated'
128 await videoUpdatePage.updateName(videoName)
126 129
127 await videoUpdatePage.validUpdate() 130 await videoUpdatePage.validUpdate()
128 131
129 const name = await videoWatchPage.getVideoName() 132 const name = await videoWatchPage.getVideoName()
130 expect(name).toEqual('my new name') 133 expect(name).toEqual(videoName)
131 }) 134 })
132 135
133 it('Should add the video in my playlist', async () => { 136 it('Should add the video in my playlist', async () => {
134 if (await skipIfUploadNotSupported()) return 137 if (await skipIfUploadNotSupported()) return
135 138
136 await videoWatchPage.clickOnSave() 139 await videoWatchPage.clickOnSave()
137 await videoWatchPage.saveToWatchLater() 140
141 await videoWatchPage.createPlaylist(playlistName)
142
143 await videoWatchPage.saveToPlaylist(playlistName)
138 144
139 await videoUploadPage.navigateTo() 145 await videoUploadPage.navigateTo()
140 146
141 await videoUploadPage.uploadVideo() 147 await videoUploadPage.uploadVideo()
142 await videoUploadPage.validSecondUploadStep('second video') 148 await videoUploadPage.validSecondUploadStep(video2Name)
143 149
144 await videoWatchPage.clickOnSave() 150 await videoWatchPage.clickOnSave()
145 await videoWatchPage.saveToWatchLater() 151 await videoWatchPage.saveToPlaylist(playlistName)
146 }) 152 })
147 153
148 it('Should have the watch later playlist in my account', async () => { 154 it('Should have the playlist in my account', async () => {
149 if (await skipIfUploadNotSupported()) return 155 if (await skipIfUploadNotSupported()) return
150 156
151 await myAccountPage.navigateToMyPlaylists() 157 await myAccountPage.navigateToMyPlaylists()
152 158
153 const name = await myAccountPage.getLastUpdatedPlaylistName() 159 const videosNumberText = await myAccountPage.getPlaylistVideosText(playlistName)
154 expect(name).toEqual('Watch later')
155
156 const videosNumberText = await myAccountPage.getLastUpdatedPlaylistVideosText()
157 expect(videosNumberText).toEqual('2 videos') 160 expect(videosNumberText).toEqual('2 videos')
158 161
159 await myAccountPage.clickOnLastUpdatedPlaylist() 162 await myAccountPage.clickOnPlaylist(playlistName)
160 163
161 const count = await myAccountPage.countTotalPlaylistElements() 164 const count = await myAccountPage.countTotalPlaylistElements()
162 expect(count).toEqual(2) 165 expect(count).toEqual(2)
@@ -167,35 +170,25 @@ describe('Videos workflow', () => {
167 170
168 await myAccountPage.playPlaylist() 171 await myAccountPage.playPlaylist()
169 172
170 await videoWatchPage.waitUntilVideoName('second video', 20000 * 1000) 173 await videoWatchPage.waitUntilVideoName(video2Name, 20000 * 1000)
171 }) 174 })
172 175
173 it('Should have the video in my account', async () => { 176 it('Should delete the video 2', async () => {
174 if (await skipIfUploadNotSupported()) return 177 if (await skipIfUploadNotSupported()) return
175 178
176 await myAccountPage.navigateToMyVideos() 179 await myAccountPage.navigateToMyVideos()
177 180
178 const lastVideoName = await myAccountPage.getLastVideoName() 181 await myAccountPage.removeVideo(video2Name)
179 expect(lastVideoName).toEqual('second video')
180 })
181
182 it('Should delete the last video', async () => {
183 if (await skipIfUploadNotSupported()) return
184
185 await myAccountPage.removeLastVideo()
186 await myAccountPage.validRemove() 182 await myAccountPage.validRemove()
187 183
188 const count = await myAccountPage.countVideos() 184 const count = await myAccountPage.countVideos([ videoName, video2Name ])
189 expect(count).toEqual(1) 185 expect(count).toEqual(1)
190 }) 186 })
191 187
192 it('Should delete the first video', async () => { 188 it('Should delete the first video', async () => {
193 if (await skipIfUploadNotSupported()) return 189 if (await skipIfUploadNotSupported()) return
194 190
195 await myAccountPage.removeLastVideo() 191 await myAccountPage.removeVideo(videoName)
196 await myAccountPage.validRemove() 192 await myAccountPage.validRemove()
197
198 const count = await myAccountPage.countVideos()
199 expect(count).toEqual(0)
200 }) 193 })
201}) 194})