Cleanup E2E tests

This commit is contained in:
Chocobozzz 2020-05-13 10:15:31 +02:00
parent 943fddfbbe
commit 0845e480d2
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 44 additions and 43 deletions

View File

@ -21,40 +21,40 @@ exports.config = {
}, },
multiCapabilities: [ multiCapabilities: [
// { {
// browserName: 'Safari', browserName: 'Safari',
// version: '11.1', version: '11.1',
// name: 'Safari Desktop', name: 'Safari Desktop',
// resolution: '1280x1024' resolution: '1280x1024'
// }, },
// { {
// browserName: 'Chrome', browserName: 'Chrome',
// name: 'Latest Chrome Desktop', name: 'Latest Chrome Desktop',
// resolution: '1280x1024' resolution: '1280x1024'
// }, },
// { {
// browserName: 'Firefox', browserName: 'Firefox',
// version: '60', // ESR, version: '60', // ESR,
// name: 'Firefox ESR Desktop', name: 'Firefox ESR Desktop',
// resolution: '1280x1024' resolution: '1280x1024'
// }, },
// { {
// browserName: 'Firefox', browserName: 'Firefox',
// name: 'Latest Firefox Desktop', name: 'Latest Firefox Desktop',
// resolution: '1280x1024' resolution: '1280x1024'
// }, },
// { {
// browserName: 'Edge', browserName: 'Edge',
// name: 'Latest Edge Desktop', name: 'Latest Edge Desktop',
// resolution: '1280x1024' resolution: '1280x1024'
// }, },
// { {
// browserName: 'Chrome', browserName: 'Chrome',
// device: 'Google Nexus 6', device: 'Google Nexus 6',
// realMobile: 'true', realMobile: 'true',
// os_version: '5.0', os_version: '5.0',
// name: 'Latest Chrome Android' name: 'Latest Chrome Android'
// }, },
{ {
browserName: 'Safari', browserName: 'Safari',
device: 'iPhone 8', device: 'iPhone 8',

View File

@ -1,5 +1,5 @@
import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor' import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor'
import { browserSleep } from '../utils' import { browserSleep, isIOS, isMobileDevice } from '../utils'
export class VideoWatchPage { export class VideoWatchPage {
async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) { async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
@ -48,22 +48,23 @@ export class VideoWatchPage {
return this.getVideoNameElement().getText() return this.getVideoNameElement().getText()
} }
async playAndPauseVideo (isAutoplay: boolean, isMobileDevice: boolean) { async playAndPauseVideo (isAutoplay: boolean) {
if (isAutoplay === false) { // Autoplay is disabled on iOS
if (isAutoplay === false || await isIOS()) {
const playButton = element(by.css('.vjs-big-play-button')) const playButton = element(by.css('.vjs-big-play-button'))
await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
await playButton.click() await playButton.click()
} }
await browserSleep(1000) await browserSleep(2000)
await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
const videojsEl = element(by.css('div.video-js')) const videojsEl = element(by.css('div.video-js'))
await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl))
// On Android, we need to click twice on "play" (BrowserStack particularity) // On Android, we need to click twice on "play" (BrowserStack particularity)
if (isMobileDevice) { if (await isMobileDevice()) {
await browserSleep(3000) await browserSleep(5000)
await videojsEl.click() await videojsEl.click()
} }

View File

@ -99,7 +99,7 @@ describe('Videos workflow', () => {
it('Should play the video', async () => { it('Should play the video', async () => {
videoWatchUrl = await browser.getCurrentUrl() videoWatchUrl = await browser.getCurrentUrl()
await videoWatchPage.playAndPauseVideo(true, await isMobileDevice()) await videoWatchPage.playAndPauseVideo(true)
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
}) })
@ -108,7 +108,7 @@ describe('Videos workflow', () => {
await videoWatchPage.goOnAssociatedEmbed() await videoWatchPage.goOnAssociatedEmbed()
await videoWatchPage.playAndPauseVideo(false, await isMobileDevice()) await videoWatchPage.playAndPauseVideo(false)
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
await browser.waitForAngularEnabled(true) await browser.waitForAngularEnabled(true)
@ -119,7 +119,7 @@ describe('Videos workflow', () => {
await videoWatchPage.goOnP2PMediaLoaderEmbed() await videoWatchPage.goOnP2PMediaLoaderEmbed()
await videoWatchPage.playAndPauseVideo(false, await isMobileDevice()) await videoWatchPage.playAndPauseVideo(false)
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
await browser.waitForAngularEnabled(true) await browser.waitForAngularEnabled(true)