Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"number": 8467,
"sha": "6cb7fec4e154faa0a4a3fee4b33dfef91b9870d9"
},
"config": {
"puppeteer_skip_chromium_download": true
},
"homepage": "https://www.elastic.co/products/kibana",
"bugs": {
"url": "https://github.com/elastic/kibana/issues"
Expand Down Expand Up @@ -261,8 +264,7 @@
"proper-lockfile": "^3.2.0",
"proxy-from-env": "1.0.0",
"puid": "1.0.7",
"puppeteer": "^2.1.1",
"puppeteer-core": "^1.19.0",
"puppeteer": "^5.5.0",
"query-string": "^6.13.2",
"raw-loader": "^3.1.0",
"re2": "^1.15.4",
Expand Down Expand Up @@ -510,7 +512,7 @@
"@types/pretty-ms": "^5.0.0",
"@types/prop-types": "^15.7.3",
"@types/proper-lockfile": "^3.0.1",
"@types/puppeteer": "^1.20.1",
"@types/puppeteer": "^5.4.1",
"@types/rbush": "^3.0.0",
"@types/reach__router": "^1.2.6",
"@types/react": "^16.9.36",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class HeadlessChromiumDriver {
): Promise<ElementHandle<Element>> {
const { timeout } = opts;
logger.debug(`waitForSelector ${selector}`);
const resp = await this.page.waitFor(selector, { timeout }); // override default 30000ms
const resp = await this.page.waitForSelector(selector, { timeout }); // override default 30000ms
logger.debug(`waitForSelector ${selector} resolved`);
return resp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ import del from 'del';
import fs from 'fs';
import os from 'os';
import path from 'path';
import {
Browser,
ConsoleMessage,
LaunchOptions,
Page,
Request as PuppeteerRequest,
} from 'puppeteer';
import puppeteer from 'puppeteer';
import * as Rx from 'rxjs';
import { InnerSubscriber } from 'rxjs/internal/InnerSubscriber';
import { ignoreElements, map, mergeMap, tap } from 'rxjs/operators';
Expand All @@ -26,7 +20,6 @@ import { CaptureConfig } from '../../../../server/types';
import { LevelLogger } from '../../../lib';
import { safeChildProcess } from '../../safe_child_process';
import { HeadlessChromiumDriver } from '../driver';
import { puppeteerLaunch } from '../puppeteer';
import { args } from './args';

type BrowserConfig = CaptureConfig['browser']['chromium'];
Expand Down Expand Up @@ -73,10 +66,10 @@ export class HeadlessChromiumDriverFactory {

const chromiumArgs = this.getChromiumArgs(viewport);

let browser: Browser;
let page: Page;
let browser: puppeteer.Browser;
let page: puppeteer.Page;
try {
browser = await puppeteerLaunch({
browser = await puppeteer.launch({
pipe: !this.browserConfig.inspect,
userDataDir: this.userDataDir,
executablePath: this.binaryPath,
Expand All @@ -85,7 +78,7 @@ export class HeadlessChromiumDriverFactory {
env: {
TZ: browserTimezone,
},
} as LaunchOptions);
} as puppeteer.LaunchOptions);

page = await browser.newPage();

Expand Down Expand Up @@ -160,8 +153,8 @@ export class HeadlessChromiumDriverFactory {
});
}

getBrowserLogger(page: Page, logger: LevelLogger): Rx.Observable<void> {
const consoleMessages$ = Rx.fromEvent<ConsoleMessage>(page, 'console').pipe(
getBrowserLogger(page: puppeteer.Page, logger: LevelLogger): Rx.Observable<void> {
const consoleMessages$ = Rx.fromEvent<puppeteer.ConsoleMessage>(page, 'console').pipe(
map((line) => {
if (line.type() === 'error') {
logger.error(line.text(), ['headless-browser-console']);
Expand All @@ -171,7 +164,7 @@ export class HeadlessChromiumDriverFactory {
})
);

const pageRequestFailed$ = Rx.fromEvent<PuppeteerRequest>(page, 'requestfailed').pipe(
const pageRequestFailed$ = Rx.fromEvent<puppeteer.Request>(page, 'requestfailed').pipe(
map((req) => {
const failure = req.failure && req.failure();
if (failure) {
Expand All @@ -185,7 +178,7 @@ export class HeadlessChromiumDriverFactory {
return Rx.merge(consoleMessages$, pageRequestFailed$);
}

getProcessLogger(browser: Browser, logger: LevelLogger): Rx.Observable<void> {
getProcessLogger(browser: puppeteer.Browser, logger: LevelLogger): Rx.Observable<void> {
const childProcess = browser.process();
// NOTE: The browser driver can not observe stdout and stderr of the child process
// Puppeteer doesn't give a handle to the original ChildProcess object
Expand All @@ -201,7 +194,7 @@ export class HeadlessChromiumDriverFactory {
return processClose$; // ideally, this would also merge with observers for stdout and stderr
}

getPageExit(browser: Browser, page: Page) {
getPageExit(browser: puppeteer.Browser, page: puppeteer.Page) {
const pageError$ = Rx.fromEvent<Error>(page, 'error').pipe(
mergeMap((err) => {
return Rx.throwError(
Expand Down
30 changes: 15 additions & 15 deletions x-pack/plugins/reporting/server/browsers/chromium/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,34 @@ export const paths = {
{
platforms: ['darwin', 'freebsd', 'openbsd'],
architecture: 'x64',
archiveFilename: 'chromium-312d84c-darwin.zip',
archiveChecksum: '020303e829745fd332ae9b39442ce570',
binaryChecksum: '5cdec11d45a0eddf782bed9b9f10319f',
binaryRelativePath: 'headless_shell-darwin/headless_shell',
archiveFilename: 'chromium-ef768c9-darwin_x64.zip',
archiveChecksum: 'd87287f6b2159cff7c64babac873cc73',
binaryChecksum: '8d777b3380a654e2730fc36afbfb11e1',
binaryRelativePath: 'headless_shell-darwin_x64/headless_shell',
},
{
platforms: ['linux'],
architecture: 'x64',
archiveFilename: 'chromium-312d84c-linux.zip',
archiveChecksum: '15ba9166a42f93ee92e42217b737018d',
binaryChecksum: 'c7fe36ed3e86a6dd23323be0a4e8c0fd',
binaryRelativePath: 'headless_shell-linux/headless_shell',
archiveFilename: 'chromium-ef768c9-linux_x64.zip',
archiveChecksum: '85575e8fd56849f4de5e3584e05712c0',
binaryChecksum: '38c4d849c17683def1283d7e5aa56fe9',
binaryRelativePath: 'headless_shell-linux_x64/headless_shell',
},
{
platforms: ['linux'],
architecture: 'arm64',
archiveFilename: 'chromium-312d84c-linux_arm64.zip',
archiveChecksum: 'aa4d5b99dd2c1bd8e614e67f63a48652',
binaryChecksum: '7fdccff319396f0aee7f269dd85fe6fc',
archiveFilename: 'chromium-ef768c9-linux_arm64.zip',
archiveChecksum: '20b09b70476bea76a276c583bf72eac7',
binaryChecksum: 'dcfd277800c1a5c7d566c445cbdc225c',
binaryRelativePath: 'headless_shell-linux_arm64/headless_shell',
},
{
platforms: ['win32'],
architecture: 'x64',
archiveFilename: 'chromium-312d84c-windows.zip',
archiveChecksum: '3e36adfb755dacacc226ed5fd6b43105',
binaryChecksum: '9913e431fbfc7dfcd958db74ace4d58b',
binaryRelativePath: 'headless_shell-windows\\headless_shell.exe',
archiveFilename: 'chromium-ef768c9-windows_x64.zip',
archiveChecksum: '33301c749b5305b65311742578c52f15',
binaryChecksum: '9f28dd56c7a304a22bf66f0097fa4de9',
binaryRelativePath: 'headless_shell-windows_x64\\headless_shell.exe',
},
],
};
13 changes: 0 additions & 13 deletions x-pack/plugins/reporting/server/browsers/chromium/puppeteer.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

jest.mock('../../browsers/chromium/puppeteer', () => ({
puppeteerLaunch: () => ({
jest.mock('puppeteer', () => ({
launch: () => ({
// Fixme needs event emitters
newPage: () => ({
setDefaultTimeout: jest.fn(),
Expand Down
101 changes: 72 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5493,10 +5493,10 @@
resolved "https://registry.yarnpkg.com/@types/proper-lockfile/-/proper-lockfile-3.0.1.tgz#dd770a2abce3adbcce3bd1ed892ce2f5f17fbc86"
integrity sha512-ODOjqxmaNs0Zkij+BJovsNJRSX7BJrr681o8ZnNTNIcTermvVFzLpz/XFtfg3vNrlPVTJY1l4e9h2LvHoxC1lg==

"@types/puppeteer@^1.20.1":
version "1.20.1"
resolved "https://registry.yarnpkg.com/@types/puppeteer/-/puppeteer-1.20.1.tgz#0aba5ae3d290daa91cd3ba9f66ba5e9fba3499cc"
integrity sha512-F91CqYDHETg3pQfIPNBNZKmi7R1xS1y4yycOYX7o6Xk16KF+IV+9LqTmVuG+FIxw/53/JEy94zKjjGjg92V6bg==
"@types/puppeteer@^5.4.1":
version "5.4.1"
resolved "https://registry.yarnpkg.com/@types/puppeteer/-/puppeteer-5.4.1.tgz#8d0075ad7705e8061b06df6a9a3abc6ca5fb7cd9"
integrity sha512-mEytIRrqvsFgs16rHOa5jcZcoycO/NSjg1oLQkFUegj3HOHeAP1EUfRi+eIsJdGrx2oOtfN39ckibkRXzs+qXA==
dependencies:
"@types/node" "*"

Expand Down Expand Up @@ -6521,7 +6521,7 @@ after-all-results@^2.0.0:
resolved "https://registry.yarnpkg.com/after-all-results/-/after-all-results-2.0.0.tgz#6ac2fc202b500f88da8f4f5530cfa100f4c6a2d0"
integrity sha1-asL8ICtQD4jaj09VMM+hAPTGotA=

agent-base@4, agent-base@^4.3.0:
agent-base@4:
version "4.3.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==
Expand Down Expand Up @@ -8322,7 +8322,7 @@ bindings@^1.5.0:
dependencies:
file-uri-to-path "1.0.0"

bl@^4.0.1:
bl@^4.0.1, bl@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/bl/-/bl-4.0.3.tgz#12d6287adc29080e22a705e5764b2a9522cdc489"
integrity sha512-fs4G6/Hu4/EE+F75J8DuN/0IpQqNjAdC7aEQv7Qt8MHGUH7Ckv2MwTEEeN9QehD0pfIDkMI1bkHYkKy7xHyKIg==
Expand Down Expand Up @@ -8838,6 +8838,14 @@ buffer@^5.0.2, buffer@^5.1.0, buffer@^5.2.0, buffer@^5.5.0:
base64-js "^1.0.2"
ieee754 "^1.1.4"

buffer@^5.2.1:
version "5.7.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.1.13"

buffer@~5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.1.tgz#dd57fa0f109ac59c602479044dca7b8b3d0b71d6"
Expand Down Expand Up @@ -11750,6 +11758,11 @@ detective@^5.0.2, detective@^5.2.0:
defined "^1.0.0"
minimist "^1.1.1"

[email protected]:
version "0.0.818844"
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.818844.tgz#d1947278ec85b53e4c8ca598f607a28fa785ba9e"
integrity sha512-AD1hi7iVJ8OD0aMLQU5VK0XH9LDlA1+BcPIgrAxPfaibx2DbWucuyOhc4oyQCbnvDDO68nN6/LcKfqTP343Jjg==

dezalgo@^1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456"
Expand Down Expand Up @@ -16140,14 +16153,6 @@ [email protected], https-proxy-agent@^5.0.0:
agent-base "6"
debug "4"

https-proxy-agent@^2.2.1:
version "2.2.4"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b"
integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==
dependencies:
agent-base "^4.3.0"
debug "^3.1.0"

https-proxy-agent@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz#702b71fb5520a132a66de1f67541d9e62154d82b"
Expand Down Expand Up @@ -16240,6 +16245,11 @@ ieee754@^1.1.12, ieee754@^1.1.4:
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84"
integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==

ieee754@^1.1.13:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==

if-async@^3.7.4:
version "3.7.4"
resolved "https://registry.yarnpkg.com/if-async/-/if-async-3.7.4.tgz#55868deb0093d3c67bf7166e745353fb9bcb21a2"
Expand Down Expand Up @@ -22937,21 +22947,7 @@ pupa@^2.0.1:
dependencies:
escape-goat "^2.0.0"

puppeteer-core@^1.19.0:
version "1.19.0"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-1.19.0.tgz#3c3f98edb5862583e3a9c19cbc0da57ccc63ba5c"
integrity sha512-ZPbbjUymorIJomHBvdZX5+2gciUmQtAdepCrkweHH6rMJr96xd/dXzHgmYEOBMatH44SmJrcMtWkgsLHJqT89g==
dependencies:
debug "^4.1.0"
extract-zip "^1.6.6"
https-proxy-agent "^2.2.1"
mime "^2.0.3"
progress "^2.0.1"
proxy-from-env "^1.0.0"
rimraf "^2.6.1"
ws "^6.1.0"

puppeteer@^2.0.0, puppeteer@^2.1.1:
puppeteer@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-2.1.1.tgz#ccde47c2a688f131883b50f2d697bd25189da27e"
integrity sha512-LWzaDVQkk1EPiuYeTOj+CZRIjda4k2s5w4MK4xoH2+kgWV/SDlkYHmxatDdtYrciHUKSXTsGgPgPP8ILVdBsxg==
Expand All @@ -22967,6 +22963,24 @@ puppeteer@^2.0.0, puppeteer@^2.1.1:
rimraf "^2.6.1"
ws "^6.1.0"

puppeteer@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-5.5.0.tgz#331a7edd212ca06b4a556156435f58cbae08af00"
integrity sha512-OM8ZvTXAhfgFA7wBIIGlPQzvyEETzDjeRa4mZRCRHxYL+GNH5WAuYUQdja3rpWZvkX/JKqmuVgbsxDNsDFjMEg==
dependencies:
debug "^4.1.0"
devtools-protocol "0.0.818844"
extract-zip "^2.0.0"
https-proxy-agent "^4.0.0"
node-fetch "^2.6.1"
pkg-dir "^4.2.0"
progress "^2.0.1"
proxy-from-env "^1.0.0"
rimraf "^3.0.2"
tar-fs "^2.0.0"
unbzip2-stream "^1.3.3"
ws "^7.2.3"

q@^1.1.2:
version "1.5.1"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
Expand Down Expand Up @@ -26969,6 +26983,16 @@ tape@^5.0.1:
string.prototype.trim "^1.2.1"
through "^2.3.8"

tar-fs@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784"
integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==
dependencies:
chownr "^1.1.1"
mkdirp-classic "^0.5.2"
pump "^3.0.0"
tar-stream "^2.1.4"

tar-fs@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.0.tgz#d1cdd121ab465ee0eb9ccde2d35049d3f3daf0d5"
Expand All @@ -26990,6 +27014,17 @@ tar-stream@^2.0.0, tar-stream@^2.1.0:
inherits "^2.0.3"
readable-stream "^3.1.1"

tar-stream@^2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.1.4.tgz#c4fb1a11eb0da29b893a5b25476397ba2d053bfa"
integrity sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==
dependencies:
bl "^4.0.3"
end-of-stream "^1.4.1"
fs-constants "^1.0.0"
inherits "^2.0.3"
readable-stream "^3.1.1"

[email protected]:
version "4.4.13"
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
Expand Down Expand Up @@ -27906,6 +27941,14 @@ umd@^3.0.0:
resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.3.tgz#aa9fe653c42b9097678489c01000acb69f0b26cf"
integrity sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==

unbzip2-stream@^1.3.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz#b0da04c4371311df771cdc215e87f2130991ace7"
integrity sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==
dependencies:
buffer "^5.2.1"
through "^2.3.8"

unc-path-regex@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa"
Expand Down