creevey 0.9.0-beta.12 → 0.9.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +1 -0
- package/lib/cjs/cli.js +1 -0
- package/lib/cjs/client/addon/Manager.js +151 -223
- package/lib/cjs/client/addon/components/Addon.js +2 -9
- package/lib/cjs/client/addon/components/Icons.js +1 -7
- package/lib/cjs/client/addon/components/Panel.js +5 -18
- package/lib/cjs/client/addon/components/TestSelect.js +12 -25
- package/lib/cjs/client/addon/components/Tools.js +17 -28
- package/lib/cjs/client/addon/decorator.js +1 -4
- package/lib/cjs/client/addon/index.js +0 -4
- package/lib/cjs/client/addon/preset.js +3 -12
- package/lib/cjs/client/addon/preview.js +1 -4
- package/lib/cjs/client/addon/readyForCapture.js +1 -4
- package/lib/cjs/client/addon/register.js +11 -26
- package/lib/cjs/client/addon/utils.js +1 -9
- package/lib/cjs/client/addon/withCreevey.js +55 -134
- package/lib/cjs/client/shared/components/ImagesView/BlendView.js +5 -17
- package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +8 -24
- package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +7 -23
- package/lib/cjs/client/shared/components/ImagesView/SlideView.js +7 -22
- package/lib/cjs/client/shared/components/ImagesView/SwapView.js +5 -17
- package/lib/cjs/client/shared/components/ImagesView/index.js +0 -5
- package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +1 -8
- package/lib/cjs/client/shared/components/PageFooter/Paging.js +2 -19
- package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +21 -17
- package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +5 -24
- package/lib/cjs/client/shared/components/ResultsPage.js +9 -37
- package/lib/cjs/client/shared/creeveyClientApi.js +3 -13
- package/lib/cjs/client/shared/helpers.js +21 -75
- package/lib/cjs/client/shared/viewMode.js +2 -6
- package/lib/cjs/client/web/192.js +1 -0
- package/lib/cjs/client/web/632.js +43 -0
- package/lib/cjs/client/web/794.js +1 -0
- package/lib/cjs/client/web/main.js +78 -1
- package/lib/cjs/client/web/main.js.LICENSE.txt +0 -15
- package/lib/cjs/creevey.js +5 -21
- package/lib/cjs/index.js +0 -15
- package/lib/cjs/server/config.js +13 -33
- package/lib/cjs/server/docker.js +5 -27
- package/lib/cjs/server/index.js +8 -33
- package/lib/cjs/server/logger.js +5 -19
- package/lib/cjs/server/master/api.js +1 -14
- package/lib/cjs/server/master/index.js +15 -46
- package/lib/cjs/server/master/master.js +6 -21
- package/lib/cjs/server/master/pool.js +2 -37
- package/lib/cjs/server/master/runner.js +15 -42
- package/lib/cjs/server/master/server.js +5 -27
- package/lib/cjs/server/messages.js +7 -53
- package/lib/cjs/server/selenium/browser.js +47 -128
- package/lib/cjs/server/selenium/index.js +0 -4
- package/lib/cjs/server/selenium/selenoid.js +7 -33
- package/lib/cjs/server/stories.js +25 -30
- package/lib/cjs/server/storybook/providers/browser.js +5 -18
- package/lib/cjs/server/storybook/providers/hybrid.js +9 -29
- package/lib/cjs/server/testsFiles/parser.js +3 -19
- package/lib/cjs/server/testsFiles/register.js +7 -9
- package/lib/cjs/server/update.js +3 -20
- package/lib/cjs/server/utils.js +9 -41
- package/lib/cjs/server/worker/chai-image.js +1 -27
- package/lib/cjs/server/worker/helpers.js +2 -12
- package/lib/cjs/server/worker/index.js +1 -3
- package/lib/cjs/server/worker/reporter.js +8 -24
- package/lib/cjs/server/worker/worker.js +5 -49
- package/lib/cjs/shared/index.js +22 -36
- package/lib/cjs/shared/serializeRegExp.js +0 -8
- package/lib/cjs/types.js +4 -14
- package/lib/esm/cli.js +1 -1
- package/lib/esm/client/addon/Manager.js +151 -214
- package/lib/esm/client/addon/components/Panel.js +4 -6
- package/lib/esm/client/addon/components/TestSelect.js +11 -17
- package/lib/esm/client/addon/components/Tools.js +15 -14
- package/lib/esm/client/addon/preset.js +2 -8
- package/lib/esm/client/addon/readyForCapture.js +1 -3
- package/lib/esm/client/addon/register.js +6 -8
- package/lib/esm/client/addon/utils.js +0 -5
- package/lib/esm/client/addon/withCreevey.js +54 -116
- package/lib/esm/client/shared/components/ImagesView/BlendView.js +1 -1
- package/lib/esm/client/shared/components/ImagesView/ImagesView.js +6 -8
- package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +3 -4
- package/lib/esm/client/shared/components/ImagesView/SlideView.js +3 -3
- package/lib/esm/client/shared/components/ImagesView/SwapView.js +1 -1
- package/lib/esm/client/shared/components/PageFooter/Paging.js +1 -11
- package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +18 -7
- package/lib/esm/client/shared/components/PageHeader/PageHeader.js +3 -8
- package/lib/esm/client/shared/components/ResultsPage.js +6 -15
- package/lib/esm/client/shared/creeveyClientApi.js +3 -10
- package/lib/esm/client/shared/helpers.js +21 -47
- package/lib/esm/client/web/192.js +1 -0
- package/lib/esm/client/web/632.js +43 -0
- package/lib/esm/client/web/794.js +1 -0
- package/lib/esm/client/web/index.html +19 -0
- package/lib/esm/client/web/main.js +79 -0
- package/lib/esm/client/web/main.js.LICENSE.txt +34 -0
- package/lib/esm/creevey.js +4 -8
- package/lib/esm/index.js +0 -1
- package/lib/esm/server/config.js +7 -14
- package/lib/esm/server/docker.js +4 -12
- package/lib/esm/server/index.js +7 -21
- package/lib/esm/server/logger.js +0 -1
- package/lib/esm/server/master/api.js +0 -9
- package/lib/esm/server/master/index.js +15 -32
- package/lib/esm/server/master/master.js +2 -7
- package/lib/esm/server/master/pool.js +0 -23
- package/lib/esm/server/master/runner.js +14 -27
- package/lib/esm/server/master/server.js +4 -9
- package/lib/esm/server/messages.js +6 -38
- package/lib/esm/server/selenium/browser.js +46 -106
- package/lib/esm/server/selenium/selenoid.js +6 -17
- package/lib/esm/server/stories.js +24 -20
- package/lib/esm/server/storybook/providers/browser.js +4 -8
- package/lib/esm/server/storybook/providers/hybrid.js +6 -14
- package/lib/esm/server/testsFiles/parser.js +0 -6
- package/lib/esm/server/testsFiles/register.js +5 -2
- package/lib/esm/server/update.js +0 -8
- package/lib/esm/server/utils.js +3 -11
- package/lib/esm/server/worker/chai-image.js +0 -21
- package/lib/esm/server/worker/helpers.js +2 -9
- package/lib/esm/server/worker/reporter.js +7 -10
- package/lib/esm/server/worker/worker.js +4 -25
- package/lib/esm/shared/index.js +24 -25
- package/lib/esm/types.js +4 -1
- package/lib/types/client/addon/Manager.d.ts +1 -1
- package/lib/types/client/addon/components/Addon.d.ts +1 -0
- package/lib/types/client/addon/components/Icons.d.ts +1 -0
- package/lib/types/client/addon/components/Panel.d.ts +1 -0
- package/lib/types/client/addon/components/TestSelect.d.ts +1 -0
- package/lib/types/client/addon/components/Tools.d.ts +1 -0
- package/lib/types/client/addon/decorator.d.ts +1 -1
- package/lib/types/client/addon/preset.d.ts +2 -2
- package/lib/types/client/addon/preview.d.ts +1 -1
- package/lib/types/client/addon/withCreevey.d.ts +3 -2
- package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +3 -1
- package/lib/types/client/shared/components/ImagesView/ImagesView.d.ts +1 -0
- package/lib/types/client/shared/components/ImagesView/SideBySideView.d.ts +3 -1
- package/lib/types/client/shared/components/ImagesView/SlideView.d.ts +3 -1
- package/lib/types/client/shared/components/ImagesView/SwapView.d.ts +3 -1
- package/lib/types/client/shared/components/PageFooter/PageFooter.d.ts +1 -0
- package/lib/types/client/shared/components/PageFooter/Paging.d.ts +1 -0
- package/lib/types/client/shared/components/PageHeader/ImagePreview.d.ts +3 -1
- package/lib/types/client/shared/components/PageHeader/PageHeader.d.ts +1 -0
- package/lib/types/client/shared/components/ResultsPage.d.ts +3 -1
- package/lib/types/client/web/CreeveyApp.d.ts +1 -0
- package/lib/types/client/web/CreeveyLoader.d.ts +2 -1
- package/lib/types/client/web/CreeveyView/SideBar/Checkbox.d.ts +4 -1
- package/lib/types/client/web/CreeveyView/SideBar/Search.d.ts +1 -0
- package/lib/types/client/web/CreeveyView/SideBar/SideBarHeader.d.ts +1 -0
- package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +19 -14
- package/lib/types/client/web/CreeveyView/SideBar/TestLink.d.ts +1 -0
- package/lib/types/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +3 -1
- package/lib/types/client/web/CreeveyView/SideBar/TestsStatus.d.ts +3 -1
- package/lib/types/client/web/CreeveyView/SideBar/Toggle.d.ts +1 -0
- package/lib/types/shared/index.d.ts +1 -1
- package/lib/types/types.d.ts +7 -28
- package/package.json +60 -78
- package/lib/cjs/client/addon/preset.ie11.js +0 -74
- package/lib/cjs/client/addon/preset.sb7.js +0 -19
- package/lib/cjs/client/web/142.js +0 -2
- package/lib/cjs/client/web/142.js.LICENSE.txt +0 -12
- package/lib/cjs/client/web/32.js +0 -1
- package/lib/cjs/client/web/551.js +0 -1
- package/lib/cjs/client/web/566.js +0 -2
- package/lib/cjs/client/web/566.js.LICENSE.txt +0 -31
- package/lib/cjs/client/web/691.js +0 -2
- package/lib/cjs/client/web/691.js.LICENSE.txt +0 -8
- package/lib/cjs/client/web/725.js +0 -1
- package/lib/cjs/server/extract.js +0 -46
- package/lib/cjs/server/loaders/babel/creevey-plugin.js +0 -86
- package/lib/cjs/server/loaders/babel/helpers.js +0 -469
- package/lib/cjs/server/loaders/babel/register.js +0 -124
- package/lib/cjs/server/loaders/hooks/mdx.js +0 -30
- package/lib/cjs/server/loaders/hooks/svelte.js +0 -65
- package/lib/cjs/server/loaders/webpack/compile.js +0 -269
- package/lib/cjs/server/loaders/webpack/creevey-loader.js +0 -172
- package/lib/cjs/server/loaders/webpack/dummy-hmr.js +0 -39
- package/lib/cjs/server/loaders/webpack/mdx-loader.js +0 -72
- package/lib/cjs/server/loaders/webpack/start.js +0 -41
- package/lib/cjs/server/storybook/entry.js +0 -53
- package/lib/cjs/server/storybook/helpers.js +0 -158
- package/lib/cjs/server/storybook/providers/nodejs.js +0 -239
- package/lib/esm/client/addon/preset.ie11.js +0 -59
- package/lib/esm/client/addon/preset.sb7.js +0 -8
- package/lib/esm/server/extract.js +0 -32
- package/lib/esm/server/loaders/babel/creevey-plugin.js +0 -72
- package/lib/esm/server/loaders/babel/helpers.js +0 -452
- package/lib/esm/server/loaders/babel/register.js +0 -103
- package/lib/esm/server/loaders/hooks/mdx.js +0 -15
- package/lib/esm/server/loaders/hooks/svelte.js +0 -49
- package/lib/esm/server/loaders/webpack/compile.js +0 -246
- package/lib/esm/server/loaders/webpack/creevey-loader.js +0 -152
- package/lib/esm/server/loaders/webpack/dummy-hmr.js +0 -32
- package/lib/esm/server/loaders/webpack/mdx-loader.js +0 -58
- package/lib/esm/server/loaders/webpack/start.js +0 -27
- package/lib/esm/server/storybook/entry.js +0 -27
- package/lib/esm/server/storybook/helpers.js +0 -97
- package/lib/esm/server/storybook/providers/nodejs.js +0 -216
- package/lib/types/client/addon/preset.ie11.d.ts +0 -10
- package/lib/types/client/addon/preset.sb7.d.ts +0 -2
- package/lib/types/server/extract.d.ts +0 -2
- package/lib/types/server/loaders/babel/creevey-plugin.d.ts +0 -1
- package/lib/types/server/loaders/babel/helpers.d.ts +0 -19
- package/lib/types/server/loaders/babel/register.d.ts +0 -5
- package/lib/types/server/loaders/hooks/mdx.d.ts +0 -1
- package/lib/types/server/loaders/hooks/svelte.d.ts +0 -1
- package/lib/types/server/loaders/webpack/compile.d.ts +0 -2
- package/lib/types/server/loaders/webpack/creevey-loader.d.ts +0 -4
- package/lib/types/server/loaders/webpack/dummy-hmr.d.ts +0 -10
- package/lib/types/server/loaders/webpack/mdx-loader.d.ts +0 -6
- package/lib/types/server/loaders/webpack/start.d.ts +0 -1
- package/lib/types/server/storybook/entry.d.ts +0 -17
- package/lib/types/server/storybook/helpers.d.ts +0 -24
- package/lib/types/server/storybook/providers/nodejs.d.ts +0 -9
- package/preset/ie11.js +0 -5
- package/preset/index.js +0 -9
- package/preset/sb7.js +0 -5
- package/types/mdx.d.ts +0 -7
@@ -1,3 +1,4 @@
|
|
1
|
+
import { SET_GLOBALS, UPDATE_STORY_ARGS, STORY_RENDERED } from '@storybook/core-events';
|
1
2
|
import chalk from 'chalk';
|
2
3
|
import http from 'http';
|
3
4
|
import https from 'https';
|
@@ -10,15 +11,13 @@ import { PageLoadStrategy } from 'selenium-webdriver/lib/capabilities';
|
|
10
11
|
import { isDefined, noop } from '../../types';
|
11
12
|
import { colors, logger } from '../logger';
|
12
13
|
import { emitStoriesMessage, subscribeOn } from '../messages';
|
13
|
-
import { importStorybookCoreEvents, isStorybookVersionLessThan } from '../storybook/helpers';
|
14
14
|
import { isShuttingDown, LOCALHOST_REGEXP, runSequence } from '../utils';
|
15
|
-
const storybookRootID =
|
15
|
+
const storybookRootID = 'storybook-root';
|
16
16
|
const DOCKER_INTERNAL = 'host.docker.internal';
|
17
17
|
let browserLogger = logger;
|
18
18
|
let browserName = '';
|
19
19
|
let browser = null;
|
20
20
|
let creeveyServerHost = null;
|
21
|
-
|
22
21
|
function getSessionData(grid, sessionId = '') {
|
23
22
|
const gridUrl = new URL(grid);
|
24
23
|
gridUrl.pathname = `/host/${sessionId}`;
|
@@ -26,7 +25,6 @@ function getSessionData(grid, sessionId = '') {
|
|
26
25
|
if (res.statusCode !== 200) {
|
27
26
|
return reject(new Error(`Couldn't get session data for ${sessionId}. Status code: ${res.statusCode ?? 'Unknown'}`));
|
28
27
|
}
|
29
|
-
|
30
28
|
let data = '';
|
31
29
|
res.setEncoding('utf8');
|
32
30
|
res.on('data', chunk => data += chunk);
|
@@ -39,44 +37,36 @@ function getSessionData(grid, sessionId = '') {
|
|
39
37
|
});
|
40
38
|
}));
|
41
39
|
}
|
42
|
-
|
43
40
|
function getAddresses() {
|
44
41
|
return [DOCKER_INTERNAL].concat(...Object.values(networkInterfaces()).filter(isDefined).map(network => network.filter(info => info.family == 'IPv4').map(info => info.address)));
|
45
42
|
}
|
46
|
-
|
47
43
|
async function resolveStorybookUrl(storybookUrl, checkUrl) {
|
48
44
|
browserLogger.debug('Resolving storybook url');
|
49
45
|
const addresses = getAddresses();
|
50
|
-
|
51
46
|
for (const ip of addresses) {
|
52
47
|
const resolvedUrl = storybookUrl.replace(LOCALHOST_REGEXP, ip);
|
53
48
|
browserLogger.debug(`Checking storybook availability on ${chalk.magenta(resolvedUrl)}`);
|
54
|
-
|
55
49
|
if (await checkUrl(resolvedUrl)) {
|
56
50
|
browserLogger.debug(`Resolved storybook url ${chalk.magenta(resolvedUrl)}`);
|
57
51
|
return resolvedUrl;
|
58
52
|
}
|
59
53
|
}
|
60
|
-
|
61
54
|
const error = new Error('Please specify `storybookUrl` with IP address that accessible from remote browser');
|
62
55
|
error.name = 'ResolveUrlError';
|
63
56
|
throw error;
|
64
57
|
}
|
65
|
-
|
66
58
|
async function openUrlAndWaitForPageSource(browser, url, predicate) {
|
67
59
|
let source = '';
|
68
60
|
await browser.get(url);
|
69
|
-
|
70
61
|
do {
|
71
62
|
try {
|
72
63
|
source = await browser.getPageSource();
|
73
|
-
} catch (_) {
|
64
|
+
} catch (_) {
|
65
|
+
// NOTE: Firefox can raise exception "curContainer.frame.document.documentElement is null"
|
74
66
|
}
|
75
67
|
} while (predicate(source));
|
76
|
-
|
77
68
|
return source;
|
78
69
|
}
|
79
|
-
|
80
70
|
function getUrlChecker(browser) {
|
81
71
|
return async url => {
|
82
72
|
try {
|
@@ -84,13 +74,14 @@ function getUrlChecker(browser) {
|
|
84
74
|
browserLogger.debug(`Opening ${chalk.magenta('about:blank')} page`);
|
85
75
|
await openUrlAndWaitForPageSource(browser, 'about:blank', source => !source.includes('<body></body>'));
|
86
76
|
browserLogger.debug(`Opening ${chalk.magenta(url)} and checking the page source`);
|
87
|
-
const source = await openUrlAndWaitForPageSource(browser, url,
|
88
|
-
|
77
|
+
const source = await openUrlAndWaitForPageSource(browser, url,
|
78
|
+
// NOTE: IE11 can return only `head` without body
|
79
|
+
source => source.length == 0 || !/<body([^>]*>).+<\/body>/s.test(source));
|
80
|
+
// NOTE: This is the most optimal way to check if we in storybook or not
|
89
81
|
// We don't use any page load strategies except `NONE`
|
90
82
|
// because other add significant delay and some of them don't work in earlier chrome versions
|
91
83
|
// Browsers always load page successful even it's failed
|
92
84
|
// So we just check `root` element
|
93
|
-
|
94
85
|
browserLogger.debug(`Checking ${chalk.cyan(`#${storybookRootID}`)} existence on ${chalk.magenta(url)}`);
|
95
86
|
return source.includes(`id="${storybookRootID}"`);
|
96
87
|
} catch (error) {
|
@@ -98,45 +89,35 @@ function getUrlChecker(browser) {
|
|
98
89
|
}
|
99
90
|
};
|
100
91
|
}
|
101
|
-
|
102
92
|
async function waitForStorybook(browser) {
|
103
93
|
browserLogger.debug('Waiting for `setStories` event to make sure that storybook is initiated');
|
104
94
|
let wait = true;
|
105
95
|
let isTimeout = false;
|
106
|
-
const Events = await importStorybookCoreEvents();
|
107
96
|
const initiateTimeout = setTimeout(() => {
|
108
97
|
wait = false;
|
109
98
|
isTimeout = true;
|
110
99
|
}, 60000);
|
111
|
-
|
112
100
|
while (wait !== false) {
|
113
|
-
|
114
|
-
wait = await browser.executeAsyncScript(function (SET_STORIES, callback) {
|
115
|
-
if (typeof window.__STORYBOOK_ADDONS_CHANNEL__ == 'undefined') return callback(true);
|
116
|
-
if (window.__STORYBOOK_ADDONS_CHANNEL__.last(SET_STORIES) == undefined) return callback(true);
|
117
|
-
return callback(false);
|
118
|
-
}, Events.SET_STORIES);
|
119
|
-
} else {
|
101
|
+
try {
|
120
102
|
wait = await browser.executeScript(function (SET_GLOBALS) {
|
121
103
|
if (typeof window.__STORYBOOK_ADDONS_CHANNEL__ == 'undefined') return true;
|
122
104
|
if (window.__STORYBOOK_ADDONS_CHANNEL__.last(SET_GLOBALS) == undefined) return true;
|
123
105
|
return false;
|
124
|
-
},
|
106
|
+
}, SET_GLOBALS);
|
107
|
+
} catch (e) {
|
108
|
+
browserLogger.debug('An error has been caught during the script: ', e);
|
125
109
|
}
|
126
|
-
|
127
110
|
if (!wait) clearTimeout(initiateTimeout);
|
128
111
|
}
|
129
|
-
|
130
112
|
if (isTimeout) throw new Error('Failed to wait `setStories` event');
|
131
113
|
}
|
132
|
-
|
133
114
|
async function resetMousePosition(browser) {
|
134
115
|
var _await$browser$getCap, _await$browser$getCap2;
|
135
|
-
|
136
116
|
browserLogger.debug('Resetting mouse position to the top-left corner');
|
137
117
|
const browserName = (await browser.getCapabilities()).getBrowserName();
|
138
|
-
const [browserVersion] = ((_await$browser$getCap = (await browser.getCapabilities()).getBrowserVersion()) === null || _await$browser$getCap === void 0 ? void 0 : _await$browser$getCap.split('.')) ?? ((_await$browser$getCap2 = (await browser.getCapabilities()).get('version')) === null || _await$browser$getCap2 === void 0 ? void 0 : _await$browser$getCap2.split('.')) ?? [];
|
118
|
+
const [browserVersion] = ((_await$browser$getCap = (await browser.getCapabilities()).getBrowserVersion()) === null || _await$browser$getCap === void 0 ? void 0 : _await$browser$getCap.split('.')) ?? ((_await$browser$getCap2 = (await browser.getCapabilities()).get('version')) === null || _await$browser$getCap2 === void 0 ? void 0 : _await$browser$getCap2.split('.')) ?? [];
|
139
119
|
|
120
|
+
// NOTE Reset mouse position to support keweb selenium grid browser versions
|
140
121
|
if (browserName == 'chrome' && browserVersion == '70') {
|
141
122
|
const {
|
142
123
|
top,
|
@@ -151,8 +132,8 @@ async function resetMousePosition(browser) {
|
|
151
132
|
width: bodyRect.width,
|
152
133
|
height: bodyRect.height
|
153
134
|
};
|
154
|
-
});
|
155
|
-
|
135
|
+
});
|
136
|
+
// NOTE Bridge mode doesn't support `Origin.VIEWPORT`, move mouse relative
|
156
137
|
await browser.actions({
|
157
138
|
bridge: true
|
158
139
|
}).move({
|
@@ -176,7 +157,6 @@ async function resetMousePosition(browser) {
|
|
176
157
|
}).perform();
|
177
158
|
}
|
178
159
|
}
|
179
|
-
|
180
160
|
async function resizeViewport(browser, viewport) {
|
181
161
|
const windowRect = await browser.manage().window().getRect();
|
182
162
|
const {
|
@@ -196,7 +176,6 @@ async function resizeViewport(browser, viewport) {
|
|
196
176
|
height: viewport.height + dHeight
|
197
177
|
});
|
198
178
|
}
|
199
|
-
|
200
179
|
const getScrollBarWidth = (() => {
|
201
180
|
let scrollBarWidth = null;
|
202
181
|
return async browser => {
|
@@ -205,33 +184,31 @@ const getScrollBarWidth = (() => {
|
|
205
184
|
// eslint-disable-next-line no-var
|
206
185
|
var div = document.createElement('div');
|
207
186
|
div.innerHTML = 'a'; // NOTE: In IE clientWidth is 0 if this div is empty.
|
208
|
-
|
209
187
|
div.style.overflowY = 'scroll';
|
210
|
-
document.body.appendChild(div);
|
211
|
-
|
188
|
+
document.body.appendChild(div);
|
189
|
+
// eslint-disable-next-line no-var
|
212
190
|
var widthDiff = div.offsetWidth - div.clientWidth;
|
213
191
|
document.body.removeChild(div);
|
214
192
|
return widthDiff;
|
215
193
|
});
|
216
194
|
return scrollBarWidth;
|
217
195
|
};
|
218
|
-
})();
|
219
|
-
|
196
|
+
})();
|
220
197
|
|
198
|
+
// NOTE Firefox and Safari take viewport screenshot without scrollbars
|
221
199
|
async function hasScrollBar(browser) {
|
222
200
|
var _await$browser$getCap3;
|
223
|
-
|
224
201
|
const browserName = (await browser.getCapabilities()).getBrowserName();
|
225
202
|
const [browserVersion] = ((_await$browser$getCap3 = (await browser.getCapabilities()).getBrowserVersion()) === null || _await$browser$getCap3 === void 0 ? void 0 : _await$browser$getCap3.split('.')) ?? [];
|
226
|
-
return browserName != 'Safari' &&
|
203
|
+
return browserName != 'Safari' &&
|
204
|
+
// NOTE This need to work with keweb selenium grid
|
227
205
|
!(browserName == 'firefox' && browserVersion == '61');
|
228
206
|
}
|
229
|
-
|
230
207
|
async function takeCompositeScreenshot(browser, windowRect, elementRect) {
|
231
208
|
const screens = [];
|
232
209
|
const isScreenshotWithoutScrollBar = !(await hasScrollBar(browser));
|
233
|
-
const scrollBarWidth = await getScrollBarWidth(browser);
|
234
|
-
|
210
|
+
const scrollBarWidth = await getScrollBarWidth(browser);
|
211
|
+
// NOTE Sometimes viewport has been scrolled somewhere
|
235
212
|
const normalizedElementRect = {
|
236
213
|
left: elementRect.left - windowRect.left,
|
237
214
|
right: elementRect.left + elementRect.width - windowRect.left,
|
@@ -246,7 +223,6 @@ async function takeCompositeScreenshot(browser, windowRect, elementRect) {
|
|
246
223
|
const rows = Math.ceil(elementRect.height / viewportHeight);
|
247
224
|
const xOffset = Math.round(isFitHorizontally ? normalizedElementRect.left : Math.max(0, cols * viewportWidth - elementRect.width));
|
248
225
|
const yOffset = Math.round(isFitVertically ? normalizedElementRect.top : Math.max(0, rows * viewportHeight - elementRect.height));
|
249
|
-
|
250
226
|
for (let row = 0; row < rows; row += 1) {
|
251
227
|
for (let col = 0; col < cols; col += 1) {
|
252
228
|
const dx = Math.min(viewportWidth * col + normalizedElementRect.left, Math.max(0, normalizedElementRect.right - viewportWidth));
|
@@ -257,13 +233,11 @@ async function takeCompositeScreenshot(browser, windowRect, elementRect) {
|
|
257
233
|
screens.push(await browser.takeScreenshot());
|
258
234
|
}
|
259
235
|
}
|
260
|
-
|
261
236
|
const images = screens.map(s => Buffer.from(s, 'base64')).map(b => PNG.sync.read(b));
|
262
237
|
const compositeImage = new PNG({
|
263
238
|
width: Math.round(elementRect.width),
|
264
239
|
height: Math.round(elementRect.height)
|
265
240
|
});
|
266
|
-
|
267
241
|
for (let y = 0; y < compositeImage.height; y += 1) {
|
268
242
|
for (let x = 0; x < compositeImage.width; x += 1) {
|
269
243
|
const col = Math.floor(x / viewportWidth);
|
@@ -272,8 +246,10 @@ async function takeCompositeScreenshot(browser, windowRect, elementRect) {
|
|
272
246
|
const isLastRow = rows - row == 1;
|
273
247
|
const scrollOffset = isFitVertically || isScreenshotWithoutScrollBar ? 0 : scrollBarWidth;
|
274
248
|
const i = (y * compositeImage.width + x) * 4;
|
275
|
-
const j =
|
276
|
-
|
249
|
+
const j =
|
250
|
+
// NOTE compositeImage(x, y) => image(x, y)
|
251
|
+
(y % viewportHeight * (viewportWidth + scrollOffset) + x % viewportWidth) * 4 + (
|
252
|
+
// NOTE Offset for last row/col image
|
277
253
|
isLastRow ? yOffset * (viewportWidth + scrollOffset) * 4 : 0) + (isLastCol ? xOffset * 4 : 0);
|
278
254
|
const image = images[row * cols + col];
|
279
255
|
compositeImage.data[i + 0] = image.data[j + 0];
|
@@ -282,14 +258,11 @@ async function takeCompositeScreenshot(browser, windowRect, elementRect) {
|
|
282
258
|
compositeImage.data[i + 3] = image.data[j + 3];
|
283
259
|
}
|
284
260
|
}
|
285
|
-
|
286
261
|
return PNG.sync.write(compositeImage).toString('base64');
|
287
262
|
}
|
288
|
-
|
289
263
|
export async function takeScreenshot(browser, captureElement, ignoreElements) {
|
290
264
|
let screenshot;
|
291
265
|
const ignoreStyles = await insertIgnoreStyles(browser, ignoreElements);
|
292
|
-
|
293
266
|
try {
|
294
267
|
if (!captureElement) {
|
295
268
|
browserLogger.debug('Capturing viewport screenshot');
|
@@ -300,10 +273,10 @@ export async function takeScreenshot(browser, captureElement, ignoreElements) {
|
|
300
273
|
const rects = await browser.executeScript(function (selector) {
|
301
274
|
window.scrollTo(0, 0); // TODO Maybe we should remove same code from `resetMousePosition`
|
302
275
|
// eslint-disable-next-line no-var
|
303
|
-
|
304
276
|
var element = document.querySelector(selector);
|
305
|
-
if (!element) return;
|
277
|
+
if (!element) return;
|
306
278
|
|
279
|
+
// eslint-disable-next-line no-var
|
307
280
|
var elementRect = element.getBoundingClientRect();
|
308
281
|
return {
|
309
282
|
elementRect: {
|
@@ -327,17 +300,16 @@ export async function takeScreenshot(browser, captureElement, ignoreElements) {
|
|
327
300
|
if (!elementRect || !windowRect) throw new Error(`Couldn't find element with selector: '${captureElement}'`);
|
328
301
|
const isFitIntoViewport = elementRect.width + elementRect.left <= windowRect.width && elementRect.height + elementRect.top <= windowRect.height;
|
329
302
|
if (isFitIntoViewport) browserLogger.debug(`Capturing ${chalk.cyan(captureElement)}`);else browserLogger.debug(`Capturing composite screenshot image of ${chalk.cyan(captureElement)}`);
|
330
|
-
screenshot = isFitIntoViewport ? await browser.findElement(By.css(captureElement)).takeScreenshot() :
|
303
|
+
screenshot = isFitIntoViewport ? await browser.findElement(By.css(captureElement)).takeScreenshot() :
|
304
|
+
// TODO pointer-events: none, need to research
|
331
305
|
await takeCompositeScreenshot(browser, windowRect, elementRect);
|
332
306
|
browserLogger.debug(`${chalk.cyan(captureElement)} is captured`);
|
333
307
|
}
|
334
308
|
} finally {
|
335
309
|
await removeIgnoreStyles(browser, ignoreStyles);
|
336
310
|
}
|
337
|
-
|
338
311
|
return screenshot;
|
339
312
|
}
|
340
|
-
|
341
313
|
async function selectStory(browser, {
|
342
314
|
id,
|
343
315
|
kind,
|
@@ -348,52 +320,46 @@ async function selectStory(browser, {
|
|
348
320
|
if (typeof window.__CREEVEY_SELECT_STORY__ == 'undefined') {
|
349
321
|
return callback(["Creevey can't switch story. This may happened if forget to add `creevey` addon to your storybook config, or storybook not loaded in browser due syntax error."]);
|
350
322
|
}
|
351
|
-
|
352
323
|
void window.__CREEVEY_SELECT_STORY__(id, kind, name, shouldWaitForReady, callback);
|
353
324
|
}, id, kind, name, waitForReady);
|
354
325
|
const [errorMessage, isCaptureCalled = false] = result ?? [];
|
355
326
|
if (errorMessage) throw new Error(errorMessage);
|
356
327
|
return isCaptureCalled;
|
357
328
|
}
|
358
|
-
|
359
329
|
export async function updateStorybookGlobals(browser, globals) {
|
360
330
|
browserLogger.debug('Applying storybook globals');
|
361
331
|
await browser.executeScript(function (globals) {
|
362
332
|
window.__CREEVEY_UPDATE_GLOBALS__(globals);
|
363
333
|
}, globals);
|
364
334
|
}
|
365
|
-
|
366
335
|
function appendIframePath(url) {
|
367
336
|
return `${url.replace(/\/$/, '')}/iframe.html`;
|
368
337
|
}
|
369
|
-
|
370
338
|
async function openStorybookPage(browser, storybookUrl, resolver) {
|
371
339
|
if (!LOCALHOST_REGEXP.test(storybookUrl)) {
|
372
340
|
return browser === null || browser === void 0 ? void 0 : browser.get(appendIframePath(storybookUrl));
|
373
341
|
}
|
374
|
-
|
375
342
|
try {
|
376
343
|
if (resolver) {
|
377
344
|
browserLogger.debug('Resolving storybook url with custom resolver');
|
378
345
|
const resolvedUrl = await resolver();
|
379
346
|
browserLogger.debug(`Resolver storybook url ${resolvedUrl}`);
|
380
347
|
return browser.get(appendIframePath(resolvedUrl));
|
381
|
-
}
|
382
|
-
|
383
|
-
|
348
|
+
}
|
349
|
+
// NOTE: getUrlChecker already calls `browser.get` so we don't need another one
|
384
350
|
return void (await resolveStorybookUrl(appendIframePath(storybookUrl), getUrlChecker(browser)));
|
385
351
|
} catch (error) {
|
386
352
|
browserLogger.error('Failed to resolve storybook URL', error instanceof Error ? error.message : '');
|
387
353
|
throw error;
|
388
354
|
}
|
389
355
|
}
|
390
|
-
|
391
356
|
async function resolveCreeveyHost(browser, port) {
|
392
357
|
if (creeveyServerHost != null) return creeveyServerHost;
|
393
358
|
const addresses = getAddresses();
|
394
359
|
creeveyServerHost = await browser.executeAsyncScript(function (hosts, port, callback) {
|
395
360
|
void Promise.all(hosts.map(function (host) {
|
396
|
-
return Promise.race([
|
361
|
+
return Promise.race([
|
362
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
397
363
|
fetch('http://' + host + ':' + port + '/ping').then(function (response) {
|
398
364
|
return response.text();
|
399
365
|
}), new Promise((_resolve, reject) => {
|
@@ -412,7 +378,6 @@ async function resolveCreeveyHost(browser, port) {
|
|
412
378
|
if (creeveyServerHost == null) throw new Error("Can't reach creevey server from a browser");
|
413
379
|
return creeveyServerHost;
|
414
380
|
}
|
415
|
-
|
416
381
|
export async function loadStoriesFromBrowser() {
|
417
382
|
if (!browser) throw new Error("Can't get stories from browser if webdriver isn't connected");
|
418
383
|
const stories = await browser.executeAsyncScript(function (callback) {
|
@@ -434,22 +399,22 @@ export async function getBrowser(config, options) {
|
|
434
399
|
...userCapabilities
|
435
400
|
} = browserConfig;
|
436
401
|
void limit;
|
437
|
-
const realAddress = address;
|
402
|
+
const realAddress = address;
|
438
403
|
|
439
|
-
|
404
|
+
// TODO Define some capabilities explicitly and define typings
|
405
|
+
const capabilities = new Capabilities({
|
406
|
+
...userCapabilities,
|
440
407
|
pageLoadStrategy: PageLoadStrategy.NONE
|
441
408
|
});
|
442
409
|
subscribeOn('shutdown', () => {
|
443
410
|
var _browser;
|
444
|
-
|
445
|
-
|
411
|
+
(_browser = browser) === null || _browser === void 0 || _browser.quit().finally(() =>
|
412
|
+
// eslint-disable-next-line no-process-exit
|
446
413
|
process.exit());
|
447
414
|
browser = null;
|
448
415
|
});
|
449
|
-
|
450
416
|
try {
|
451
417
|
var _await$browser$getSes;
|
452
|
-
|
453
418
|
const url = new URL(gridUrl);
|
454
419
|
url.username = url.username ? '********' : '';
|
455
420
|
url.password = url.password ? '********' : '';
|
@@ -457,7 +422,6 @@ export async function getBrowser(config, options) {
|
|
457
422
|
browser = await new Builder().usingServer(gridUrl).withCapabilities(capabilities).build();
|
458
423
|
const sessionId = (_await$browser$getSes = await browser.getSession()) === null || _await$browser$getSes === void 0 ? void 0 : _await$browser$getSes.getId();
|
459
424
|
let browserHost = '';
|
460
|
-
|
461
425
|
try {
|
462
426
|
const {
|
463
427
|
Name
|
@@ -466,7 +430,6 @@ export async function getBrowser(config, options) {
|
|
466
430
|
} catch (_) {
|
467
431
|
/* noop */
|
468
432
|
}
|
469
|
-
|
470
433
|
browserLogger.debug(`(${browserName}) Connected successful with ${[chalk.green(browserHost), chalk.magenta(sessionId)].filter(Boolean).join(':')}`);
|
471
434
|
browserLogger = getLogger(sessionId);
|
472
435
|
prefix.apply(browserLogger, {
|
@@ -474,11 +437,9 @@ export async function getBrowser(config, options) {
|
|
474
437
|
const levelColor = colors[level.toUpperCase()];
|
475
438
|
return `[${browserName}:${chalk.gray(sessionId)}] ${levelColor(level)} =>`;
|
476
439
|
}
|
477
|
-
|
478
440
|
});
|
479
441
|
await runSequence([() => {
|
480
442
|
var _browser2;
|
481
|
-
|
482
443
|
return (_browser2 = browser) === null || _browser2 === void 0 ? void 0 : _browser2.manage().setTimeouts({
|
483
444
|
pageLoad: 5000,
|
484
445
|
script: 60000
|
@@ -486,25 +447,20 @@ export async function getBrowser(config, options) {
|
|
486
447
|
}, () => viewport && browser && resizeViewport(browser, viewport), () => browser && openStorybookPage(browser, realAddress, config.resolveStorybookUrl), () => browser && waitForStorybook(browser)], () => !isShuttingDown.current);
|
487
448
|
} catch (originalError) {
|
488
449
|
var _browser4;
|
489
|
-
|
490
450
|
if (isShuttingDown.current) {
|
491
451
|
var _browser3;
|
492
|
-
|
493
|
-
(_browser3 = browser) === null || _browser3 === void 0 ? void 0 : _browser3.quit().catch(noop);
|
452
|
+
(_browser3 = browser) === null || _browser3 === void 0 || _browser3.quit().catch(noop);
|
494
453
|
browser = null;
|
495
454
|
return null;
|
496
455
|
}
|
497
|
-
|
498
456
|
if (originalError instanceof Error && originalError.name == 'ResolveUrlError') throw originalError;
|
499
457
|
const error = new Error(`Can't load storybook root page by URL ${(await ((_browser4 = browser) === null || _browser4 === void 0 ? void 0 : _browser4.getCurrentUrl())) ?? realAddress}`);
|
500
458
|
if (originalError instanceof Error) error.stack = originalError.stack;
|
501
459
|
throw error;
|
502
460
|
}
|
503
|
-
|
504
461
|
if (_storybookGlobals) {
|
505
462
|
await updateStorybookGlobals(browser, _storybookGlobals);
|
506
463
|
}
|
507
|
-
|
508
464
|
const creeveyHost = await resolveCreeveyHost(browser, options.port);
|
509
465
|
await browser.executeScript(function (workerId, creeveyHost, creeveyPort) {
|
510
466
|
window.__CREEVEY_WORKER_ID__ = workerId;
|
@@ -513,22 +469,17 @@ export async function getBrowser(config, options) {
|
|
513
469
|
}, process.pid, creeveyHost, options.port);
|
514
470
|
return browser;
|
515
471
|
}
|
516
|
-
|
517
472
|
async function updateStoryArgs(browser, story, updatedArgs) {
|
518
|
-
const Events = await importStorybookCoreEvents();
|
519
473
|
await browser.executeAsyncScript(function (storyId, updatedArgs, UPDATE_STORY_ARGS, STORY_RENDERED, callback) {
|
520
474
|
window.__STORYBOOK_ADDONS_CHANNEL__.once(STORY_RENDERED, callback);
|
521
|
-
|
522
475
|
window.__STORYBOOK_ADDONS_CHANNEL__.emit(UPDATE_STORY_ARGS, {
|
523
476
|
storyId,
|
524
477
|
updatedArgs
|
525
478
|
});
|
526
|
-
}, story.id, updatedArgs,
|
479
|
+
}, story.id, updatedArgs, UPDATE_STORY_ARGS, STORY_RENDERED);
|
527
480
|
}
|
528
|
-
|
529
481
|
export async function closeBrowser() {
|
530
482
|
if (!browser) return;
|
531
|
-
|
532
483
|
try {
|
533
484
|
await browser.quit();
|
534
485
|
} finally {
|
@@ -536,22 +487,18 @@ export async function closeBrowser() {
|
|
536
487
|
}
|
537
488
|
}
|
538
489
|
export async function switchStory() {
|
539
|
-
var _this$currentTest
|
540
|
-
|
490
|
+
var _this$currentTest;
|
541
491
|
let testOrSuite = this.currentTest;
|
542
492
|
if (!testOrSuite) throw new Error("Can't switch story, because test context doesn't have 'currentTest' field");
|
543
493
|
this.testScope.length = 0;
|
544
494
|
this.screenshots.length = 0;
|
545
495
|
this.testScope.push(this.browserName);
|
546
|
-
|
547
496
|
while ((_testOrSuite = testOrSuite) !== null && _testOrSuite !== void 0 && _testOrSuite.title) {
|
548
497
|
var _testOrSuite;
|
549
|
-
|
550
498
|
this.testScope.push(testOrSuite.title);
|
551
499
|
testOrSuite = testOrSuite.parent;
|
552
500
|
}
|
553
|
-
|
554
|
-
const story = (_this$currentTest = this.currentTest) === null || _this$currentTest === void 0 ? void 0 : (_this$currentTest$ctx = _this$currentTest.ctx) === null || _this$currentTest$ctx === void 0 ? void 0 : _this$currentTest$ctx.story;
|
501
|
+
const story = (_this$currentTest = this.currentTest) === null || _this$currentTest === void 0 || (_this$currentTest = _this$currentTest.ctx) === null || _this$currentTest === void 0 ? void 0 : _this$currentTest.story;
|
555
502
|
if (!story) throw new Error(`Current test '${this.testScope.join('/')}' context doesn't have 'story' field`);
|
556
503
|
const {
|
557
504
|
id,
|
@@ -570,11 +517,8 @@ export async function switchStory() {
|
|
570
517
|
configurable: true,
|
571
518
|
get: () => this.browser.findElement(By.css(captureElement))
|
572
519
|
});else Reflect.deleteProperty(this, 'captureElement');
|
573
|
-
|
574
520
|
this.takeScreenshot = () => takeScreenshot(this.browser, captureElement, ignoreElements);
|
575
|
-
|
576
521
|
this.updateStoryArgs = updatedArgs => updateStoryArgs(this.browser, story, updatedArgs);
|
577
|
-
|
578
522
|
this.testScope.reverse();
|
579
523
|
let storyPlayResolver;
|
580
524
|
let waitForComplete = new Promise(resolve => storyPlayResolver = resolve);
|
@@ -605,17 +549,14 @@ export async function switchStory() {
|
|
605
549
|
kind,
|
606
550
|
name
|
607
551
|
}, waitForReady);
|
608
|
-
|
609
552
|
if (isCaptureCalled) {
|
610
553
|
while (!(await waitForComplete)) {
|
611
554
|
waitForComplete = new Promise(resolve => storyPlayResolver = resolve);
|
612
555
|
}
|
613
556
|
}
|
614
|
-
|
615
557
|
unsubscribe();
|
616
558
|
browserLogger.debug(`Story ${chalk.magenta(id)} ready for capturing`);
|
617
559
|
}
|
618
|
-
|
619
560
|
async function insertIgnoreStyles(browser, ignoreElements) {
|
620
561
|
const ignoreSelectors = Array.prototype.concat(ignoreElements).filter(Boolean);
|
621
562
|
if (!ignoreSelectors.length) return null;
|
@@ -624,7 +565,6 @@ async function insertIgnoreStyles(browser, ignoreElements) {
|
|
624
565
|
return window.__CREEVEY_INSERT_IGNORE_STYLES__(ignoreSelectors);
|
625
566
|
}, ignoreSelectors);
|
626
567
|
}
|
627
|
-
|
628
568
|
async function removeIgnoreStyles(browser, ignoreStyles) {
|
629
569
|
if (ignoreStyles) {
|
630
570
|
browserLogger.debug('Revert hiding ignored elements');
|
@@ -10,7 +10,6 @@ import { chmod, exec } from 'shelljs';
|
|
10
10
|
const mkdirAsync = promisify(mkdir);
|
11
11
|
const writeFileAsync = promisify(writeFile);
|
12
12
|
const copyFileAsync = promisify(copyFile);
|
13
|
-
|
14
13
|
async function createSelenoidConfig(browsers, {
|
15
14
|
useDocker
|
16
15
|
}) {
|
@@ -39,7 +38,6 @@ async function createSelenoidConfig(browsers, {
|
|
39
38
|
await writeFileAsync(path.join(selenoidConfigDir, 'browsers.json'), JSON.stringify(selenoidConfig));
|
40
39
|
return selenoidConfigDir;
|
41
40
|
}
|
42
|
-
|
43
41
|
async function downloadSelenoidBinary(destination) {
|
44
42
|
const platformNameMapping = {
|
45
43
|
darwin: 'selenoid_darwin_amd64',
|
@@ -61,14 +59,11 @@ async function downloadSelenoidBinary(destination) {
|
|
61
59
|
name
|
62
60
|
}) => platformNameMapping[process.platform] == name) ?? {};
|
63
61
|
if (existsSync(destination) && lstatSync(destination).size == binarySize) return;
|
64
|
-
|
65
62
|
if (!downloadUrl) {
|
66
63
|
throw new Error(`Couldn't get download url for selenoid binary. Please download it manually from "https://github.com/aerokube/selenoid/releases/latest" and define "selenoidPath" option in the Creevey config`);
|
67
64
|
}
|
68
|
-
|
69
65
|
return downloadBinary(downloadUrl, destination);
|
70
66
|
}
|
71
|
-
|
72
67
|
export async function startSelenoidStandalone(config, debug) {
|
73
68
|
config.gridUrl = 'http://localhost:4444/wd/hub';
|
74
69
|
if (cluster.isWorker) return;
|
@@ -77,32 +72,27 @@ export async function startSelenoidStandalone(config, debug) {
|
|
77
72
|
useDocker: false
|
78
73
|
});
|
79
74
|
const binaryPath = path.join(selenoidConfigDir, process.platform == 'win32' ? 'selenoid.exe' : 'selenoid');
|
80
|
-
|
81
75
|
if (config.selenoidPath) {
|
82
76
|
await copyFileAsync(path.resolve(config.selenoidPath), binaryPath);
|
83
77
|
} else {
|
84
78
|
await downloadSelenoidBinary(binaryPath);
|
85
|
-
}
|
86
|
-
|
79
|
+
}
|
87
80
|
|
81
|
+
// TODO Download browser webdrivers
|
88
82
|
try {
|
89
83
|
if (process.platform != 'win32') chmod('+x', binaryPath);
|
90
84
|
} catch (_) {
|
91
85
|
/* noop */
|
92
86
|
}
|
93
|
-
|
94
87
|
const selenoidProcess = exec(`${binaryPath} -conf ./browsers.json -disable-docker`, {
|
95
88
|
async: true,
|
96
89
|
cwd: selenoidConfigDir
|
97
90
|
});
|
98
|
-
|
99
91
|
if (debug) {
|
100
92
|
var _selenoidProcess$stdo, _selenoidProcess$stde;
|
101
|
-
|
102
|
-
(_selenoidProcess$
|
103
|
-
(_selenoidProcess$stde = selenoidProcess.stderr) === null || _selenoidProcess$stde === void 0 ? void 0 : _selenoidProcess$stde.pipe(process.stderr);
|
93
|
+
(_selenoidProcess$stdo = selenoidProcess.stdout) === null || _selenoidProcess$stdo === void 0 || _selenoidProcess$stdo.pipe(process.stdout);
|
94
|
+
(_selenoidProcess$stde = selenoidProcess.stderr) === null || _selenoidProcess$stde === void 0 || _selenoidProcess$stde.pipe(process.stderr);
|
104
95
|
}
|
105
|
-
|
106
96
|
subscribeOn('shutdown', () => selenoidProcess.kill());
|
107
97
|
}
|
108
98
|
export async function startSelenoidContainer(config, debug) {
|
@@ -123,13 +113,12 @@ export async function startSelenoidContainer(config, debug) {
|
|
123
113
|
auth: config.dockerAuth,
|
124
114
|
platform: config.dockerImagePlatform
|
125
115
|
};
|
126
|
-
|
127
116
|
if (config.pullImages) {
|
128
117
|
await pullImages([selenoidImage], pullOptions);
|
129
118
|
await pullImages(images, pullOptions);
|
130
|
-
}
|
131
|
-
|
119
|
+
}
|
132
120
|
|
121
|
+
// TODO Allow pass custom options
|
133
122
|
const selenoidOptions = {
|
134
123
|
ExposedPorts: {
|
135
124
|
'4444/tcp': {}
|