@gravity-ui/playwright-tools 0.8.4 → 0.9.1
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/README.md +1 -0
- package/actions/expect-request/matchers/compare/DiffPrinter.js +16 -11
- package/component-tests/fixtures/index.d.ts +2 -0
- package/component-tests/fixtures/index.js +6 -0
- package/component-tests/index.d.ts +4 -0
- package/component-tests/index.js +8 -0
- package/{storybook → component-tests/utils/create-smoke-scenarios}/create-smoke-scenarios.js +4 -2
- package/component-tests/utils/index.d.ts +2 -0
- package/component-tests/utils/index.js +5 -0
- package/fixtures/index.d.ts +0 -2
- package/fixtures/index.js +1 -4
- package/fixtures/mock-network/mock-network-fixture.d.ts +1 -1
- package/fixtures/mock-network/mock-network-fixture.js +1 -2
- package/fixtures/mock-network/types.d.ts +0 -13
- package/har/addFlushTransform.js +1 -0
- package/har/dumpsFilePathBulders.d.ts +9 -0
- package/har/dumpsFilePathBulders.js +19 -0
- package/har/index.d.ts +1 -0
- package/har/index.js +4 -1
- package/har/initDumps.d.ts +1 -14
- package/har/initDumps.js +3 -22
- package/package.json +11 -9
- /package/{fixtures → component-tests/fixtures}/mount/constants.d.ts +0 -0
- /package/{fixtures → component-tests/fixtures}/mount/constants.js +0 -0
- /package/{fixtures → component-tests/fixtures}/mount/index.d.ts +0 -0
- /package/{fixtures → component-tests/fixtures}/mount/index.js +0 -0
- /package/{fixtures → component-tests/fixtures}/mount/mount-fixture.d.ts +0 -0
- /package/{fixtures → component-tests/fixtures}/mount/mount-fixture.js +0 -0
- /package/{fixtures → component-tests/fixtures}/mount/types.d.ts +0 -0
- /package/{fixtures → component-tests/fixtures}/mount/types.js +0 -0
- /package/{storybook → component-tests/utils/create-smoke-scenarios}/create-smoke-scenarios.d.ts +0 -0
- /package/{storybook → component-tests/utils/create-smoke-scenarios}/index.d.ts +0 -0
- /package/{storybook → component-tests/utils/create-smoke-scenarios}/index.js +0 -0
- /package/{storybook → component-tests/utils/create-smoke-scenarios}/types.d.ts +0 -0
- /package/{storybook → component-tests/utils/create-smoke-scenarios}/types.js +0 -0
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ import { matchScreenshot } from 'playwright-tools/actions';
|
|
|
14
14
|
|
|
15
15
|
- [actions](./actions/README.md) — Browser actions.
|
|
16
16
|
- [auth/storage](./auth/storage/README.md) — Authentication functions for saving and restoring browser storage snapshots.
|
|
17
|
+
- [component-tests](./component-tests/README.md) — Utilities and fixtures for Playwright Component Testing.
|
|
17
18
|
- [fixtures](./fixtures/README.md) — Fixtures for passing values into tests.
|
|
18
19
|
- [har](./har/README.md) — Functions for working with HAR request dumps.
|
|
19
20
|
- [config](./config/README.md) — Base configuration.
|
|
@@ -34,34 +34,39 @@ class DiffPrinter {
|
|
|
34
34
|
const pathAnnotations = filteredLog.reduce((acc, logItem) => {
|
|
35
35
|
const { context, type } = logItem;
|
|
36
36
|
const path = this.makePathFromContext(context);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
37
|
+
const existingAnnotations = acc[path] ?? [];
|
|
38
|
+
let newAnnotation;
|
|
40
39
|
if (type === constants_1.DiffType.ValueMismatch) {
|
|
41
40
|
if (logItem.expected === undefined && logItem.received !== undefined) {
|
|
42
|
-
|
|
41
|
+
newAnnotation = { type: constants_1.PathAnnotationType.ObjectExtraProperty };
|
|
43
42
|
}
|
|
44
43
|
else {
|
|
45
|
-
|
|
44
|
+
newAnnotation = {
|
|
46
45
|
type: constants_1.PathAnnotationType.ValueMismatch,
|
|
47
46
|
expected: logItem.expected,
|
|
48
47
|
received: logItem.received,
|
|
49
|
-
}
|
|
48
|
+
};
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
else if (type === constants_1.DiffType.ObjectMissingProperty) {
|
|
53
|
-
|
|
52
|
+
newAnnotation = {
|
|
54
53
|
type: constants_1.PathAnnotationType.ObjectMissingProperty,
|
|
55
54
|
expected: logItem.expected,
|
|
56
|
-
}
|
|
55
|
+
};
|
|
57
56
|
}
|
|
58
57
|
else if (type === constants_1.DiffType.ArrayMissingValue) {
|
|
59
|
-
|
|
58
|
+
newAnnotation = {
|
|
60
59
|
type: constants_1.PathAnnotationType.ArrayMissingValue,
|
|
61
60
|
expected: logItem.expected,
|
|
62
|
-
}
|
|
61
|
+
};
|
|
63
62
|
}
|
|
64
|
-
|
|
63
|
+
if (!newAnnotation) {
|
|
64
|
+
return acc;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
...acc,
|
|
68
|
+
[path]: [...existingAnnotations, newAnnotation],
|
|
69
|
+
};
|
|
65
70
|
}, {});
|
|
66
71
|
return (0, print_json_diff_1.printJsonDiff)({ json: side === 'left' ? this.left : this.right, pathAnnotations });
|
|
67
72
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEST_WRAPPER_CLASS = exports.mountFixture = void 0;
|
|
4
|
+
var mount_1 = require("./mount");
|
|
5
|
+
Object.defineProperty(exports, "mountFixture", { enumerable: true, get: function () { return mount_1.mountFixture; } });
|
|
6
|
+
Object.defineProperty(exports, "TEST_WRAPPER_CLASS", { enumerable: true, get: function () { return mount_1.TEST_WRAPPER_CLASS; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEST_WRAPPER_CLASS = exports.mountFixture = exports.createSmokeScenarios = void 0;
|
|
4
|
+
var utils_1 = require("./utils");
|
|
5
|
+
Object.defineProperty(exports, "createSmokeScenarios", { enumerable: true, get: function () { return utils_1.createSmokeScenarios; } });
|
|
6
|
+
var fixtures_1 = require("./fixtures");
|
|
7
|
+
Object.defineProperty(exports, "mountFixture", { enumerable: true, get: function () { return fixtures_1.mountFixture; } });
|
|
8
|
+
Object.defineProperty(exports, "TEST_WRAPPER_CLASS", { enumerable: true, get: function () { return fixtures_1.TEST_WRAPPER_CLASS; } });
|
package/{storybook → component-tests/utils/create-smoke-scenarios}/create-smoke-scenarios.js
RENAMED
|
@@ -35,12 +35,14 @@ const createSmokeScenarios = (baseProps, propsCases, options) => {
|
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
propCases.forEach((propCase) => {
|
|
38
|
-
const hasStringifyMethod = propCase
|
|
38
|
+
const hasStringifyMethod = propCase !== null &&
|
|
39
|
+
propCase !== undefined &&
|
|
40
|
+
typeof propCase.toString === 'function';
|
|
39
41
|
if (!hasStringifyMethod) {
|
|
40
42
|
throw new Error('The case value does not have a method "toString", use case with name.');
|
|
41
43
|
}
|
|
42
44
|
scenarios.push([
|
|
43
|
-
`${scenarioName}[${propName}: ${propCase
|
|
45
|
+
`${scenarioName}[${propName}: ${String(propCase)}]`,
|
|
44
46
|
{
|
|
45
47
|
...baseProps,
|
|
46
48
|
[propName]: propCase,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSmokeScenarios = void 0;
|
|
4
|
+
var create_smoke_scenarios_1 = require("./create-smoke-scenarios");
|
|
5
|
+
Object.defineProperty(exports, "createSmokeScenarios", { enumerable: true, get: function () { return create_smoke_scenarios_1.createSmokeScenarios; } });
|
package/fixtures/index.d.ts
CHANGED
|
@@ -8,5 +8,3 @@ export type { ExpectScreenshotFn, ExpectScreenshotTestArgs, ExpectScreenshotFixt
|
|
|
8
8
|
export { expectScreenshotFixtureBuilder } from './expect-screenshot';
|
|
9
9
|
export type { GlobalSettingsFixturesBuilderParams, GlobalSettingsTestArgs, GlobalSettingsWorkerArgs, } from './global-settings';
|
|
10
10
|
export { globalSettingsFixturesBuilder } from './global-settings';
|
|
11
|
-
export type { MountFn, MountTestArgs } from './mount';
|
|
12
|
-
export { mountFixture, TEST_WRAPPER_CLASS } from './mount';
|
package/fixtures/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.globalSettingsFixturesBuilder = exports.expectScreenshotFixtureBuilder = exports.expectRequest = exports.mockNetworkFixtureBuilder = exports.testSlug = void 0;
|
|
4
4
|
var testSlug_1 = require("./testSlug");
|
|
5
5
|
Object.defineProperty(exports, "testSlug", { enumerable: true, get: function () { return testSlug_1.testSlug; } });
|
|
6
6
|
var mock_network_1 = require("./mock-network");
|
|
@@ -11,6 +11,3 @@ var expect_screenshot_1 = require("./expect-screenshot");
|
|
|
11
11
|
Object.defineProperty(exports, "expectScreenshotFixtureBuilder", { enumerable: true, get: function () { return expect_screenshot_1.expectScreenshotFixtureBuilder; } });
|
|
12
12
|
var global_settings_1 = require("./global-settings");
|
|
13
13
|
Object.defineProperty(exports, "globalSettingsFixturesBuilder", { enumerable: true, get: function () { return global_settings_1.globalSettingsFixturesBuilder; } });
|
|
14
|
-
var mount_1 = require("./mount");
|
|
15
|
-
Object.defineProperty(exports, "mountFixture", { enumerable: true, get: function () { return mount_1.mountFixture; } });
|
|
16
|
-
Object.defineProperty(exports, "TEST_WRAPPER_CLASS", { enumerable: true, get: function () { return mount_1.TEST_WRAPPER_CLASS; } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlaywrightTestArgs, PlaywrightTestOptions, TestFixture } from '@playwright/test';
|
|
2
2
|
import type { MockNetworkFixtureBuilderParams } from './types';
|
|
3
|
-
export declare function mockNetworkFixtureBuilder({ shouldUpdate, forceUpdateIfHarMissing, updateTimeout, zip, url: urlMatcherBuilder,
|
|
3
|
+
export declare function mockNetworkFixtureBuilder({ shouldUpdate, forceUpdateIfHarMissing, updateTimeout, zip, url: urlMatcherBuilder, dumpsFilePath, ...harPatcherParams }: MockNetworkFixtureBuilderParams): [TestFixture<boolean, PlaywrightTestArgs & PlaywrightTestOptions>, {
|
|
4
4
|
auto: boolean;
|
|
5
5
|
scope: "test";
|
|
6
6
|
}];
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.mockNetworkFixtureBuilder = mockNetworkFixtureBuilder;
|
|
4
4
|
const har_1 = require("../../har");
|
|
5
5
|
const har_patcher_1 = require("./har-patcher");
|
|
6
|
-
function mockNetworkFixtureBuilder({ shouldUpdate, forceUpdateIfHarMissing, updateTimeout, zip = true, url: urlMatcherBuilder,
|
|
6
|
+
function mockNetworkFixtureBuilder({ shouldUpdate, forceUpdateIfHarMissing, updateTimeout, zip = true, url: urlMatcherBuilder, dumpsFilePath, ...harPatcherParams }) {
|
|
7
7
|
const mockNetworkFixture = async ({ baseURL: rawBaseURL, page }, use, testInfo) => {
|
|
8
8
|
if (!rawBaseURL) {
|
|
9
9
|
throw new Error('baseURL should be specified in playwright config');
|
|
@@ -16,7 +16,6 @@ function mockNetworkFixtureBuilder({ shouldUpdate, forceUpdateIfHarMissing, upda
|
|
|
16
16
|
const update = Boolean(shouldUpdate);
|
|
17
17
|
const url = urlMatcherBuilder(baseURL);
|
|
18
18
|
await (0, har_1.initDumps)(page, testInfo, {
|
|
19
|
-
dumpsPath,
|
|
20
19
|
dumpsFilePath,
|
|
21
20
|
forceUpdateIfHarMissing,
|
|
22
21
|
updateTimeout,
|
|
@@ -27,29 +27,16 @@ export type MockNetworkFixtureBuilderParams = {
|
|
|
27
27
|
* @returns string | RegExp Regular expression prepared template; Glob or RegExp.
|
|
28
28
|
*/
|
|
29
29
|
url: (baseURL: string) => string | RegExp;
|
|
30
|
-
/**
|
|
31
|
-
* User path to the directory with dumps. By default, the path is calculated as
|
|
32
|
-
* testInfo.snapshotPath('').replace(/-snapshots\/[^/]+$/, '-data/' + slug)
|
|
33
|
-
* @param testInfo TestInfo information about the current test
|
|
34
|
-
* @param slug Test slug
|
|
35
|
-
*
|
|
36
|
-
* @returns string path to the directory with dumps
|
|
37
|
-
*
|
|
38
|
-
* @deprecated use dumpsFilePath.
|
|
39
|
-
*/
|
|
40
|
-
dumpsPath?: (testInfo: TestInfo, slug: string) => string;
|
|
41
30
|
/**
|
|
42
31
|
* Custom path to the dump file. Overrides the path generated by dumpsPath.
|
|
43
32
|
* @param params Parameters for constructing a path:
|
|
44
33
|
* @param params.testInfo TestInfo information about the current test
|
|
45
|
-
* @param params.slug test slug
|
|
46
34
|
* @param params.zip Flag to use zip archive for .har
|
|
47
35
|
*
|
|
48
36
|
* @returns string path to dump file
|
|
49
37
|
*/
|
|
50
38
|
dumpsFilePath?: (params: {
|
|
51
39
|
testInfo: TestInfo;
|
|
52
|
-
slug: string;
|
|
53
40
|
zip: boolean;
|
|
54
41
|
}) => string;
|
|
55
42
|
/**
|
package/har/addFlushTransform.js
CHANGED
|
@@ -6,6 +6,7 @@ const getPlaywrightCoreModule_1 = require("./getPlaywrightCoreModule");
|
|
|
6
6
|
function wrapHarRecorderMethods(HarRecorder, transform) {
|
|
7
7
|
const originalFlush = HarRecorder.prototype.flush;
|
|
8
8
|
if (originalFlush) {
|
|
9
|
+
// eslint-disable-next-line no-param-reassign -- intentional prototype monkey-patching
|
|
9
10
|
HarRecorder.prototype.flush = function flush() {
|
|
10
11
|
if (transform) {
|
|
11
12
|
// Transform requests when transform function is present
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TestInfo } from '@playwright/test';
|
|
2
|
+
export declare function defaultDumpsFilePathBuilder({ testInfo, zip, }: {
|
|
3
|
+
testInfo: TestInfo;
|
|
4
|
+
zip: boolean;
|
|
5
|
+
}): string;
|
|
6
|
+
export declare function dumpsPathBuldeWithSlugBuilder({ testInfo, zip, }: {
|
|
7
|
+
testInfo: TestInfo;
|
|
8
|
+
zip: boolean;
|
|
9
|
+
}): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultDumpsFilePathBuilder = defaultDumpsFilePathBuilder;
|
|
4
|
+
exports.dumpsPathBuldeWithSlugBuilder = dumpsPathBuldeWithSlugBuilder;
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
function defaultDumpsFilePathBuilder({ testInfo, zip, }) {
|
|
7
|
+
const filePath = testInfo.snapshotPath(testInfo.titlePath
|
|
8
|
+
.slice(1)
|
|
9
|
+
.join('-')
|
|
10
|
+
.replace(/ /g, '-')
|
|
11
|
+
.replace(/[^a-zA-Z0-9\-_]/g, ''));
|
|
12
|
+
return zip ? `${filePath}.zip` : `${filePath}.har`;
|
|
13
|
+
}
|
|
14
|
+
// previous implementation, includes slug in the path
|
|
15
|
+
function dumpsPathBuldeWithSlugBuilder({ testInfo, zip, }) {
|
|
16
|
+
const slug = (0, utils_1.extractTestSlug)(testInfo.title, true);
|
|
17
|
+
const filePath = testInfo.snapshotPath('').replace(/-snapshots\/[^/]+$/, '-data/' + slug);
|
|
18
|
+
return zip ? `${filePath}.zip` : `${filePath}.har`;
|
|
19
|
+
}
|
package/har/index.d.ts
CHANGED
|
@@ -11,3 +11,4 @@ export { initDumps } from './initDumps';
|
|
|
11
11
|
export { replaceBaseUrlInEntry } from './replaceBaseUrlInEntry';
|
|
12
12
|
export { setExtraHash } from './setExtraHash';
|
|
13
13
|
export type { HARFile, Entry } from './types';
|
|
14
|
+
export { defaultDumpsFilePathBuilder, dumpsPathBuldeWithSlugBuilder } from './dumpsFilePathBulders';
|
package/har/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setExtraHash = exports.replaceBaseUrlInEntry = exports.initDumps = exports.clearHeaders = exports.addFlushTransform = exports.addHarRecorderTransform = exports.addHarOpenTransform = exports.addHarLookupTransform = void 0;
|
|
3
|
+
exports.dumpsPathBuldeWithSlugBuilder = exports.defaultDumpsFilePathBuilder = exports.setExtraHash = exports.replaceBaseUrlInEntry = exports.initDumps = exports.clearHeaders = exports.addFlushTransform = exports.addHarRecorderTransform = exports.addHarOpenTransform = exports.addHarLookupTransform = void 0;
|
|
4
4
|
var addHarLookupTransform_1 = require("./addHarLookupTransform");
|
|
5
5
|
Object.defineProperty(exports, "addHarLookupTransform", { enumerable: true, get: function () { return addHarLookupTransform_1.addHarLookupTransform; } });
|
|
6
6
|
var addHarOpenTransform_1 = require("./addHarOpenTransform");
|
|
@@ -17,3 +17,6 @@ var replaceBaseUrlInEntry_1 = require("./replaceBaseUrlInEntry");
|
|
|
17
17
|
Object.defineProperty(exports, "replaceBaseUrlInEntry", { enumerable: true, get: function () { return replaceBaseUrlInEntry_1.replaceBaseUrlInEntry; } });
|
|
18
18
|
var setExtraHash_1 = require("./setExtraHash");
|
|
19
19
|
Object.defineProperty(exports, "setExtraHash", { enumerable: true, get: function () { return setExtraHash_1.setExtraHash; } });
|
|
20
|
+
var dumpsFilePathBulders_1 = require("./dumpsFilePathBulders");
|
|
21
|
+
Object.defineProperty(exports, "defaultDumpsFilePathBuilder", { enumerable: true, get: function () { return dumpsFilePathBulders_1.defaultDumpsFilePathBuilder; } });
|
|
22
|
+
Object.defineProperty(exports, "dumpsPathBuldeWithSlugBuilder", { enumerable: true, get: function () { return dumpsFilePathBulders_1.dumpsPathBuldeWithSlugBuilder; } });
|
package/har/initDumps.d.ts
CHANGED
|
@@ -34,33 +34,20 @@ export type InitDumpsOptions = {
|
|
|
34
34
|
* @defaultValue `true`
|
|
35
35
|
*/
|
|
36
36
|
zip?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* User path to the directory with dumps. By default, the path is calculated as
|
|
39
|
-
* testInfo.snapshotPath('').replace(/-snapshots\/[^/]+$/, '-data/' + slug)
|
|
40
|
-
* @param testInfo TestInfo information about the current test
|
|
41
|
-
* @param slug test slug
|
|
42
|
-
*
|
|
43
|
-
* @returns string path to the directory with dumps
|
|
44
|
-
*
|
|
45
|
-
* @deprecated use dumpsFilePath.
|
|
46
|
-
*/
|
|
47
|
-
dumpsPath?: (testInfo: TestInfo, slug: string) => string;
|
|
48
37
|
/**
|
|
49
38
|
* Custom path to the dump file. Overrides the path generated by dumpsPath.
|
|
50
39
|
* @param params Parameters for constructing a path:
|
|
51
40
|
* @param params.testInfo TestInfo information about the current test
|
|
52
|
-
* @param params.slug test slug
|
|
53
41
|
* @param params.zip Flag to use zip archive for .har
|
|
54
42
|
*
|
|
55
43
|
* @returns string path to dump file
|
|
56
44
|
*/
|
|
57
45
|
dumpsFilePath?: (params: {
|
|
58
46
|
testInfo: TestInfo;
|
|
59
|
-
slug: string;
|
|
60
47
|
zip: boolean;
|
|
61
48
|
}) => string;
|
|
62
49
|
};
|
|
63
50
|
/**
|
|
64
51
|
* Makes the necessary preparations for saving query dumps
|
|
65
52
|
*/
|
|
66
|
-
export declare function initDumps(page: Page, testInfo: TestInfo, {
|
|
53
|
+
export declare function initDumps(page: Page, testInfo: TestInfo, { dumpsFilePath: dumpsFilePathBuilder, rootPath, forceUpdateIfHarMissing, updateTimeout, notFound, url, zip, update, }?: InitDumpsOptions): Promise<void>;
|
package/har/initDumps.js
CHANGED
|
@@ -3,29 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initDumps = initDumps;
|
|
4
4
|
const promises_1 = require("node:fs/promises");
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
|
-
const
|
|
7
|
-
const extractTestSlug_1 = require("../utils/extractTestSlug");
|
|
6
|
+
const dumpsFilePathBulders_1 = require("./dumpsFilePathBulders");
|
|
8
7
|
/**
|
|
9
8
|
* Makes the necessary preparations for saving query dumps
|
|
10
9
|
*/
|
|
11
|
-
async function initDumps(page, testInfo, {
|
|
12
|
-
let slug;
|
|
13
|
-
try {
|
|
14
|
-
slug = (0, actions_1.getTestSlug)(page);
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
console.warn(error);
|
|
18
|
-
// Backward compatibility
|
|
19
|
-
slug = (0, extractTestSlug_1.extractTestSlug)(testInfo.title, true);
|
|
20
|
-
}
|
|
10
|
+
async function initDumps(page, testInfo, { dumpsFilePath: dumpsFilePathBuilder = dumpsFilePathBulders_1.defaultDumpsFilePathBuilder, rootPath, forceUpdateIfHarMissing = false, updateTimeout, notFound = 'abort', url, zip = true, update = false, } = {}) {
|
|
21
11
|
let harPath;
|
|
22
|
-
|
|
23
|
-
harPath = dumpsFilePathBuilder({ testInfo, slug, zip });
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
const dumpsPath = dumpsPathBuilder(testInfo, slug);
|
|
27
|
-
harPath = (0, node_path_1.join)(dumpsPath, zip ? 'har.zip' : 'har.har');
|
|
28
|
-
}
|
|
12
|
+
harPath = dumpsFilePathBuilder({ testInfo, zip });
|
|
29
13
|
if (rootPath) {
|
|
30
14
|
harPath = (0, node_path_1.relative)(rootPath, harPath);
|
|
31
15
|
}
|
|
@@ -49,6 +33,3 @@ async function initDumps(page, testInfo, { dumpsPath: dumpsPathBuilder = default
|
|
|
49
33
|
url,
|
|
50
34
|
});
|
|
51
35
|
}
|
|
52
|
-
function defaultPathBuilder(testInfo, slug) {
|
|
53
|
-
return testInfo.snapshotPath('').replace(/-snapshots\/[^/]+$/, '-data/' + slug);
|
|
54
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/playwright-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Tools for Playwright Test",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"playwright",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"/actions/**/*.*(js|d.ts)",
|
|
20
20
|
"/auth/**/*.*(js|d.ts)",
|
|
21
|
+
"/component-tests/**/*.*(js|d.ts)",
|
|
21
22
|
"/data/**/*.*(js|d.ts)",
|
|
22
23
|
"/fixtures/**/*.*(js|d.ts)",
|
|
23
24
|
"/har/**/*.*(js|d.ts)",
|
|
24
|
-
"/storybook/**/*.*(js|d.ts)",
|
|
25
25
|
"/utils/**/*.*(js|d.ts)",
|
|
26
26
|
"!/**/__tests__"
|
|
27
27
|
],
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"import": "./auth/storage/index.js",
|
|
37
37
|
"require": "./auth/storage/index.js"
|
|
38
38
|
},
|
|
39
|
+
"./component-tests": {
|
|
40
|
+
"types": "./component-tests/index.d.ts",
|
|
41
|
+
"import": "./component-tests/index.js",
|
|
42
|
+
"require": "./component-tests/index.js"
|
|
43
|
+
},
|
|
39
44
|
"./data": {
|
|
40
45
|
"types": "./data/index.d.ts",
|
|
41
46
|
"import": "./data/index.js",
|
|
@@ -51,11 +56,6 @@
|
|
|
51
56
|
"import": "./har/index.js",
|
|
52
57
|
"require": "./har/index.js"
|
|
53
58
|
},
|
|
54
|
-
"./storybook": {
|
|
55
|
-
"types": "./storybook/index.d.ts",
|
|
56
|
-
"import": "./storybook/index.js",
|
|
57
|
-
"require": "./storybook/index.js"
|
|
58
|
-
},
|
|
59
59
|
"./utils": {
|
|
60
60
|
"types": "./utils/index.d.ts",
|
|
61
61
|
"import": "./utils/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"scripts": {
|
|
66
66
|
"prepare": "husky",
|
|
67
67
|
"build": "tsc",
|
|
68
|
-
"clean": "find actions auth data fixtures har
|
|
68
|
+
"clean": "find actions auth component-tests data fixtures har utils -type f ! -name '.eslintrc.js' \\( -name '*.js' -o -name '*.d.ts' \\) -delete",
|
|
69
69
|
"typecheck": "tsc --noEmit",
|
|
70
70
|
"lint": "eslint --ext .ts ./",
|
|
71
71
|
"test": "jest --colors --config=jest.config.js",
|
|
@@ -100,7 +100,9 @@
|
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"@playwright/experimental-ct-react": "^1.22",
|
|
103
|
-
"@playwright/test": "^1.22"
|
|
103
|
+
"@playwright/test": "^1.22",
|
|
104
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
105
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
104
106
|
},
|
|
105
107
|
"engines": {
|
|
106
108
|
"node": ">=20"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{storybook → component-tests/utils/create-smoke-scenarios}/create-smoke-scenarios.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|