From afeef6c235379386b07da7f66c9ddae0bf81c547 Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Wed, 5 Feb 2020 15:12:32 -0700 Subject: [PATCH] [Reporting] Fix screenshot pipeline for multi-page --- .../export_types/common/lib/screenshots/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/index.ts b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/index.ts index b83021d5e38dd..9fd3ee391ddbb 100644 --- a/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/index.ts +++ b/x-pack/legacy/plugins/reporting/export_types/common/lib/screenshots/index.ts @@ -5,7 +5,7 @@ */ import * as Rx from 'rxjs'; -import { first, mergeMap, toArray } from 'rxjs/operators'; +import { first, concatMap, take, toArray, mergeMap } from 'rxjs/operators'; import { ServerFacade, CaptureConfig, HeadlessChromiumDriverFactory } from '../../../../types'; import { ScreenshotResults, ScreenshotObservableOpts } from './types'; import { injectCustomCss } from './inject_css'; @@ -37,12 +37,11 @@ export function screenshotsObservableFactory( { viewport: layout.getBrowserViewport(), browserTimezone }, logger ); - return Rx.from(urls).pipe( - mergeMap(url => { + concatMap(url => { return create$.pipe( mergeMap(({ driver, exit$ }) => { - const screenshot$ = Rx.of(driver).pipe( + const screenshot$ = Rx.of(1).pipe( mergeMap(() => openUrl(driver, url, conditionalHeaders, logger)), mergeMap(() => skipTelemetry(driver, logger)), mergeMap(() => scanPage(driver, layout, logger)), @@ -85,10 +84,11 @@ export function screenshotsObservableFactory( ); return Rx.race(screenshot$, exit$); - }) + }), + first() ); }), - first(), + take(urls.length), toArray() ); };