--- /dev/null
+import { browser, by, element } from 'protractor'
+
+export class AppPage {
+
+ async closeWelcomeModal () {
+ const firstHandle = await browser.getWindowHandle()
+
+ if (await element(by.css('.configure-instance-button')).isPresent() === false) return
+
+ 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)
+ }
+}
import { browser } from 'protractor'
import { VideoUpdatePage } from './po/video-update.po'
import { MyAccountPage } from './po/my-account'
+import { AppPage } from './po/app.po'
async function skipIfUploadNotSupported () {
if (await isMobileDevice() || await isSafari()) {
let videoUpdatePage: VideoUpdatePage
let myAccountPage: MyAccountPage
let loginPage: LoginPage
+ let appPage: AppPage
let videoName = new Date().getTime() + ' video'
const video2Name = new Date().getTime() + ' second video'
videoUpdatePage = new VideoUpdatePage()
myAccountPage = new MyAccountPage()
loginPage = new LoginPage()
+ appPage = new AppPage()
if (await isMobileDevice()) {
console.log('Mobile device detected.')
return loginPage.loginAsRootUser()
})
+ it('Should close the welcome modal', async () => {
+ if (await skipIfUploadNotSupported()) return
+
+ await appPage.closeWelcomeModal()
+ })
+
it('Should upload a video', async () => {
if (await skipIfUploadNotSupported()) return
--- /dev/null
+import { SchedulerLike, Subscription } from 'rxjs'
+import { NgZone } from '@angular/core'
+
+class LeaveZoneScheduler implements SchedulerLike {
+ constructor (private zone: NgZone, private scheduler: SchedulerLike) {
+ }
+
+ schedule (...args: any[]): Subscription {
+ return this.zone.runOutsideAngular(() =>
+ this.scheduler.schedule.apply(this.scheduler, args)
+ )
+ }
+
+ now (): number {
+ return this.scheduler.now()
+ }
+}
+
+class EnterZoneScheduler implements SchedulerLike {
+ constructor (private zone: NgZone, private scheduler: SchedulerLike) {
+ }
+
+ schedule (...args: any[]): Subscription {
+ return this.zone.run(() =>
+ this.scheduler.schedule.apply(this.scheduler, args)
+ )
+ }
+
+ now (): number {
+ return this.scheduler.now()
+ }
+}
+
+export function leaveZone (zone: NgZone, scheduler: SchedulerLike): SchedulerLike {
+ return new LeaveZoneScheduler(zone, scheduler)
+}
+
+export function enterZone (zone: NgZone, scheduler: SchedulerLike): SchedulerLike {
+ return new EnterZoneScheduler(zone, scheduler)
+}
-import { bufferTime, catchError, filter, map, tap, share, switchMap } from 'rxjs/operators'
-import { Observable, ReplaySubject, Subject, of, merge } from 'rxjs'
+import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators'
+import { asyncScheduler, merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
import { HttpClient, HttpParams } from '@angular/common/http'
-import { Injectable } from '@angular/core'
+import { Injectable, NgZone } from '@angular/core'
import { ResultList } from '../../../../../shared'
import { environment } from '../../../environments/environment'
import { RestExtractor, RestService } from '../rest'
import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model'
import { uniq } from 'lodash-es'
import * as debug from 'debug'
+import { enterZone, leaveZone } from '@app/shared/rxjs/zone'
const logger = debug('peertube:subscriptions:UserSubscriptionService')
constructor (
private authHttp: HttpClient,
private restExtractor: RestExtractor,
- private restService: RestService
+ private restService: RestService,
+ private ngZone: NgZone
) {
this.existsObservable = merge(
this.existsSubject.pipe(
- bufferTime(500),
+ // We leave Angular zone so Protractor does not get stuck
+ bufferTime(500, leaveZone(this.ngZone, asyncScheduler)),
filter(uris => uris.length !== 0),
map(uris => uniq(uris)),
+ observeOn(enterZone(this.ngZone, asyncScheduler)),
switchMap(uris => this.doSubscriptionsExist(uris)),
share()
),
-import { bufferTime, catchError, filter, map, share, switchMap, tap } from 'rxjs/operators'
-import { Injectable } from '@angular/core'
-import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
+import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators'
+import { Injectable, NgZone } from '@angular/core'
+import { asyncScheduler, merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
import { RestExtractor } from '../rest/rest-extractor.service'
import { HttpClient, HttpParams } from '@angular/common/http'
import { ResultList, VideoPlaylistElementCreate, VideoPlaylistElementUpdate } from '../../../../../shared'
import { VideoPlaylistElement } from '@app/shared/video-playlist/video-playlist-element.model'
import { uniq } from 'lodash-es'
import * as debug from 'debug'
+import { enterZone, leaveZone } from '@app/shared/rxjs/zone'
const logger = debug('peertube:playlists:VideoPlaylistService')
private authHttp: HttpClient,
private serverService: ServerService,
private restExtractor: RestExtractor,
- private restService: RestService
+ private restService: RestService,
+ private ngZone: NgZone
) {
this.videoExistsInPlaylistObservable = merge(
this.videoExistsInPlaylistNotifier.pipe(
- bufferTime(500),
+ // We leave Angular zone so Protractor does not get stuck
+ bufferTime(500, leaveZone(this.ngZone, asyncScheduler)),
filter(videoIds => videoIds.length !== 0),
map(videoIds => uniq(videoIds)),
+ observeOn(enterZone(this.ngZone, asyncScheduler)),
switchMap(videoIds => this.doVideosExistInPlaylist(videoIds)),
share()
),
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\" } }' npm start"
+ "NODE_ENV=test NODE_APP_INSTANCE=1 NODE_CONFIG='{ \"log\": { \"level\": \"warning\" } }' node dist/server"
'File size for resolution ' + file.resolution.label + ' outside confidence interval (' + minSize + '> size <' + maxSize + ')')
.to.be.above(minSize).and.below(maxSize)
- {
- await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath)
- }
-
- if (attributes.previewfile) {
- await testImage(url, attributes.previewfile, videoDetails.previewPath)
- }
-
const torrent = await webtorrentAdd(file.magnetUri, true)
expect(torrent.files).to.be.an('array')
expect(torrent.files.length).to.equal(1)
expect(torrent.files[0].path).to.exist.and.to.not.equal('')
}
+
+ await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath)
+
+ if (attributes.previewfile) {
+ await testImage(url, attributes.previewfile, videoDetails.previewPath)
+ }
}
async function videoUUIDToId (url: string, id: number | string) {