'browserstack.user': process.env.BROWSERSTACK_USER,
'browserstack.key': process.env.BROWSERSTACK_KEY,
'browserstack.local': true,
- projec: 'PeerTube'
+ project: 'PeerTube'
},
multiCapabilities: [
},
{
browserName: 'Safari',
- version: '11.1',
- resolution: '1920x1080'
+ version: '11.1'
},
{
browserName: 'Firefox',
import { by, element, browser } from 'protractor'
export class VideoWatchPage {
- async goOnVideosList (isIphoneDevice: boolean, isSafari: boolean) {
+ async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
let url: string
- if (isIphoneDevice === true) {
- // Local testing is buggy :/
+ // We did not upload a file on a mobile device
+ if (isMobileDevice === true || isSafari === true) {
url = 'https://peertube2.cpy.re/videos/local'
} else {
url = '/videos/recently-added'
.then((texts: any) => texts.map(t => t.trim()))
}
- waitWatchVideoName (videoName: string) {
+ waitWatchVideoName (videoName: string, isSafari: boolean) {
const elem = element(by.css('.video-info .video-info-name'))
+
+ if (isSafari) return browser.sleep(5000)
+
return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName))
}
.then(seconds => parseInt(seconds, 10))
}
- async pauseVideo (pauseAfterMs: number, isAutoplay: boolean, isSafari: boolean) {
+ async pauseVideo (isAutoplay: boolean, isDesktopSafari: boolean) {
if (isAutoplay === false) {
const playButton = element(by.css('.vjs-big-play-button'))
await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
await playButton.click()
}
- if (isSafari === true) {
- await browser.sleep(1000)
- await element(by.css('.vjs-play-control')).click()
- }
+ // if (isDesktopSafari === true) {
+ // await browser.sleep(1000)
+ // await element(by.css('.vjs-play-control')).click()
+ // }
await browser.sleep(1000)
await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
- const el = element(by.css('div.video-js'))
- await browser.wait(browser.ExpectedConditions.elementToBeClickable(el))
+ const videojsEl = element(by.css('div.video-js'))
+ await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl))
- await browser.sleep(pauseAfterMs)
+ await browser.sleep(7000)
- return el.click()
+ return videojsEl.click()
}
async clickOnVideo (videoName: string) {
}
async clickOnFirstVideo () {
- const video = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
+ const video = element.all(by.css('.videos .video-miniature .video-thumbnail')).first()
+ const videoName = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
+
+ // Don't know why but the expectation fails on Safari
await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
- const textToReturn = video.getText()
+ const textToReturn = videoName.getText()
await video.click()
await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))
let loginPage: LoginPage
const videoName = new Date().getTime() + ' video'
let isMobileDevice = false
- let isIphoneDevice = false
let isSafari = false
beforeEach(async () => {
const caps = await browser.getCapabilities()
isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true
- isIphoneDevice = caps.get('device') === 'iphone'
isSafari = caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
})
it('Should log in', () => {
- if (isMobileDevice) {
- console.log('Skipping because we are on a real device and BrowserStack does not support file upload.')
+ if (isMobileDevice || isSafari) {
+ console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
return
}
})
it('Should upload a video', async () => {
- if (isMobileDevice) {
- console.log('Skipping because we are on a real device and BrowserStack does not support file upload.')
+ if (isMobileDevice || isSafari) {
+ console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
return
}
})
it('Should list the video', async () => {
- await videoWatchPage.goOnVideosList(isIphoneDevice, isSafari)
+ await videoWatchPage.goOnVideosList(isMobileDevice, isSafari)
- if (isMobileDevice) {
- console.log('Skipping because we are on a real device and BrowserStack does not support file upload.')
+ if (isMobileDevice || isSafari) {
+ console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
return
}
it('Should go on video watch page', async () => {
let videoNameToExcept = videoName
- if (isMobileDevice) videoNameToExcept = await videoWatchPage.clickOnFirstVideo()
+ if (isMobileDevice || isSafari) videoNameToExcept = await videoWatchPage.clickOnFirstVideo()
else await videoWatchPage.clickOnVideo(videoName)
- return videoWatchPage.waitWatchVideoName(videoNameToExcept)
+ return videoWatchPage.waitWatchVideoName(videoNameToExcept, isSafari)
})
it('Should play the video', async () => {
- await videoWatchPage.pauseVideo(7000, !isMobileDevice, isSafari)
+ await videoWatchPage.pauseVideo(!isMobileDevice, isSafari && isMobileDevice === false)
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
})
it('Should watch the associated embed video', async () => {
await videoWatchPage.goOnAssociatedEmbed()
- await videoWatchPage.pauseVideo(7000, false, isSafari)
+ await videoWatchPage.pauseVideo(false, isSafari && isMobileDevice === false)
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
})
})
private tryToPlay (done?: Function) {
if (!done) done = function () { /* empty */ }
+
const playPromise = this.player.play()
if (playPromise !== undefined) {
return playPromise.then(done)
// Proxy first play
const oldPlay = this.player.play.bind(this.player)
this.player.play = () => {
- // Avoid issue new play policy on mobiles
- if (isMobile()) oldPlay()
-
this.player.addClass('vjs-has-big-play-button-clicked')
this.player.play = oldPlay