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',
// 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 () {
// 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()
}
}
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 () => {
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)
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)
})
})