screenci 0.0.75 → 0.0.76
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/dist/cli.d.ts +11 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +150 -37
- package/dist/cli.js.map +1 -1
- package/dist/docs/manifest.d.ts +42 -11
- package/dist/docs/manifest.d.ts.map +1 -1
- package/dist/docs/manifest.js +14 -3
- package/dist/docs/manifest.js.map +1 -1
- package/dist/docs/video-sources/installation.screenci.js +7 -9
- package/dist/docs/video-sources/installation.screenci.js.map +1 -1
- package/dist/docs/video-sources/landing.screenci.js +6 -8
- package/dist/docs/video-sources/landing.screenci.js.map +1 -1
- package/dist/docs/video-sources/locator-highlight-animated.screenci.js +3 -4
- package/dist/docs/video-sources/locator-highlight-animated.screenci.js.map +1 -1
- package/dist/docs/video-sources/locator-highlight-still.screenci.js +3 -4
- package/dist/docs/video-sources/locator-highlight-still.screenci.js.map +1 -1
- package/dist/docs/video-sources/studio.screenci.js +8 -10
- package/dist/docs/video-sources/studio.screenci.js.map +1 -1
- package/dist/e2e/instrument.e2e.js +52 -1
- package/dist/e2e/instrument.e2e.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/src/asset.d.ts +20 -1
- package/dist/src/asset.d.ts.map +1 -1
- package/dist/src/asset.js +58 -7
- package/dist/src/asset.js.map +1 -1
- package/dist/src/audio.d.ts +16 -0
- package/dist/src/audio.d.ts.map +1 -1
- package/dist/src/audio.js +78 -1
- package/dist/src/audio.js.map +1 -1
- package/dist/src/autoZoom.d.ts.map +1 -1
- package/dist/src/autoZoom.js +3 -1
- package/dist/src/autoZoom.js.map +1 -1
- package/dist/src/browserLaunchOptions.d.ts +24 -2
- package/dist/src/browserLaunchOptions.d.ts.map +1 -1
- package/dist/src/browserLaunchOptions.js +57 -3
- package/dist/src/browserLaunchOptions.js.map +1 -1
- package/dist/src/builder.d.ts +135 -142
- package/dist/src/builder.d.ts.map +1 -1
- package/dist/src/builder.js +218 -77
- package/dist/src/builder.js.map +1 -1
- package/dist/src/callerFile.d.ts +12 -0
- package/dist/src/callerFile.d.ts.map +1 -0
- package/dist/src/callerFile.js +46 -0
- package/dist/src/callerFile.js.map +1 -0
- package/dist/src/changeFocus.d.ts.map +1 -1
- package/dist/src/changeFocus.js +6 -2
- package/dist/src/changeFocus.js.map +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +15 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/declare.d.ts +59 -0
- package/dist/src/declare.d.ts.map +1 -0
- package/dist/src/declare.js +93 -0
- package/dist/src/declare.js.map +1 -0
- package/dist/src/defaults.d.ts.map +1 -1
- package/dist/src/defaults.js +4 -3
- package/dist/src/defaults.js.map +1 -1
- package/dist/src/events.d.ts +51 -1
- package/dist/src/events.d.ts.map +1 -1
- package/dist/src/events.js +107 -15
- package/dist/src/events.js.map +1 -1
- package/dist/src/init.d.ts.map +1 -1
- package/dist/src/init.js +32 -30
- package/dist/src/init.js.map +1 -1
- package/dist/src/instrument.d.ts.map +1 -1
- package/dist/src/instrument.js +139 -1
- package/dist/src/instrument.js.map +1 -1
- package/dist/src/localize.d.ts +1 -0
- package/dist/src/localize.d.ts.map +1 -1
- package/dist/src/localize.js +1 -1
- package/dist/src/localize.js.map +1 -1
- package/dist/src/localizeRuntime.d.ts +17 -26
- package/dist/src/localizeRuntime.d.ts.map +1 -1
- package/dist/src/localizeRuntime.js +63 -48
- package/dist/src/localizeRuntime.js.map +1 -1
- package/dist/src/manualZoom.d.ts.map +1 -1
- package/dist/src/manualZoom.js +8 -5
- package/dist/src/manualZoom.js.map +1 -1
- package/dist/src/openBrowser.d.ts +34 -0
- package/dist/src/openBrowser.d.ts.map +1 -0
- package/dist/src/openBrowser.js +62 -0
- package/dist/src/openBrowser.js.map +1 -0
- package/dist/src/recordingData.d.ts +20 -0
- package/dist/src/recordingData.d.ts.map +1 -1
- package/dist/src/screenAudio.d.ts +58 -0
- package/dist/src/screenAudio.d.ts.map +1 -0
- package/dist/src/screenAudio.js +145 -0
- package/dist/src/screenAudio.js.map +1 -0
- package/dist/src/screenAudioSink.d.ts +34 -0
- package/dist/src/screenAudioSink.d.ts.map +1 -0
- package/dist/src/screenAudioSink.js +47 -0
- package/dist/src/screenAudioSink.js.map +1 -0
- package/dist/src/screenshot.d.ts +20 -24
- package/dist/src/screenshot.d.ts.map +1 -1
- package/dist/src/screenshot.js +34 -19
- package/dist/src/screenshot.js.map +1 -1
- package/dist/src/stillCapture.d.ts +5 -0
- package/dist/src/stillCapture.d.ts.map +1 -1
- package/dist/src/stillCapture.js +11 -1
- package/dist/src/stillCapture.js.map +1 -1
- package/dist/src/studio.d.ts +3 -59
- package/dist/src/studio.d.ts.map +1 -1
- package/dist/src/studio.js +1 -41
- package/dist/src/studio.js.map +1 -1
- package/dist/src/types.d.ts +133 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/video.d.ts +63 -52
- package/dist/src/video.d.ts.map +1 -1
- package/dist/src/video.js +143 -32
- package/dist/src/video.js.map +1 -1
- package/dist/src/zoom.d.ts +1 -0
- package/dist/src/zoom.d.ts.map +1 -1
- package/dist/src/zoom.js +3 -0
- package/dist/src/zoom.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/skills/screenci/SKILL.md +2 -2
- package/skills/screenci/references/init.md +4 -3
- package/skills/screenci/references/record.md +1 -1
- package/dist/docs/video-sources/public-urls.screenci.d.ts +0 -2
- package/dist/docs/video-sources/public-urls.screenci.d.ts.map +0 -1
- package/dist/docs/video-sources/public-urls.screenci.js +0 -41
- package/dist/docs/video-sources/public-urls.screenci.js.map +0 -1
package/dist/src/screenshot.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestDetails, TestInfo } from '@playwright/test';
|
|
2
2
|
import type { RecordOptions, RenderOptions, ScreenCIPage } from './types.js';
|
|
3
|
-
import type
|
|
4
|
-
import { type OverlayController } from './asset.js';
|
|
3
|
+
import { type OverlayController, type OverlayInputOrFactory } from './asset.js';
|
|
5
4
|
import type { CropTarget, CropOptions } from './crop.js';
|
|
6
|
-
import type
|
|
7
|
-
import type {
|
|
5
|
+
import { type MediaBuilder } from './builder.js';
|
|
6
|
+
import type { NormalizedFeature } from './declare.js';
|
|
8
7
|
import { type TextValues } from './localizeRuntime.js';
|
|
9
8
|
/**
|
|
10
9
|
* The `crop` fixture argument. Call it inside a `screenshot()` body to crop the
|
|
@@ -13,21 +12,16 @@ import { type TextValues } from './localizeRuntime.js';
|
|
|
13
12
|
*/
|
|
14
13
|
export type CropFixture = (target: CropTarget, options?: CropOptions) => Promise<void>;
|
|
15
14
|
type ScreenshotFixtureOptions = {
|
|
16
|
-
recordOptions: RecordOptions;
|
|
17
|
-
renderOptions: RenderOptions | undefined;
|
|
15
|
+
recordOptions: RecordOptions | 'studio';
|
|
16
|
+
renderOptions: RenderOptions | 'studio' | undefined;
|
|
18
17
|
/** Active language for this pass; see {@link video} for details. Internal. */
|
|
19
18
|
_screenciLanguage: string | undefined;
|
|
20
19
|
/** Grouping name written to `metadata.videoName`. Internal. */
|
|
21
20
|
_screenciVideoName: string | undefined;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
* render/record deferral flags and the Studio-managed `text` and `overlays`
|
|
27
|
-
* fixtures. A still is silent, so narration/audio declarations are ignored.
|
|
28
|
-
* Internal.
|
|
29
|
-
*/
|
|
30
|
-
_screenciStudio: StudioDeclaration | undefined;
|
|
21
|
+
/** Text-field declaration (`screenshot.text(...)`). Internal. */
|
|
22
|
+
_screenciText: NormalizedFeature<string> | undefined;
|
|
23
|
+
/** Overlay declaration (`screenshot.overlays(...)`). Internal. */
|
|
24
|
+
_screenciOverlays: NormalizedFeature<OverlayInputOrFactory> | undefined;
|
|
31
25
|
/**
|
|
32
26
|
* Absolute path of the `.screenci` script that registered this test, captured
|
|
33
27
|
* by the fan-out builder. Asset paths are resolved relative to it, since
|
|
@@ -46,10 +40,10 @@ type ScreenshotFixtures = {
|
|
|
46
40
|
*/
|
|
47
41
|
text: TextValues;
|
|
48
42
|
/**
|
|
49
|
-
* Overlay controllers for the
|
|
50
|
-
*
|
|
43
|
+
* Overlay controllers for the names declared in `screenshot.overlays(...)`.
|
|
44
|
+
* Empty when none are declared.
|
|
51
45
|
*/
|
|
52
|
-
overlays: Record<string, OverlayController>;
|
|
46
|
+
overlays: Record<string, OverlayController | ((props: unknown) => OverlayController)>;
|
|
53
47
|
};
|
|
54
48
|
type ScreenshotType = TestType<PlaywrightTestArgs & PlaywrightTestOptions & ScreenshotFixtureOptions & ScreenshotFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
55
49
|
type ScreenshotArgs = Omit<PlaywrightTestArgs, 'page'> & {
|
|
@@ -102,18 +96,20 @@ interface Screenshot extends ScreenshotCallSignatures {
|
|
|
102
96
|
* language, and the body receives the active `language` and `text` values.
|
|
103
97
|
* Chainable with `.each(...)`.
|
|
104
98
|
*/
|
|
105
|
-
|
|
99
|
+
/** Declare on-screen text fields (array = Studio-owned, object = code values). */
|
|
100
|
+
text: MediaBuilder<ScreenshotArgs>['text'];
|
|
101
|
+
/** Declare overlays (array = Studio-owned, object = code values/factories). */
|
|
102
|
+
overlays: MediaBuilder<ScreenshotArgs>['overlays'];
|
|
106
103
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* audio declarations are ignored. Chainable with `.localize(...)` / `.each(...)`.
|
|
104
|
+
* Declare the recorded language set / capture mode. Pass `'studio'` to let the
|
|
105
|
+
* web app own the set, an array `['en', 'fi']`, or an options object.
|
|
110
106
|
*/
|
|
111
|
-
|
|
107
|
+
languages: MediaBuilder<ScreenshotArgs>['languages'];
|
|
112
108
|
/**
|
|
113
109
|
* Produce a separate screenshot per variant (viewport, theme, ...). Each
|
|
114
110
|
* variant has its own identity and history. Chainable with `.languages(...)`.
|
|
115
111
|
*/
|
|
116
|
-
each:
|
|
112
|
+
each: MediaBuilder<ScreenshotArgs>['each'];
|
|
117
113
|
beforeEach(inner: (args: ScreenshotArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
|
118
114
|
beforeEach(title: string, inner: (args: ScreenshotArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
|
119
115
|
afterEach(inner: (args: ScreenshotArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,QAAQ,EACT,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,QAAQ,EACT,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,YAAY,CAAA;AAmBnB,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAU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AU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,UAAU,EAAiC,UAAU,CAAA"}
|
package/dist/src/screenshot.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { test as base } from '@playwright/test';
|
|
2
2
|
import { mkdir, rm } from 'fs/promises';
|
|
3
3
|
import { join, relative } from 'path';
|
|
4
|
-
import {
|
|
5
|
-
import { buildStudioOverlays } from './asset.js';
|
|
4
|
+
import { buildOverlays, } from './asset.js';
|
|
6
5
|
import { getDimensions } from './dimensions.js';
|
|
7
6
|
import { DEFAULT_VIDEO_OPTIONS, DEFAULT_ASPECT_RATIO, DEFAULT_QUALITY, DEFAULT_SCREENSHOT_DEVICE_SCALE_FACTOR, } from './defaults.js';
|
|
8
7
|
import { EventRecorder } from './events.js';
|
|
@@ -12,10 +11,11 @@ import { createScreenCIRuntimeContext } from './runtimeContext.js';
|
|
|
12
11
|
import { escapeFileSystemPathSegment } from './fileSystemName.js';
|
|
13
12
|
import { buildScreenCIContextOptions, resolveDeviceScaleFactor, } from './contextOptions.js';
|
|
14
13
|
import { resolveCrop } from './crop.js';
|
|
14
|
+
import { getMousePosition } from './mouse.js';
|
|
15
15
|
import { getRuntimePage, setRuntimeCrop } from './runtimeContext.js';
|
|
16
16
|
import { ScreenciError } from './errors.js';
|
|
17
|
-
import { withActiveRecordingContext, resolveEffectiveRecordOptions, } from './video.js';
|
|
18
|
-
import { createVideoBuilder } from './builder.js';
|
|
17
|
+
import { withActiveRecordingContext, resolveEffectiveRecordOptions, resolveStudioRecordOptions, resolveStudioRenderOptions, } from './video.js';
|
|
18
|
+
import { createVideoBuilder, SCREENSHOT_FEATURES, } from './builder.js';
|
|
19
19
|
import { buildTextDeclaration, buildTextValues, } from './localizeRuntime.js';
|
|
20
20
|
import { parseTextOverrides } from './runtimeMode.js';
|
|
21
21
|
/** File name of the raw page capture written beside `data.json`. */
|
|
@@ -25,17 +25,17 @@ const _screenshotBase = base.extend({
|
|
|
25
25
|
renderOptions: [undefined, { option: true }],
|
|
26
26
|
_screenciLanguage: [undefined, { option: true }],
|
|
27
27
|
_screenciVideoName: [undefined, { option: true }],
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
_screenciText: [undefined, { option: true }],
|
|
29
|
+
_screenciOverlays: [undefined, { option: true }],
|
|
30
30
|
_screenciSourceFile: [undefined, { option: true }],
|
|
31
31
|
language: async ({ _screenciLanguage }, use) => {
|
|
32
32
|
await use(_screenciLanguage);
|
|
33
33
|
},
|
|
34
|
-
text: async ({
|
|
35
|
-
await use(buildTextValues(
|
|
34
|
+
text: async ({ _screenciText, _screenciLanguage }, use) => {
|
|
35
|
+
await use(buildTextValues(_screenciText, _screenciLanguage, parseTextOverrides()));
|
|
36
36
|
},
|
|
37
|
-
overlays: async ({
|
|
38
|
-
await use(
|
|
37
|
+
overlays: async ({ _screenciOverlays, _screenciLanguage }, use) => {
|
|
38
|
+
await use(buildOverlays(_screenciOverlays, _screenciLanguage));
|
|
39
39
|
},
|
|
40
40
|
crop: async ({}, use) => {
|
|
41
41
|
await use(async (target, options) => {
|
|
@@ -56,8 +56,9 @@ const _screenshotBase = base.extend({
|
|
|
56
56
|
await browser.close();
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
|
-
context: async ({ browser, recordOptions,
|
|
60
|
-
const
|
|
59
|
+
context: async ({ browser, recordOptions, _screenciVideoName, colorScheme, locale, timezoneId, userAgent, geolocation, permissions, extraHTTPHeaders, httpCredentials, ignoreHTTPSErrors, offline, storageState, baseURL, bypassCSP, acceptDownloads, javaScriptEnabled, hasTouch, isMobile, deviceScaleFactor, }, use, testInfo) => {
|
|
60
|
+
const { base: baseRecordOptions, studio: studioRecord } = resolveStudioRecordOptions(recordOptions);
|
|
61
|
+
const effectiveRecordOptions = resolveEffectiveRecordOptions(baseRecordOptions, studioRecord, _screenciVideoName ?? testInfo.title);
|
|
61
62
|
const aspectRatio = effectiveRecordOptions.aspectRatio ?? DEFAULT_ASPECT_RATIO;
|
|
62
63
|
const quality = effectiveRecordOptions.quality ?? DEFAULT_QUALITY;
|
|
63
64
|
const dimensions = getDimensions(aspectRatio, quality);
|
|
@@ -95,14 +96,19 @@ const _screenshotBase = base.extend({
|
|
|
95
96
|
await context.close();
|
|
96
97
|
}
|
|
97
98
|
},
|
|
98
|
-
page: async ({ context, recordOptions: codeRecordOptions, renderOptions, deviceScaleFactor, _screenciLanguage,
|
|
99
|
+
page: async ({ context, recordOptions: codeRecordOptions, renderOptions, deviceScaleFactor, _screenciLanguage, _screenciText, _screenciVideoName, _screenciSourceFile, }, use, testInfo) => {
|
|
99
100
|
const shouldRecord = process.env.SCREENCI_RECORDING === 'true';
|
|
100
|
-
const
|
|
101
|
-
const
|
|
101
|
+
const { base: baseRecordOptions, studio: studioRecord } = resolveStudioRecordOptions(codeRecordOptions);
|
|
102
|
+
const { obj: renderOptionsObj, studio: studioRender } = resolveStudioRenderOptions(renderOptions);
|
|
103
|
+
const recordOptions = resolveEffectiveRecordOptions(baseRecordOptions, studioRecord, _screenciVideoName ?? testInfo.title);
|
|
104
|
+
const recorder = new EventRecorder(renderOptionsObj, recordOptions, {
|
|
105
|
+
renderOptions: studioRender,
|
|
106
|
+
recordOptions: studioRecord,
|
|
107
|
+
});
|
|
102
108
|
recorder.setActiveLanguage(_screenciLanguage ?? null);
|
|
103
109
|
// Declared `text` fields (and the active language's seeds) emitted once at
|
|
104
110
|
// recording start so the backend/Studio learn them.
|
|
105
|
-
const textDeclaration = buildTextDeclaration(
|
|
111
|
+
const textDeclaration = buildTextDeclaration(_screenciText, _screenciLanguage);
|
|
106
112
|
const videoName = _screenciVideoName ?? testInfo.title;
|
|
107
113
|
// Asset paths are authored relative to the user's script. Playwright reports
|
|
108
114
|
// `testInfo.file` as the builder module that registered the test, so prefer
|
|
@@ -172,11 +178,19 @@ const _screenshotBase = base.extend({
|
|
|
172
178
|
path: join(screenshotDir, SCREENSHOT_FILE_NAME),
|
|
173
179
|
});
|
|
174
180
|
const crop = runtimeContext.crop ?? undefined;
|
|
181
|
+
// The cursor lands at its final position even for a still (the move is
|
|
182
|
+
// instant). Record it so the renderer can draw the cursor on the still
|
|
183
|
+
// when `renderOptions.screenshot.mouse.show` is set. Absent when the body
|
|
184
|
+
// never moved the cursor, so no cursor is ever shown for such a still.
|
|
185
|
+
const mousePosition = getMousePosition(page);
|
|
175
186
|
const screenshot = {
|
|
176
187
|
path: SCREENSHOT_FILE_NAME,
|
|
177
188
|
width: Math.round(dimensions.width * dsf),
|
|
178
189
|
height: Math.round(dimensions.height * dsf),
|
|
179
190
|
deviceScaleFactor: dsf,
|
|
191
|
+
...(mousePosition !== undefined && {
|
|
192
|
+
mousePosition: { x: mousePosition.x, y: mousePosition.y },
|
|
193
|
+
}),
|
|
180
194
|
};
|
|
181
195
|
const configDir = process.env.SCREENCI_CONFIG_DIR ?? process.cwd();
|
|
182
196
|
// The crop (from the `crop` fixture) is a render option, so it goes into
|
|
@@ -220,8 +234,9 @@ const _screenshotBase = base.extend({
|
|
|
220
234
|
*/
|
|
221
235
|
export const screenshot = _screenshotBase;
|
|
222
236
|
// Attach the chainable fan-out builders, mirroring `video`.
|
|
223
|
-
const _screenshotRootBuilder = createVideoBuilder(_screenshotBase);
|
|
224
|
-
screenshot.
|
|
225
|
-
screenshot.
|
|
237
|
+
const _screenshotRootBuilder = createVideoBuilder(_screenshotBase, SCREENSHOT_FEATURES);
|
|
238
|
+
screenshot.text = _screenshotRootBuilder.text;
|
|
239
|
+
screenshot.overlays = _screenshotRootBuilder.overlays;
|
|
240
|
+
screenshot.languages = _screenshotRootBuilder.languages;
|
|
226
241
|
screenshot.each = _screenshotRootBuilder.each;
|
|
227
242
|
//# sourceMappingURL=screenshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/screenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IA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AS,EACT,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,EACjC;gBACE,MAAM,EAAE,YAAY;gBACpB,UAAU;gBACV,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC;aACpC,CACF,CAAA;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;IACH,CAAC;CACF,CAAC,CAAA;AA2HF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,eAAwC,CAAA;AAElE,4DAA4D;AAC5D,MAAM,sBAAsB,GAAG,kBAAkB,CAC/C,eAAsE,EACtE,mBAAmB,CACpB,CAAA;AACD,UAAU,CAAC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAA;AAC7C,UAAU,CAAC,QAAQ,GAAG,sBAAsB,CAAC,QAAQ,CAAA;AACrD,UAAU,CAAC,SAAS,GAAG,sBAAsB,CAAC,SAAS,CAAA;AACvD,UAAU,CAAC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAA"}
|
|
@@ -47,6 +47,11 @@ export declare function writeStillRecording(params: {
|
|
|
47
47
|
};
|
|
48
48
|
deviceScaleFactor: number;
|
|
49
49
|
crop?: ScreenshotCropRecord;
|
|
50
|
+
/** Final cursor position in CSS px of the viewport, if the body moved it. */
|
|
51
|
+
mousePosition?: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
};
|
|
50
55
|
testFilePath: string | null;
|
|
51
56
|
configDir: string;
|
|
52
57
|
recordOptions: RecordOptions | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stillCapture.d.ts","sourceRoot":"","sources":["../../src/stillCapture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAI5C,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAA;AAEj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AAM,EAAE;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C,iBAAiB,EAAE,MAAM,CAAA;IACzB,IAAI,CAAC,EAAE,oBAAoB,CAAA;IAC3B,6EAA6E;IAC7E,aAAa,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAA;IACxC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAA;IACxC,IAAI,EAAE,gBAAgB,CAAA;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuDlB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,IAAI,CAgE7D"}
|
package/dist/src/stillCapture.js
CHANGED
|
@@ -4,6 +4,7 @@ import { getDimensions } from './dimensions.js';
|
|
|
4
4
|
import { escapeFileSystemPathSegment } from './fileSystemName.js';
|
|
5
5
|
import { EventRecorder } from './events.js';
|
|
6
6
|
import { resolveCrop } from './crop.js';
|
|
7
|
+
import { getMousePosition } from './mouse.js';
|
|
7
8
|
import { getScreenCIRuntimeContext } from './runtimeContext.js';
|
|
8
9
|
import { DEFAULT_VIDEO_OPTIONS, DEFAULT_ASPECT_RATIO, DEFAULT_QUALITY, } from './defaults.js';
|
|
9
10
|
/** File name of the raw page capture written beside a still's `data.json`. */
|
|
@@ -41,7 +42,7 @@ export function resolveStillName(name, path, used) {
|
|
|
41
42
|
* Returns the captured bytes so the wrapped `page.screenshot()` can return them.
|
|
42
43
|
*/
|
|
43
44
|
export async function writeStillRecording(params) {
|
|
44
|
-
const { name, screenciDir, dimensions, deviceScaleFactor, crop, testFilePath, configDir, recordOptions, renderOptions, deps, } = params;
|
|
45
|
+
const { name, screenciDir, dimensions, deviceScaleFactor, crop, mousePosition, testFilePath, configDir, recordOptions, renderOptions, deps, } = params;
|
|
45
46
|
const rm = deps.fs?.rm ??
|
|
46
47
|
((path) => fsRm(path, { recursive: true, force: true }));
|
|
47
48
|
const mkdir = deps.fs?.mkdir ??
|
|
@@ -58,6 +59,9 @@ export async function writeStillRecording(params) {
|
|
|
58
59
|
width: Math.round(dimensions.width * deviceScaleFactor),
|
|
59
60
|
height: Math.round(dimensions.height * deviceScaleFactor),
|
|
60
61
|
deviceScaleFactor,
|
|
62
|
+
...(mousePosition !== undefined && {
|
|
63
|
+
mousePosition: { x: mousePosition.x, y: mousePosition.y },
|
|
64
|
+
}),
|
|
61
65
|
};
|
|
62
66
|
const recorder = makeRecorder(renderOptions, recordOptions);
|
|
63
67
|
recorder.start();
|
|
@@ -103,6 +107,9 @@ export function bindStillCaptureToPage(page) {
|
|
|
103
107
|
if (cropTarget !== undefined && ctx.page !== null) {
|
|
104
108
|
crop = await resolveCrop(cropTarget, ctx.page);
|
|
105
109
|
}
|
|
110
|
+
// The cursor's last position, so the renderer can draw it on the still when
|
|
111
|
+
// the show option is set. Undefined when the body never moved the cursor.
|
|
112
|
+
const mousePosition = getMousePosition(page);
|
|
106
113
|
const configDir = process.env.SCREENCI_CONFIG_DIR ?? process.cwd();
|
|
107
114
|
return writeStillRecording({
|
|
108
115
|
name: resolvedName,
|
|
@@ -112,6 +119,9 @@ export function bindStillCaptureToPage(page) {
|
|
|
112
119
|
// captured mid-recording is at the viewport resolution (DSF 1).
|
|
113
120
|
deviceScaleFactor: 1,
|
|
114
121
|
...(crop !== undefined && { crop }),
|
|
122
|
+
...(mousePosition !== undefined && {
|
|
123
|
+
mousePosition: { x: mousePosition.x, y: mousePosition.y },
|
|
124
|
+
}),
|
|
115
125
|
testFilePath: ctx.testFilePath,
|
|
116
126
|
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,OAAO,CAAC,GAAG,EAAE,CAAA;QAElE,OAAO,mBAAmB,CAAC;YACzB,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC;YAC7C,UAAU;YACV,2EAA2E;YAC3E,gEAAgE;YAChE,iBAAiB,EAAE,CAAC;YACpB,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC;YACnC,GAAG,CAAC,aAAa,KAAK,SAAS,IAAI;gBACjC,aAAa,EAAE,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC,EAAE;aAC1D,CAAC;YACF,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,SAAS;YACT,aAAa;YACb,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,IAAI,EAAE;gBACJ,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;aACxE;SACF,CAAC,CAAA;IACJ,CAAC,CAEA;IAAC,IAAkD,CAAC,UAAU,GAAG,OAAO,CAAA;IAEzE,OAAO,GAAG,EAAE;QACV,CAAC;QAAC,IAAmD,CAAC,UAAU,GAAG,QAAQ,CAAA;IAC7E,CAAC,CAAA;AACH,CAAC"}
|
package/dist/src/studio.d.ts
CHANGED
|
@@ -1,66 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Opt in with a single `video.studio({...})` (or `screenshot.studio({...})`)
|
|
7
|
-
* declaration, chainable with `.localize()` / `.each()`:
|
|
8
|
-
*
|
|
9
|
-
* - `renderOptions: true` / `recordOptions: true` defer those option groups to
|
|
10
|
-
* Studio. `recordOptions` (aspect ratio, quality, fps) changes the capture, so
|
|
11
|
-
* it is fetched before recording; `renderOptions` is applied at render.
|
|
12
|
-
* - `narration`, `text`, `overlays`, `audio` are name lists declaring the cues /
|
|
13
|
-
* fields / overlays / tracks whose content is owned by Studio. The matching
|
|
14
|
-
* `narration` / `text` / `overlays` / `audio` fixtures expose typed
|
|
15
|
-
* controllers/values for them.
|
|
16
|
-
*
|
|
17
|
-
* On the first upload of a studio-mode video, rendering is held until the video
|
|
18
|
-
* is configured in Studio (the CLI prints a direct link); later uploads reuse
|
|
19
|
-
* the saved configuration automatically.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* import { video } from 'screenci'
|
|
24
|
-
*
|
|
25
|
-
* video
|
|
26
|
-
* .studio({ renderOptions: true, narration: ['intro'], overlays: ['logo'] })
|
|
27
|
-
* .localize({ languages: ['en', 'fi'] })(
|
|
28
|
-
* 'Product demo',
|
|
29
|
-
* async ({ page, narration, overlays }) => {
|
|
30
|
-
* await overlays.logo()
|
|
31
|
-
* await narration.intro()
|
|
32
|
-
* }
|
|
33
|
-
* )
|
|
34
|
-
* ```
|
|
2
|
+
* The studio option groups deferred to the ScreenCI web app at render/record
|
|
3
|
+
* time. Set per recording from the `renderOptions`/`recordOptions` `'studio'`
|
|
4
|
+
* sentinel; read by the recorder to stamp `metadata.studio`.
|
|
35
5
|
*/
|
|
36
|
-
export type StudioDeclaration = {
|
|
37
|
-
/** Defer render options to Studio. Applied at render time. */
|
|
38
|
-
renderOptions?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Defer record options (aspect ratio, quality, fps) to Studio. Fetched before
|
|
41
|
-
* recording, since they change the captured viewport/encode.
|
|
42
|
-
*/
|
|
43
|
-
recordOptions?: boolean;
|
|
44
|
-
/** Studio-managed narration cue names (text and voice configured in Studio). */
|
|
45
|
-
narration?: readonly string[];
|
|
46
|
-
/** Studio-managed on-screen text field names (values configured in Studio). */
|
|
47
|
-
text?: readonly string[];
|
|
48
|
-
/** Studio-managed overlay names (file and placement configured in Studio). */
|
|
49
|
-
overlays?: readonly string[];
|
|
50
|
-
/** Studio-managed background-audio track names (file/volume configured in Studio). */
|
|
51
|
-
audio?: readonly string[];
|
|
52
|
-
};
|
|
53
|
-
/** The studio option groups deferred to render/record. */
|
|
54
6
|
export type StudioOptionFlags = {
|
|
55
7
|
renderOptions: boolean;
|
|
56
8
|
recordOptions: boolean;
|
|
57
9
|
};
|
|
58
|
-
/** Returns the render/record deferral flags for a (possibly absent) declaration. */
|
|
59
|
-
export declare function studioOptionFlags(declaration: StudioDeclaration | undefined): StudioOptionFlags;
|
|
60
|
-
/**
|
|
61
|
-
* Validates a studio declaration against the seeded localize names: each name
|
|
62
|
-
* list is unique and non-empty, and Studio-managed narration/text names are
|
|
63
|
-
* disjoint from the names seeded in `localize()`. Pure; throws on violation.
|
|
64
|
-
*/
|
|
65
|
-
export declare function validateStudioDeclaration(declaration: StudioDeclaration | null, seededNarrationNames: readonly string[], seededTextNames: readonly string[]): void;
|
|
66
10
|
//# sourceMappingURL=studio.d.ts.map
|
package/dist/src/studio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,EAAE,OAAO,CAAA;CACvB,CAAA"}
|
package/dist/src/studio.js
CHANGED
|
@@ -1,42 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export function studioOptionFlags(declaration) {
|
|
3
|
-
return {
|
|
4
|
-
renderOptions: declaration?.renderOptions === true,
|
|
5
|
-
recordOptions: declaration?.recordOptions === true,
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
function assertUniqueStudioNames(label, names) {
|
|
9
|
-
const seen = new Set();
|
|
10
|
-
for (const name of names) {
|
|
11
|
-
if (typeof name !== 'string' || name.length === 0) {
|
|
12
|
-
throw new Error(`video.studio(): ${label} names must be non-empty strings.`);
|
|
13
|
-
}
|
|
14
|
-
if (seen.has(name)) {
|
|
15
|
-
throw new Error(`video.studio(): duplicate ${label} name "${name}".`);
|
|
16
|
-
}
|
|
17
|
-
seen.add(name);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function assertDisjointFromSeeded(label, studioNames, seededNames) {
|
|
21
|
-
const seeded = new Set(seededNames);
|
|
22
|
-
const overlap = studioNames.filter((name) => seeded.has(name));
|
|
23
|
-
if (overlap.length === 0)
|
|
24
|
-
return;
|
|
25
|
-
throw new Error(`video.studio(): ${label} name(s) ${overlap.join(', ')} are both seeded in localize() and declared as Studio-managed. A name must be one or the other.`);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Validates a studio declaration against the seeded localize names: each name
|
|
29
|
-
* list is unique and non-empty, and Studio-managed narration/text names are
|
|
30
|
-
* disjoint from the names seeded in `localize()`. Pure; throws on violation.
|
|
31
|
-
*/
|
|
32
|
-
export function validateStudioDeclaration(declaration, seededNarrationNames, seededTextNames) {
|
|
33
|
-
if (declaration === null)
|
|
34
|
-
return;
|
|
35
|
-
assertUniqueStudioNames('narration', declaration.narration ?? []);
|
|
36
|
-
assertUniqueStudioNames('text', declaration.text ?? []);
|
|
37
|
-
assertUniqueStudioNames('overlays', declaration.overlays ?? []);
|
|
38
|
-
assertUniqueStudioNames('audio', declaration.audio ?? []);
|
|
39
|
-
assertDisjointFromSeeded('narration', declaration.narration ?? [], seededNarrationNames);
|
|
40
|
-
assertDisjointFromSeeded('text', declaration.text ?? [], seededTextNames);
|
|
41
|
-
}
|
|
1
|
+
export {};
|
|
42
2
|
//# sourceMappingURL=studio.js.map
|
package/dist/src/studio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":""}
|