Skip to content

Commit

Permalink
[Reporting] Fix screenshot pipeline for multi-page (elastic#56928)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
tsullivan and elasticmachine committed Feb 6, 2020
1 parent 9c46ce8 commit c2e7842
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -85,10 +84,11 @@ export function screenshotsObservableFactory(
);

return Rx.race(screenshot$, exit$);
})
}),
first()
);
}),
first(),
take(urls.length),
toArray()
);
};
Expand Down

0 comments on commit c2e7842

Please sign in to comment.