mirror of https://github.com/Chocobozzz/PeerTube
Unblock ios e2e tests
parent
853c3d533d
commit
ee68bbc481
Binary file not shown.
|
@ -12,52 +12,55 @@ exports.config = {
|
|||
'browserstack.user': process.env.BROWSERSTACK_USER,
|
||||
'browserstack.key': process.env.BROWSERSTACK_KEY,
|
||||
'browserstack.local': true,
|
||||
'browserstack.console': 'info',
|
||||
'browserstack.console': 'verbose',
|
||||
'browserstack.networkLogs': true,
|
||||
'browserstack.debug': true,
|
||||
project: 'PeerTube',
|
||||
build: 'Main',
|
||||
name: 'Bstack-[Protractor] Parallel Test'
|
||||
},
|
||||
|
||||
multiCapabilities: [
|
||||
// {
|
||||
// browserName: 'Safari',
|
||||
// version: '11.1',
|
||||
// name: 'Safari Desktop',
|
||||
// resolution: '1280x1024'
|
||||
// },
|
||||
// {
|
||||
// browserName: 'Chrome',
|
||||
// name: 'Latest Chrome Desktop',
|
||||
// resolution: '1280x1024'
|
||||
// },
|
||||
// {
|
||||
// browserName: 'Firefox',
|
||||
// version: '60', // ESR,
|
||||
// name: 'Firefox ESR Desktop',
|
||||
// resolution: '1280x1024'
|
||||
// },
|
||||
// {
|
||||
// browserName: 'Firefox',
|
||||
// name: 'Latest Firefox Desktop',
|
||||
// resolution: '1280x1024'
|
||||
// },
|
||||
// {
|
||||
// browserName: 'Edge',
|
||||
// name: 'Latest Edge Desktop',
|
||||
// resolution: '1280x1024'
|
||||
// },
|
||||
// {
|
||||
// browserName: 'Chrome',
|
||||
// device: 'Google Nexus 6',
|
||||
// realMobile: 'true',
|
||||
// os_version: '5.0',
|
||||
// name: 'Latest Chrome Android'
|
||||
// },
|
||||
{
|
||||
browserName: 'Safari',
|
||||
version: '11.1',
|
||||
name: 'Safari Desktop',
|
||||
resolution: '1280x1024'
|
||||
},
|
||||
{
|
||||
browserName: 'Chrome',
|
||||
name: 'Latest Chrome Desktop',
|
||||
resolution: '1280x1024'
|
||||
},
|
||||
{
|
||||
browserName: 'Firefox',
|
||||
version: '60', // ESR,
|
||||
name: 'Firefox ESR Desktop',
|
||||
resolution: '1280x1024'
|
||||
},
|
||||
{
|
||||
browserName: 'Firefox',
|
||||
name: 'Latest Firefox Desktop',
|
||||
resolution: '1280x1024'
|
||||
},
|
||||
{
|
||||
browserName: 'Edge',
|
||||
name: 'Latest Edge Desktop',
|
||||
resolution: '1280x1024'
|
||||
},
|
||||
{
|
||||
browserName: 'Chrome',
|
||||
device: 'Google Nexus 6',
|
||||
device: 'iPhone 8',
|
||||
realMobile: 'true',
|
||||
os_version: '5.0',
|
||||
name: 'Latest Chrome Android'
|
||||
},
|
||||
{
|
||||
browserName: 'Safari',
|
||||
device: 'iPhone SE',
|
||||
realMobile: 'true',
|
||||
os_version: '11.2',
|
||||
name: 'Latest Safari iPhone'
|
||||
os_version: '12',
|
||||
name: 'Safari iPhone'
|
||||
}
|
||||
],
|
||||
|
||||
|
|
|
@ -10,12 +10,5 @@ export class AppPage {
|
|||
await element(by.css('.configure-instance-button')).click()
|
||||
|
||||
await browser.switchTo().window(firstHandle)
|
||||
|
||||
await browser.refresh()
|
||||
|
||||
await element(by.css('.form-group-checkbox')).click()
|
||||
await element(by.css('.action-button-cancel')).click()
|
||||
|
||||
await browser.switchTo().window(firstHandle)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { browser, by, element, ElementFinder, ExpectedConditions } from 'protractor'
|
||||
import { browserSleep } from '../utils'
|
||||
|
||||
export class VideoWatchPage {
|
||||
async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
|
||||
|
@ -11,10 +12,10 @@ export class VideoWatchPage {
|
|||
url = '/videos/recently-added'
|
||||
}
|
||||
|
||||
await browser.get(url)
|
||||
await browser.get(url, 20000)
|
||||
|
||||
// Waiting the following element does not work on Safari...
|
||||
if (isSafari) return browser.sleep(3000)
|
||||
if (isSafari) return browserSleep(3000)
|
||||
|
||||
const elem = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
|
||||
return browser.wait(browser.ExpectedConditions.visibilityOf(elem))
|
||||
|
@ -27,13 +28,12 @@ export class VideoWatchPage {
|
|||
}
|
||||
|
||||
waitWatchVideoName (videoName: string, isMobileDevice: boolean, isSafari: boolean) {
|
||||
if (isSafari) return browserSleep(5000)
|
||||
|
||||
// On mobile we display the first node, on desktop the second
|
||||
const index = isMobileDevice ? 0 : 1
|
||||
|
||||
const elem = element.all(by.css('.video-info .video-info-name')).get(index)
|
||||
|
||||
if (isSafari) return browser.sleep(5000)
|
||||
|
||||
return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName))
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ export class VideoWatchPage {
|
|||
await playButton.click()
|
||||
}
|
||||
|
||||
await browser.sleep(1000)
|
||||
await browserSleep(1000)
|
||||
await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
|
||||
|
||||
const videojsEl = element(by.css('div.video-js'))
|
||||
|
@ -63,13 +63,16 @@ export class VideoWatchPage {
|
|||
|
||||
// On Android, we need to click twice on "play" (BrowserStack particularity)
|
||||
if (isMobileDevice) {
|
||||
await browser.sleep(3000)
|
||||
await browserSleep(3000)
|
||||
|
||||
await videojsEl.click()
|
||||
}
|
||||
|
||||
await browser.sleep(7000)
|
||||
browser.ignoreSynchronization = false
|
||||
await browserSleep(7000)
|
||||
browser.ignoreSynchronization = true
|
||||
|
||||
return videojsEl.click()
|
||||
await videojsEl.click()
|
||||
}
|
||||
|
||||
async clickOnVideo (videoName: string) {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
import { browser } from 'protractor'
|
||||
|
||||
async function browserSleep (amount: number) {
|
||||
if (await isIOS()) browser.ignoreSynchronization = false
|
||||
|
||||
await browser.sleep(amount)
|
||||
|
||||
if (await isIOS()) browser.ignoreSynchronization = true
|
||||
}
|
||||
|
||||
async function isMobileDevice () {
|
||||
const caps = await browser.getCapabilities()
|
||||
return caps.get('realMobile') === 'true' || caps.get('realMobile') === true
|
||||
}
|
||||
|
||||
async function isSafari () {
|
||||
const caps = await browser.getCapabilities()
|
||||
return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
|
||||
}
|
||||
|
||||
async function isIOS () {
|
||||
return await isMobileDevice() && await isSafari()
|
||||
}
|
||||
|
||||
export {
|
||||
isMobileDevice,
|
||||
isSafari,
|
||||
isIOS,
|
||||
browserSleep
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
import { VideoWatchPage } from './po/video-watch.po'
|
||||
import { VideoUploadPage } from './po/video-upload.po'
|
||||
import { LoginPage } from './po/login.po'
|
||||
import { browser } from 'protractor'
|
||||
import { VideoUpdatePage } from './po/video-update.po'
|
||||
import { MyAccountPage } from './po/my-account'
|
||||
import { AppPage } from './po/app.po'
|
||||
import { LoginPage } from './po/login.po'
|
||||
import { MyAccountPage } from './po/my-account'
|
||||
import { VideoUpdatePage } from './po/video-update.po'
|
||||
import { VideoUploadPage } from './po/video-upload.po'
|
||||
import { VideoWatchPage } from './po/video-watch.po'
|
||||
import { isIOS, isMobileDevice, isSafari } from './utils'
|
||||
|
||||
async function skipIfUploadNotSupported () {
|
||||
if (await isMobileDevice() || await isSafari()) {
|
||||
|
@ -15,16 +16,6 @@ async function skipIfUploadNotSupported () {
|
|||
return false
|
||||
}
|
||||
|
||||
async function isMobileDevice () {
|
||||
const caps = await browser.getCapabilities()
|
||||
return caps.get('realMobile') === 'true' || caps.get('realMobile') === true
|
||||
}
|
||||
|
||||
async function isSafari () {
|
||||
const caps = await browser.getCapabilities()
|
||||
return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
|
||||
}
|
||||
|
||||
describe('Videos workflow', () => {
|
||||
let videoWatchPage: VideoWatchPage
|
||||
let videoUploadPage: VideoUploadPage
|
||||
|
@ -46,11 +37,15 @@ describe('Videos workflow', () => {
|
|||
loginPage = new LoginPage()
|
||||
appPage = new AppPage()
|
||||
|
||||
if (await isMobileDevice()) {
|
||||
console.log('Mobile device detected.')
|
||||
}
|
||||
if (await isIOS()) {
|
||||
// iOS does not seem to work with protractor
|
||||
// https://github.com/angular/protractor/issues/2840
|
||||
browser.ignoreSynchronization = true
|
||||
|
||||
if (await isSafari()) {
|
||||
console.log('iOS detected')
|
||||
} else if (await isMobileDevice()) {
|
||||
console.log('Android detected.')
|
||||
} else if (await isSafari()) {
|
||||
console.log('Safari detected.')
|
||||
}
|
||||
|
||||
|
|
|
@ -11,4 +11,4 @@ npm run clean:server:test
|
|||
|
||||
npm run concurrently -- -k -s first \
|
||||
"cd client && npm run ng -- e2e --port 3333" \
|
||||
"NODE_ENV=test NODE_APP_INSTANCE=1 NODE_CONFIG='{ \"log\": { \"level\": \"warning\" } }' npm start"
|
||||
"NODE_ENV=test NODE_APP_INSTANCE=1 NODE_CONFIG='{ \"log\": { \"level\": \"warning\" }, \"signup\": { \"enabled\": false } }' node dist/server"
|
||||
|
|
|
@ -11,4 +11,4 @@ npm run clean:server:test
|
|||
|
||||
npm run concurrently -- -k -s first \
|
||||
"cd client && npm run ng -- e2e --port 3333 -c local" \
|
||||
"NODE_ENV=test NODE_APP_INSTANCE=1 NODE_CONFIG='{ \"log\": { \"level\": \"warning\" } }' node dist/server"
|
||||
"NODE_ENV=test NODE_APP_INSTANCE=1 NODE_CONFIG='{ \"log\": { \"level\": \"warning\" }, \"signup\": { \"enabled\": false } }' node dist/server"
|
||||
|
|
Loading…
Reference in New Issue