Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix e2e tests in parallel

Chocobozzzbbe078ba55be
diff --git a/client/e2e/protractor.conf.js b/client/e2e/protractor.conf.js
index 51d0b220dc..3fce9b0f53 100644
--- a/client/e2e/protractor.conf.js
+++ b/client/e2e/protractor.conf.js
@@ -18,25 +18,30 @@ exports.config = {
multiCapabilities: [
{
browserName: 'Chrome',
- name: 'Latest Chrome Desktop'
+ name: 'Latest Chrome Desktop',
+ resolution: '1280x1024'
},
{
browserName: 'Safari',
version: '11.1',
- name: 'Safari Desktop'
+ name: 'Safari Desktop',
+ resolution: '1280x1024'
},
{
browserName: 'Firefox',
version: '60', // ESR,
- name: 'Firefox ESR Desktop'
+ name: 'Firefox ESR Desktop',
+ resolution: '1280x1024'
},
{
browserName: 'Firefox',
- name: 'Latest Firefox Desktop'
+ name: 'Latest Firefox Desktop',
+ resolution: '1280x1024'
},
{
browserName: 'Edge',
- name: 'Latest Edge Desktop'
+ name: 'Latest Edge Desktop',
+ resolution: '1280x1024'
},
{
browserName: 'Chrome',
diff --git a/client/e2e/src/po/my-account.ts b/client/e2e/src/po/my-account.ts
index e49372983c..49db789fb4 100644
--- a/client/e2e/src/po/my-account.ts
+++ b/client/e2e/src/po/my-account.ts
@@ -16,34 +16,32 @@ export class MyAccountPage {
// My account Videos
- getLastVideoName () {
- return this.getAllVideoNameElements().first().getText()
- }
-
- removeLastVideo () {
- return this.getLastVideoElement().element(by.css('my-delete-button')).click()
+ removeVideo (name: string) {
+ return this.getVideoElement(name).element(by.css('my-delete-button')).click()
}
validRemove () {
return element(by.css('.action-button-submit')).click()
}
- countVideos () {
- return this.getAllVideoNameElements().count()
+ countVideos (names: string[]) {
+ return element.all(by.css('.video'))
+ .filter(e => {
+ return e.element(by.css('.video-miniature-name'))
+ .getText()
+ .then(t => names.some(n => t.includes(n)))
+ })
+ .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()
+ getPlaylistVideosText (name: string) {
+ return this.getPlaylist(name).element(by.css('.miniature-playlist-info-overlay')).getText()
}
- clickOnLastUpdatedPlaylist () {
- return this.getLastUpdatedPlaylist().element(by.css('.miniature-thumbnail')).click()
+ clickOnPlaylist (name: string) {
+ return this.getPlaylist(name).element(by.css('.miniature-thumbnail')).click()
}
countTotalPlaylistElements () {
@@ -56,17 +54,17 @@ export class MyAccountPage {
// My account Videos
- private getLastVideoElement () {
- return element.all(by.css('.video')).first()
- }
-
- private getAllVideoNameElements () {
- return element.all(by.css('.video-miniature-name'))
+ private getVideoElement (name: string) {
+ return element.all(by.css('.video'))
+ .filter(e => e.element(by.css('.video-miniature-name')).getText().then(t => t.includes(name)))
+ .first()
}
// My account playlists
- private getLastUpdatedPlaylist () {
- return element.all(by.css('my-video-playlist-miniature')).first()
+ private getPlaylist (name: string) {
+ return element.all(by.css('my-video-playlist-miniature'))
+ .filter(e => e.element(by.css('.miniature-name')).getText().then(t => t.includes(name)))
+ .first()
}
}
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 9bb0a39192..c06b131b65 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 {
return element(by.css('.action-button-save')).click()
}
- async saveToWatchLater () {
- return element.all(by.css('my-video-add-to-playlist .playlist')).first().click()
+ async createPlaylist (name: string) {
+ await element(by.css('.new-playlist-button')).click()
+
+ await element(by.css('#displayName')).sendKeys(name)
+
+ return element(by.css('.new-playlist-block input[type=submit]')).click()
+ }
+
+ async saveToPlaylist (name: string) {
+ return element.all(by.css('my-video-add-to-playlist .playlist'))
+ .filter(p => p.getText().then(t => t === name))
+ .click()
}
waitUntilVideoName (name: string, maxTime: number) {
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts
index c19ab30927..27706a5061 100644
--- a/client/e2e/src/videos.e2e-spec.ts
+++ b/client/e2e/src/videos.e2e-spec.ts
@@ -31,7 +31,9 @@ describe('Videos workflow', () => {
let myAccountPage: MyAccountPage
let loginPage: LoginPage
- const videoName = new Date().getTime() + ' video'
+ let videoName = new Date().getTime() + ' video'
+ const video2Name = new Date().getTime() + ' second video'
+ const playlistName = new Date().getTime() + ' playlist'
let videoWatchUrl: string
beforeEach(async () => {
@@ -122,41 +124,42 @@ describe('Videos workflow', () => {
await videoWatchPage.clickOnUpdate()
- await videoUpdatePage.updateName('my new name')
+ videoName += ' updated'
+ await videoUpdatePage.updateName(videoName)
await videoUpdatePage.validUpdate()
const name = await videoWatchPage.getVideoName()
- expect(name).toEqual('my new name')
+ expect(name).toEqual(videoName)
})
it('Should add the video in my playlist', async () => {
if (await skipIfUploadNotSupported()) return
await videoWatchPage.clickOnSave()
- await videoWatchPage.saveToWatchLater()
+
+ await videoWatchPage.createPlaylist(playlistName)
+
+ await videoWatchPage.saveToPlaylist(playlistName)
await videoUploadPage.navigateTo()
await videoUploadPage.uploadVideo()
- await videoUploadPage.validSecondUploadStep('second video')
+ await videoUploadPage.validSecondUploadStep(video2Name)
await videoWatchPage.clickOnSave()
- await videoWatchPage.saveToWatchLater()
+ await videoWatchPage.saveToPlaylist(playlistName)
})
- it('Should have the watch later playlist in my account', async () => {
+ it('Should have the playlist in my account', async () => {
if (await skipIfUploadNotSupported()) return
await myAccountPage.navigateToMyPlaylists()
- const name = await myAccountPage.getLastUpdatedPlaylistName()
- expect(name).toEqual('Watch later')
-
- const videosNumberText = await myAccountPage.getLastUpdatedPlaylistVideosText()
+ const videosNumberText = await myAccountPage.getPlaylistVideosText(playlistName)
expect(videosNumberText).toEqual('2 videos')
- await myAccountPage.clickOnLastUpdatedPlaylist()
+ await myAccountPage.clickOnPlaylist(playlistName)
const count = await myAccountPage.countTotalPlaylistElements()
expect(count).toEqual(2)
@@ -167,35 +170,25 @@ describe('Videos workflow', () => {
await myAccountPage.playPlaylist()
- await videoWatchPage.waitUntilVideoName('second video', 20000 * 1000)
+ await videoWatchPage.waitUntilVideoName(video2Name, 20000 * 1000)
})
- it('Should have the video in my account', async () => {
+ it('Should delete the video 2', async () => {
if (await skipIfUploadNotSupported()) return
await myAccountPage.navigateToMyVideos()
- const lastVideoName = await myAccountPage.getLastVideoName()
- expect(lastVideoName).toEqual('second video')
- })
-
- it('Should delete the last video', async () => {
- if (await skipIfUploadNotSupported()) return
-
- await myAccountPage.removeLastVideo()
+ await myAccountPage.removeVideo(video2Name)
await myAccountPage.validRemove()
- const count = await myAccountPage.countVideos()
+ const count = await myAccountPage.countVideos([ videoName, video2Name ])
expect(count).toEqual(1)
})
it('Should delete the first video', async () => {
if (await skipIfUploadNotSupported()) return
- await myAccountPage.removeLastVideo()
+ await myAccountPage.removeVideo(videoName)
await myAccountPage.validRemove()
-
- const count = await myAccountPage.countVideos()
- expect(count).toEqual(0)
})
})